[rspec-users] another noob question about stubs

Patrick Aljord patcito at gmail.com
Tue Apr 29 12:00:52 EDT 2008


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_identity_url(identity_url)
        if @user.new_record?
          @user.login = registration['nickname']
          @user.fullname = registration['fullname']
          @user.email = registration['email']
          @user.save!
          @user.activate
        end
        self.current_user = @user
        successful_login
      else
        failed_login result.message, 'openid'
      end
    end
end


I tried to make a stub but with no success, maybe because it's a
block. Any hint about that one please?

Thanks in advance

Pat


More information about the rspec-users mailing list