I cannot understand why the block of code below is not passing even though the puts value is showing the value I am checking for:
let(:new_on_each_example) { MovieList.new }
it "can use method defined by 'let'" do
new_on_each_example.should_not be_nil
# the object is memoized, so
new_on_each_example.should == new_on_each_example
puts new_on_each_example.class
new_on_each_example.class.should == "MovieList"
end
The console shows:
MovieList
expected: “MovieList”
got: MovieList(id: integer, title: string, created_at: datetime, updated_at: datetime, track_number: integer) (using ==)
Puts displays the value that I’m looking for but the test fails. Why is this?
more info in rspec matchers doc