我嘗試過測試路由,並從rspec-rails文檔複製了示例。RSpec與Ruby on Rails - 測試路由時參數數量錯誤(1代表0)
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
發生了什麼事錯在這裏:
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的時候有以下錯誤?
感謝您的任何幫助。
您的rspec版本是什麼? – pje
它是2.8.1,更新和問題被解決。 – vision810