Getting to the session from Stories

Hey all,

In a story I want to say

Given “A logged in user” do
sesson[:logged_in] = true
etc…
end

But the session method doesn’t have anything to bind to, I get the
error ‘… while evaluating nil.session…’

Any ideas?

The fact that the user is logged in or not, doesn’t matter to this
story, so I just want to stub it out.

The other way is stubbing out all the authentication methods, but that
is more typing :slight_smile: (less than this message to find out how to do it
the short way, but you know, once you think you need to do something,
doing it the longer way just seems wrong :smiley:

Regards

Mikel

On Sat, Apr 5, 2008 at 9:55 PM, Mikel L. [email protected]
wrote:

error ‘… while evaluating nil.session…’

Any ideas?

This is not supported by Rails’ ActionController::IntegrationTest,
from which RailsStory is derived.

The intention of ActionController::IntegrationTest is to provide an
environment for testing through routers. What you’re trying to do is
really the domain of RSpec controller specs or Rails functional tests.

What I’d recommend is that you actually log in and go from there:

The fact that the user is logged in or not, doesn’t matter to this
story, so I just want to stub it out.

Stubbing in stories should be avoided except for stubbing external
services.

HTH,
David