Sha256: daae61480e2077baa4ac779c2f767a431fe65c8f84c53060928886927160431f

Contents?: true

Size: 972 Bytes

Versions: 7

Compression:

Stored size: 972 Bytes

Contents

require 'spec_helper'

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

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

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
webfinger-1.0.0 spec/webfinger/debugger/request_filter_spec.rb
webfinger-0.0.5 spec/webfinger/debugger/request_filter_spec.rb
webfinger-0.0.4 spec/webfinger/debugger/request_filter_spec.rb
webfinger-0.0.3 spec/webfinger/debugger/request_filter_spec.rb
webfinger-0.0.2 spec/webfinger/debugger/request_filter_spec.rb
webfinger-0.0.1 spec/webfinger/debugger/request_filter_spec.rb
webfinger-0.0.0 spec/webfinger/debugger/request_filter_spec.rb