Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4066948
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T16:11:22+00:00 2026-05-20T16:11:22+00:00

The wiki page for Devise suggests using the following to test if the user

  • 0

The wiki page for Devise suggests using the following to test if the user is not logged in:

   Given /^I am not authenticated$/ do
     visit('/users/sign_out') # ensure that at least
   end

Which works, but feels wrong as it’s only testing that a certain route is visitable and not really testing that the user isn’t logged in.

Are there other, better ways that can be used to test if the user is logged in with Devise?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T16:11:23+00:00Added an answer on May 20, 2026 at 4:11 pm

    The Given statement is setting up a known state before executing the test scenario, see GWT. In this case, it signs the user out before running the scenario.

    You can use the following scenario to confirm that a resource is really protected by authentication:

    Scenario: Anonymous denied access
      Given I am not authenticated
      When I go to protected_resource
      Then I should see "You need to sign in or sign up before continuing"
    

    The protected_resource needs to be defined in features/support/paths.rb

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this wiki page gave a general idea of how to convert a single char
I need to add a web part zone to a wiki page. I'm opening
http://en.wikipedia.org/wiki/ICalendar I'm working to implement an export feature for events. The link above lists
http://en.wikipedia.org/wiki/Diamond_problem I know what it means, but what steps can I take to avoid
For my small wiki application, I mostly need to have the textarea used to
The Emacs Wiki lists several modes for supporting mercurial inside of Emacs, including the
The Ruby On Rails Wiki lists a couple of librarie s that facilitate PDF
What is the best wiki engine with good authorization features?
I used the wiki in a project hosted at Google Code. With this wiki
I'm thinking of starting a wiki, probably on a low cost LAMP hosting account.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.