Cucumber + Capybara - web sessions

I need to do this:

  Scenario: Access private area without a session
    Given I don't have a session
    When I access private area
    Then I should see "You are not logged in"

Is there a way to remove the session cookie in "Given I don't have a
session" with capybara?
I know I could visit the logout page, but what if I didn't have this
feature yet?

Have you tried:

session.delete

or perhaps:

session.destroy

Given /I am not logged in/ do
    session.destroy
end

It doesn't work!
It seems session can be accessed only from a controller, but I'm not
sure.

Leandro wrote in post #968636:

Given /I am not logged in/ do
    session.destroy
end

It doesn't work!

When you say "It doesn't work!" what error are you getting? Is session
defined? If not then do you have sessions turned off in the
ApplicationController? Have you established a session to start with?

Take a look at this for further help:

http://rails.nuvvo.com/lesson/6372-action-controller-session

I need to do this:

Scenario: Access private area without a session

Given I don't have a session

When I access private area

Then I should see "You are not logged in"

Is there a way to remove the session cookie in "Given I don’t have a

session" with capybara?

I know I could visit the logout page, but what if I didn’t have this

feature yet?

Leandro, are you using a Authlogic or Devise to provide the authentication functionality?

-Conrad

No, I'm using my own authentication logic.