Tôi không biết mình đang làm gì sai, nhưng mỗi khi tôi thử kiểm tra chuyển hướng, tôi nhận được lỗi này: "@yquest phải là ActionDispatch :: Yêu cầu "Cách kiểm tra chuyển hướng bằng Rspec và Capybara
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)>'
Tôi đang sử dụng RSpec-ray (2.9.0) với Capybara (1.1.2) và Rails 3.2. Tôi sẽ đánh giá cao nếu ai đó cũng có thể giải thích tại sao điều này xảy ra; tại sao tôi không thể sử dụng kỳ vọng theo cách như vậy?
Có thể tôi đang thiếu thứ gì đó, nhưng có gì sai với 'assert_redirected_to'? –
@JosephWeissman, tôi gặp lỗi tương tự! – Mohamad