【发布时间】:2011-12-12 02:12:48
【问题描述】:
我不明白为什么下面的代码块没有通过,即使 puts 值显示了我正在检查的值:
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
控制台显示:
电影列表
预期:“电影列表” 得到:MovieList(id: integer, title: string, created_at: datetime, updated_at: datetime, track_number: integer)(使用==)
Puts 显示我正在寻找但测试失败的值。这是为什么呢?
【问题讨论】:
标签: ruby-on-rails ruby rspec