我不知道我做错了什么,但每次我尝试测试重定向时,我都会收到此错误:“@request must be an ActionDispatch::Request”
context "as non-signed in user" do
it "should redirect to the login page" do
expect { visit admin_account_url(account, host: get_host(account)) }.to redirect_to(signin_path)
end
end
1) AdminAccountPages Admin::Accounts#show as non-signed in user should redirect to the login page
Failure/Error: expect { visit admin_account_url(account, host: get_host(account)) }.to redirect_to(signin_path)
ArgumentError:
@request must be an ActionDispatch::Request
# ./spec/requests/admin_account_pages_spec.rb:16:in `block (4 levels) in <top (required)>'
我将 RSpec-rails (2.9.0) 与 Capybara (1.1.2) 和 Rails 3.2 一起使用。如果有人也能解释为什么会发生这种情况,我将不胜感激;为什么我不能以这种方式使用期望?