Sha256: a171472b377d70586d6ff9b6b3af372d0b3c2bae884ee28daddab060c50702de

Contents?: true

Size: 1.18 KB

Versions: 1

Compression:

Stored size: 1.18 KB

Contents

require 'spec_helper'

describe Rack::OAuth2 do
  subject { Rack::OAuth2 }
  after { Rack::OAuth2.debugging = false }

  its(:logger) { should be_a Logger }
  its(:debugging?) { should be_false }

  describe '.debug!' do
    before { Rack::OAuth2.debug! }
    its(:debugging?) { should be_true }
  end

  describe '.debug' do
    it 'should enable debugging within given block' do
      Rack::OAuth2.debug do
        Rack::OAuth2.debugging?.should be_true
      end
      Rack::OAuth2.debugging?.should be_false
    end

    it 'should not force disable debugging' do
      Rack::OAuth2.debug!
      Rack::OAuth2.debug do
        Rack::OAuth2.debugging?.should be_true
      end
      Rack::OAuth2.debugging?.should be_true
    end
  end

  describe '.http_config' do
    context 'when request_filter added' do
      context 'when "debug!" is called' do
        it 'should put Debugger::RequestFilter at last' do
          Rack::OAuth2.debug!
          Rack::OAuth2.http_config do |config|
            config.request_filter << Proc.new {}
          end
          Rack::OAuth2.http_client.request_filter.last.should be_instance_of Rack::OAuth2::Debugger::RequestFilter
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rack-oauth2-0.14.6 spec/rack/oauth2/oauth2_spec.rb