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_open_id(openid_url, :required => [:nickname,
:email], :optional => [:fullname]) do |result, identity_url,
registration|
    if result.successful?
      @user = User.find_or_initialize_by_identity_url(identity_url)
      ...
    end
  end
end


If so, you could try

controller.stub! (:authenticate_with_open_id ).and_yield(:result, :identity_url, :registration)

so that the code in the block actually gets run (a normal stub, or one with and_return with simply eat the block). Obviously, make sure that it's yielding the values you want it to.

HTH

Matt

--
  Matt Patterson | Design & Code
  <matt at reprocessed org> | http://www.reprocessed.org/



_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to