On Mon, Jan 12, 2009 at 1:47 PM, James Byrne <li...@ruby-forum.com> wrote: > > At the start of every scenario, but is there no way of performing the > actual log in once, place the session info into an instance variable and > then use that rather than actually starting up a new session each and > every time?
Sure. You could mock out your session or deserialize a saved session object in a Cucumber Before block on every feature except the one that tests login. Or put the "Given" call that does the real session initiation inside a Before so you don't have to look at it every time. If you want it to happen _everywhere_, you can also have a Before in the env.rb file. You can't chain the results from one scenario to another, however, because the order scenarios run in (or whether they run at all) is not guaranteed. So you'd have to put it in your setup code. On acceptance testing, I'd favor going through the actual session creation logic instead of mocking it, even if you don't put an explicit "Given" every time. Yeah, it's slower. But acceptance tests aren't _supposed_ to be fast; they're supposed to demonstrate real usage, and be the last line of defense between your app and the big bad world. They're going to be slow with or without login each time. And if there is some unseen routing or filtering bug in some controller's session access that doesn't show up in your test because you skipped past all that, and you lose a day and some hair trying to figure it out, you're going to wonder whether the seconds you saved were worth it. -- Have Fun, Steve Eley (sfe...@gmail.com) ESCAPE POD - The Science Fiction Podcast Magazine http://www.escapepod.org _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users