[rspec-users] cucumber and openid
priit.tamboom at gmail.com
Sat Sep 6 03:28:41 EDT 2008
Thanks for your answers!
Just for the record, first I override methods and it really
However quite soon I realized, why not to use local openid server
instead. So I picked up masquerade as local openid server. Wow, now
it feels much cleaner and more real to run features.
On Sep 2, 12:31 am, "David Chelimsky" <dchelim... at gmail.com> wrote:
> On Mon, Sep 1, 2008 at 3:31 PM, aslak hellesoy <aslak.helle... at gmail.com> wrote:
> > On Mon, Sep 1, 2008 at 9:25 PM, Priit Tamboom <pr... at mx.ee> wrote:
> >> Hi!
> >> I'm new to Cucumber/Story Runner, but not so new to Rspec in general.
> >> I googled a lot before
> >> posting :-)
> >> I would like to mockopenidconsumer however I'm running out of ideas
> >> how to access session.
> >> I know I should avoid mocking in integration testing, but in this case
> >> it makes sense.
> >> Perhaps I can somehow mock session[:current_user_id] like it is
> >> possible in rspec.
> >> Given /I am logged in as admin/ do
> >> user = User.find(:first)
> >> session.stub!(:current_user_id).and_return(user.id)
> >> end
> >> Any hints how it can solve my mocking in Cucumber would be welcome!
> > Mocking in Cucumber works just like in RSpec. Are you getting any errors?
> The session that RailsStory (in 'spec/story') and in cucumber exposes
> is an ActionController::Integration::Session, not the Hash you get
> from ActionController::Base.session (as is the case in
> ControllerExampleGroup or rails functional tests). So you're not
> setting mock expectations on the object you think you are.
> I haven't worked with open ID, nor do I know what approach your app
> uses to communicate with open ID, but if you wrap that access in a
> method, then you can just override that method in your steps file (or
> any other .rb file as long as you require it) and have it set up state
> the way you want it.
> Make sense?
> > Aslak
> >> Cheers,
> >> Priit
> >> _______________________________________________
> >> rspec-users mailing list
> >> rspec-us... at rubyforge.org
> > _______________________________________________
> > rspec-users mailing list
> > rspec-us... at rubyforge.org
> rspec-users mailing list
> rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users
More information about the rspec-users