Sha256: b85eeadc21a45f2ed14a9931e71c8716b3d853721365f0a4f250975dc06483d9

Contents?: true

Size: 792 Bytes

Versions: 2

Compression:

Stored size: 792 Bytes

Contents

require 'twimock/omniauth/strategies/twitter'
require 'omniauth-twitter'

module Twimock
  module OmniAuthTwitter
    extend self
    @@enable = false

    def on?
      @@enable
    end

    def on
      unless Twimock::OmniAuthTwitter.on?
        ::OmniAuth::Strategies::Twitter.class_eval do
          alias_method  :__request_phase, :request_phase
          remove_method :request_phase
          include Twimock::OmniAuth::Strategies::Twitter
        end
        @@enable = true
      end
      true
    end

    def off
      if Twimock::OmniAuthTwitter.on?
        ::OmniAuth::Strategies::Twitter.class_eval do
          alias_method  :request_phase, :__request_phase
          remove_method :__request_phase
        end
        @@enable = false
      end
      true
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
twimock-0.0.2 lib/twimock/omniauth_twitter.rb
twimock-0.0.1 lib/twimock/omniauth_twitter.rb