Sha256: 8c453d48de42ac45c9c5a83f98561b7b7f2baff5e7e2eef4d8b17bc9604b4854
Contents?: true
Size: 1.12 KB
Versions: 4
Compression:
Stored size: 1.12 KB
Contents
require File.dirname(__FILE__) + '/test_helper' class Twurl::AuthorizationController::DispatchTest < Test::Unit::TestCase attr_reader :options, :client, :controller def setup @options = Twurl::Options.new @client = Twurl::OAuthClient.load_new_client_from_options(options) @controller = Twurl::AuthorizationController.new(client, options) end def test_successful_authentication_saves_retrieved_access_token mock(client).exchange_credentials_for_access_token.times(1) mock(client).save.times(1) mock(controller).raise(Twurl::Exception, Twurl::AuthorizationController::AUTHORIZATION_FAILED_MESSAGE).never mock(Twurl::CLI).puts(Twurl::AuthorizationController::AUTHORIZATION_SUCCEEDED_MESSAGE).times(1) controller.dispatch end module ErrorCases def test_failed_authorization_does_not_save_client mock(client).exchange_credentials_for_access_token { raise OAuth::Unauthorized } mock(client).save.never mock(controller).raise(Twurl::Exception, Twurl::AuthorizationController::AUTHORIZATION_FAILED_MESSAGE).times(1) controller.dispatch end end include ErrorCases end
Version data entries
4 entries across 4 versions & 1 rubygems