The backdoor for testing doesn't work with follow redirects
When using the clearance backdoor for testing, and using as user, when following redirects by clicking on links, it doesn't continue with the same user, making this backdoor useless, and you can't use as in follow_redirect! or click_on for example
here is a simple test that that is created by using the rails scaffold generator, and it fails because click on leads to a redirect
test "creating a Car" do
visit cars_url(as: @user)
click_on "New Car"
fill_in "Make", with: @car.make
fill_in "Model", with: @car.model
fill_in "Year", with: @car.year
click_on "Create Car"
assert_text "Car was successfully created"
click_on "Back"
end
and here is a repository I created for reproducing this issue, it contains just a minimal created rails app with users and cars scaffold, you can just run the tests by ralis test:system and it would fail
I am facing the same issue upon upgrading to Rails7
Just hit the same issue. Not clear how to make clearance work with system tests…