【发布时间】:2011-09-18 17:37:55
【问题描述】:
怎么了,伙计们。请帮忙。
当我运行我的黄瓜测试时,我遇到了这个错误:
No route matches {:action=>"show", :controller=>"accounts"} (ActionController::RoutingError)
./features/support/paths.rb:40:in `path_to'
rake 路线显示:
account GET /accounts/:id(.:format) {:action=>"show", :controller=>"accounts"}
cucumber_test.feature
Scenario:
Given...
And...
Then i should be on Show page
features/support/paths.rb
when /^Show page$/
account_path @account
routes.rb
Myapp::Application.routes.draw do
resources :accounts
【问题讨论】:
-
@account.inspect 显示什么?
-
安迪,我如何将@account.inspect 放入我正在运行的黄瓜测试中?
-
在When步骤的第一行添加“puts @account.inspect”。
-
是的,伙计们。你是对的,它返回 nil。现在我要打破我的大脑,因为真的不知道为什么它是 nil :(
-
嗯,它更像是:你为什么不希望它为零??
标签: ruby-on-rails cucumber bdd