Re: [rspec-users] another noob question about stubs

2008-05-05 Thread Hans de Graaff
On Wed, 2008-04-30 at 11:26 -0500, Patrick Aljord wrote: > My spec looks like this: > it "should login with openid and redirect" do > openid_url = "patcito.myopenid.com" > controller.stub!(:using_open_id?).and_return(true) > > controller.stub!(:authenticate_with_open_id).and_yield(r

Re: [rspec-users] another noob question about stubs

2008-04-30 Thread Patrick Aljord
> You'd need to paste more of your spec and controller action that you're > stubbing for anyone to be of further help. > I think I posted it on my first post, here it is: def open_id_authentication(openid_url) authenticate_with_open_id(openid_url, :required => [:nickname, :email], :optional

Re: [rspec-users] another noob question about stubs

2008-04-30 Thread Bryan Ray
If you used Matt's code below, then successful? is most likely referring to a method after your open_id_authentication method. When you stub! that method you're effectively telling rspec to skip over it and return what I tell you instead. You'd need to paste more of your spec and controller

Re: [rspec-users] another noob question about stubs

2008-04-29 Thread Patrick Aljord
ok thanks, I still get a "undefined method `successful?'", successful? is a method that is used inside of the block, it's partof the open_id_authentication plugin, any way to include the plugin in the spec so that it recognizes the method? thanks in advance Pat ___

Re: [rspec-users] another noob question about stubs

2008-04-29 Thread Matt Patterson
On 29 Apr 2008, at 17:00, Patrick Aljord wrote: I tried to make a stub but with no success, maybe because it's a block. Any hint about that one please? What are you trying to stub? Are you trying to stub authenticate_with_open_id? def open_id_authentication(openid_url) authenticate_with_o

[rspec-users] another noob question about stubs

2008-04-29 Thread Patrick Aljord
I have this function in my controller: def open_id_authentication(openid_url) authenticate_with_open_id(openid_url, :required => [:nickname, :email], :optional => [:fullname]) do |result, identity_url, registration| if result.successful? @user = User.find_or_initialize_by_identi