Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with Manual Login and Logout in Specs #214

Open
albertski opened this issue Jul 11, 2024 · 0 comments
Open

Issues with Manual Login and Logout in Specs #214

albertski opened this issue Jul 11, 2024 · 0 comments

Comments

@albertski
Copy link

I have a question regarding the login_as helper. I'm using Rails 6 application with Devise (which uses Warden). I have a spec where I want to test the login page as a real user, so I have a method like this:

  def log_in(user)
    visit '/users/login'
    fill_in 'Email', with: user.email
    fill_in 'Password', with: user.password
    click_button 'Login'
  end

The problem is after I logout and then try to go login again. I get an error that I am already signed in. If I use login_as(user, scope: :user) the issue goes away.

Do we have to use the login_as method for proper sign-in/sign-out functionality in specs, or am I missing something in my manual login approach? (Sorry, if this is a Devise question and not a Warden question)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant