Module: Quickdraw::Matchers::ToHaveAttributes

Defined in:
lib/quickdraw/matchers/to_have_attributes.rb

Instance Method Summary collapse

Instance Method Details

#to_have_attributes(**attributes) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/quickdraw/matchers/to_have_attributes.rb', line 4

def to_have_attributes(**attributes)
	attributes.each do |k, v|
		assert v === value.send(k) do
			"expected `#{value.inspect}` to have the attribute `#{k.inspect}` equal to `#{v.inspect}`"
		end
	end
rescue NoMethodError => e
	failure! { "expected `#{value.inspect}` to respond to `#{e.name}`" }
end