Sha256: 0c8cb8be7587721e264f9367a65f3e853c3e2e894113c760a9caa066d8e28669

Contents?: true

Size: 1.04 KB

Versions: 9

Compression:

Stored size: 1.04 KB

Contents

require 'spec_helper'

describe OpenIDConnect::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) { OpenIDConnect::Debugger::RequestFilter.new }

  describe '#filter_request' do
    it 'should log request' do
      [
        "======= [OpenIDConnect] HTTP REQUEST STARTED =======",
        request.dump
      ].each do |output|
        OpenIDConnect.logger.should_receive(:info).with output
      end
      request_filter.filter_request(request)
    end
  end

  describe '#filter_response' do
    it 'should log response' do
      [
        "--------------------------------------------------",
        response.dump,
        "======= [OpenIDConnect] HTTP REQUEST FINISHED ======="
      ].each do |output|
        OpenIDConnect.logger.should_receive(:info).with output
      end
      request_filter.filter_response(request, response)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
openid_connect-0.8.0 spec/openid_connect/debugger/request_filter_spec.rb
openid_connect-0.7.3 spec/openid_connect/debugger/request_filter_spec.rb
openid_connect-0.7.2 spec/openid_connect/debugger/request_filter_spec.rb
openid_connect-0.7.1 spec/openid_connect/debugger/request_filter_spec.rb
openid_connect-0.7.0 spec/openid_connect/debugger/request_filter_spec.rb
openid_connect-0.6.1 spec/openid_connect/debugger/request_filter_spec.rb
openid_connect-0.6.0 spec/openid_connect/debugger/request_filter_spec.rb
openid_connect-0.5.1 spec/openid_connect/debugger/request_filter_spec.rb
openid_connect-0.5.0 spec/openid_connect/debugger/request_filter_spec.rb