我尝试测试路线,只是从 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
这里出了什么问题?
谢谢你的帮助。