Ruby on rails 3 Rails 3断言失败消息:";预期块将返回真值“;没有帮助;有什么好处?
这在我的控制器和路由测试中经常发生。例如,给定路线Ruby on rails 3 Rails 3断言失败消息:";预期块将返回真值“;没有帮助;有什么好处?,ruby-on-rails-3,testing,tdd,Ruby On Rails 3,Testing,Tdd,这在我的控制器和路由测试中经常发生。例如,给定路线 match "/about", :to => "about#profile" 测试呢 test "/about goes to about/profile" do assert_generates "/about/", { :controller => "about", :action => "profile" } end 唯一的失败消息是“预期块返回真值”。这种情况也会发生在以下测试中: test "bills sh
match "/about", :to => "about#profile"
测试呢
test "/about goes to about/profile" do
assert_generates "/about/", { :controller => "about", :action => "profile" }
end
唯一的失败消息是“预期块返回真值”。这种情况也会发生在以下测试中:
test "bills should redirect to /bills" do
get :bills
assert_redirected_to user_bills_path(@user)
end
如果我的控制器没有“重定向到user\u bills\u path(@user)
,我会得到相同的错误:“预期块返回真值”
这对于测试驱动来说是非常烦人的,因为在编写生产代码之前,我无法轻松检查我的断言是否失败,或者因为我编写了错误的测试而失败
它似乎来自Rails的测试内容。有没有办法避免这种情况或获得更好的信息