http://ruby.railstutorial.org/chapters/following-users?version=3.2
有一个用户模型的测试
it { should respond_to(:reverse_relationships) }
失败:
失败:
1) User ←[31mFailure/Error:←[0m ←[31mit { should respond_to(:reverse_relationships) }←[0m ←[31mNoMethodError:←[0m ←[31mundefined 方法
it' for #<RSpec::Core::ExampleGroup::Nested_3:0x32 6c310>←[0m ←[36m # ./spec/models/user_spec.rb:36:in
块(2级) in '←[0m23秒内完成←[31m131个例子,1个失败←[0m
失败的例子:
←[31mrspec ./spec/models/user_spec.rb:35←[0m ←[36m#用户←[0m
同时,在 rails console --sandbox 看起来还不错:
irb(main):014:0> user.respond_to?(:reverse_relationships) => true
怎么可能?