If you want to be able to disable answers, do the following:
In the functions /support/helpers.rb:
ActionController::Base.class_eval do private def fake_openid_response(identity_url) [OpenIdAuthentication::Result.new(:successful), identity_url, nil] end def begin_open_id_authentication(identity_url, options = {}) yield fake_openid_response(identity_url) end end
By moving the answer to a separate method, you can now drown out the answer at your own steps, if necessary. For example, if I wanted: a missing answer, and I had a GoogleLoginController, I could do the following with Mocha:
GoogleLoginController.any_instance.stubs(:fake_openid_response) .returns([OpenIdAuthentication::Result.new(:missing), identity_url, nil])
Greg DeVore
source share