Having difficulty testing redirects with Rspec and Capybara

Every time I try to test a redirect, I get this error: @request must be an ActionDispatch::Request

Any idea why? I’m using Rspec-Rails 2.9.0, Capybara 1.1.2, and Rails 3.2. Here’s my test:

describe “AdminAccountPages” do

subject { page }

let(:user) { FactoryGirl.create(:user) }

let(:account) { user.owned_accounts.create!(name: “ACME Corp”, subdomain: “acme”) }

describe “Admin::Accounts#show” do

context “as non-signed in user” do

before do

visit admin_account_url(account, host: get_host(account))

end

it “should redirect to the login page” do

assert_redirected_to signin_path

end

end

end

end