I don't know what I'm doing wrong, but every time I try to test for a redirect, I get this error: "@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)>'
I'm using RSpec-rails (2.9.0) with Capybara (1.1.2) and Rails 3.2. I would appreciate it if someone could also explain why this is happening; why can't I use the expect in such a way?
assert_redirected_to
? – Joseph Weissman