Sha256: 6ebcbf0bf52eb09c3f2869123b303505f711363f1fd8ac6357af9844c38991f3

Contents?: true

Size: 990 Bytes

Versions: 18

Compression:

Stored size: 990 Bytes

Contents

require 'spec_helper'

describe Rack::OAuth2::Debugger::RequestFilter do
  let(:resource_endpoint) { 'https://example.com/resources' }
  let(:request) { HTTP::Message.new_request(:get, URI.parse(resource_endpoint)) }
  let(:response) { HTTP::Message.new_response({:hello => 'world'}.to_json) }
  let(:request_filter) { Rack::OAuth2::Debugger::RequestFilter.new }

  describe '#filter_request' do
    it 'should log request' do
      Rack::OAuth2.logger.should_receive(:info).with(
        "======= [Rack::OAuth2] HTTP REQUEST STARTED =======\n" +
        request.dump
      )
      request_filter.filter_request(request)
    end
  end

  describe '#filter_response' do
    it 'should log response' do
      Rack::OAuth2.logger.should_receive(:info).with(
        "--------------------------------------------------\n" +
        response.dump +
        "\n======= [Rack::OAuth2] HTTP REQUEST FINISHED ======="
      )
      request_filter.filter_response(request, response)
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
rack-oauth2-0.14.8 spec/rack/oauth2/debugger/request_filter_spec.rb
rack-oauth2-0.14.7 spec/rack/oauth2/debugger/request_filter_spec.rb
rack-oauth2-0.14.6 spec/rack/oauth2/debugger/request_filter_spec.rb
rack-oauth2-0.14.5 spec/rack/oauth2/debugger/request_filter_spec.rb
rack-oauth2-0.14.4 spec/rack/oauth2/debugger/request_filter_spec.rb
rack-oauth2-0.14.3 spec/rack/oauth2/debugger/request_filter_spec.rb
rack-oauth2-0.14.2 spec/rack/oauth2/debugger/request_filter_spec.rb
rack-oauth2-0.14.1 spec/rack/oauth2/debugger/request_filter_spec.rb
rack-oauth2-0.14.0 spec/rack/oauth2/debugger/request_filter_spec.rb
rack-oauth2-0.13.0 spec/rack/oauth2/debugger/request_filter_spec.rb
rack-oauth2-0.12.2 spec/rack/oauth2/debugger/request_filter_spec.rb
rack-oauth2-0.12.1 spec/rack/oauth2/debugger/request_filter_spec.rb
rack-oauth2-0.12.0 spec/rack/oauth2/debugger/request_filter_spec.rb
rack-oauth2-0.11.0 spec/rack/oauth2/debugger/request_filter_spec.rb
rack-oauth2-0.10.1 spec/rack/oauth2/debugger/request_filter_spec.rb
rack-oauth2-0.10.0 spec/rack/oauth2/debugger/request_filter_spec.rb
rack-oauth2-0.10.0.alpha spec/rack/oauth2/debugger/request_filter_spec.rb
rack-oauth2-0.9.5 spec/rack/oauth2/debugger/request_filter_spec.rb