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

  • SEARCH
  • Home
  • 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 3755556
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T09:43:01+00:00 2026-05-19T09:43:01+00:00

I have the following step for a Cucumber scenario: Given /^I am not logged

  • 0

I have the following step for a Cucumber scenario:

Given /^I am not logged in$/ do
  request.reset_session
  controller.instance_variable_set(:@_current_user, nil)
end

But when I run my Cucumber features, I get:

undefined method `reset_session' for nil:NilClass (NoMethodError)

My setup:

  • rails 3.0.3
  • cucumber-rails 0.3.2
  • 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-19T09:43:02+00:00Added an answer on May 19, 2026 at 9:43 am

    Cucumber is intended to exercise the full stack. Given that, you generally don’t want to muck around with the internals at a lower level as you might with rspec.

    Try something like this:

    Given /^I am not logged in$/ do
      visit logout_path
    end
    

    This example uses Capybara’s visit method, so you’ll need to adjust accordingly, but this should give you the right idea.

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

Sidebar

Related Questions

I have a Cucumber scenario with the following step: Given /^I have logged in$/
I have the following Cucumber scenario: Scenario: find vegetable with same color Given I
I'm using following construct in a cucumber step definition. Given I have following stuff
I'm getting started with cucumber, and I have written the following step definition, which
I'm using Devise for user Authentication and have the following failing Cucumber scenario: Scenario:
I have the following step definition written with Cucumber based on Calabash. The name
I have a cucumber step that involves the following: When /^I select from the
I have the following step: Then I should see an error message with identical
For strongly-typed & type-safe solution, I have to do the following step. Create some
I have got a the following problem: I have got multi-step form where in

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.