I''m trying out rspec_on_rails with a very simple test: ... specify "product name should be ''test''" do Product.find( :all ).first.name.should_equal ''test'' end ... with this fixture: first: id: 1 name: test When I run it: .F 1) ''Given a generated product_spec.rb with fixtures loaded product name should be test'' FAILED "test" should equal "test" ./spec/models/product_spec.rb:12: Finished in 0.015563 seconds 2 specifications, 1 failure rake aborted! ------------------------- "test" should equal "test", well, it does. Why is this failing? (Installed rspec gem, installed 0_7_4 of rspec on rails plugin) Thanks Adam -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20061211/7b040b3a/attachment-0001.html
aslak hellesoy
2006-Dec-11 08:35 UTC
[rspec-users] FAILED: "test" should equal "test" - what?
On 12/11/06, Adam Roth <adamjroth at gmail.com> wrote:> I''m trying out rspec_on_rails with a very simple test: > > ... > specify "product name should be ''test''" do > Product.find( :all ).first.name.should_equal ''test'' > end > ... > > with this fixture: > > first: > id: 1 > name: test > > When I run it: > > .F > > 1) > ''Given a generated product_spec.rb with fixtures loaded product name should > be test'' FAILED > "test" should equal "test" > ./spec/models/product_spec.rb:12: > > Finished in 0.015563 seconds > > 2 specifications, 1 failure > rake aborted! > > ------------------------- > > "test" should equal "test", well, it does. Why is this failing?Because "test" is not *equal* to "test" - according to Ruby. Use should_eql or should == instead. http://rspec.rubyforge.org/documentation/expectations.html> > (Installed rspec gem, installed 0_7_4 of rspec on rails plugin) > > > Thanks > Adam > > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > >