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(result,openid_url,registration={"nickname"=>"patcito","email"=>"[EMAIL
> PROTECTED]","fullname"=>'bobby
> bob'})
> post :create, :openid_url => openid_url
> session[:user_id].should_not be(nil)
> response.should be_redirect
> end
result is not defined, so the successful? method isn't known. I'd create
a mock for it and stub! that method.
result = mock('openid result')
result.stub!(:successful?).and_return(true)
You can then use result.should_receive(:successful?) in subsequent specs
to describe what happens if the result of the call is and isn't
successful.
Kind regards,
Hans
signature.asc
Description: This is a digitally signed message part
_______________________________________________ rspec-users mailing list [email protected] http://rubyforge.org/mailman/listinfo/rspec-users
