【发布时间】:2012-11-03 18:55:58
【问题描述】:
我尝试了测试路线,只是从 rspec-rails 文档中复制了示例。
describe "routing to profiles" do
it "routes /profile/:username to profile#show for username" do
expect(:get => "/profiles/jsmith").to route_to(
:controller => "profiles",
:action => "show",
:username => "jsmith"
)
end
end
运行 RSpec 时出现以下错误:
Failures:
1) routing to profiles routes /profile/:username to profile#show for username
Failure/Error: expect(:get => "/profiles/jsmith").to route_to(
ArgumentError:
wrong number of arguments (1 for 0)
# ./spec/routing/test_spec.rb:11:in `block (2 levels) in <top (required)>'
Finished in 0.001 seconds
1 example, 1 failure
这里出了什么问题?
感谢您的帮助。
【问题讨论】:
-
2.8.1,已更新,问题已解决。
标签: ruby-on-rails ruby ruby-on-rails-3 rspec tdd