1
我正在使用Rspec版本3,并且我有一个has_attributes匹配器的问题。Rspec have_attributes匹配器
的代码我测试:
it 'will match class instances with #have_attributes' do
Person = Struct.new(:name, :age)
person = Person.new("Jim", 32)
expect(person).to have_attributes(:name => "Jim", :age => 32)
end
但我得到这个错误:
Failure/Error: expect(person).to have_attributes(:name => "Jim", :age => 32)
expected #<struct Person name="Jim", age=32> to respond to `has_attributes?`
感谢