Sha256: 09e5a8f6e2ad385b2fa6602fd071cfd9ec64a9331ce7068c324ec34c464ab0da

Contents?: true

Size: 1.02 KB

Versions: 9

Compression:

Stored size: 1.02 KB

Contents

require 'spec_helper'

describe FbGraph::RequestFilters::Debugger do
  let(:resource_endpoint) { 'https://graph.facebook.com/matake' }
  let(:request) { HTTP::Message.new_request(:get, URI.parse(resource_endpoint)) }
  let(:response) { HTTP::Message.new_response({:hello => 'world'}.to_json) }
  let(:request_filter) { FbGraph::RequestFilters::Debugger.new }

  describe '#filter_request' do
    it 'should log request' do
      [
        "======= [FbGraph] API REQUEST STARTED =======",
        request.dump
      ].each do |output|
        FbGraph.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,
        "======= [FbGraph] API REQUEST FINISHED ======="
      ].each do |output|
        FbGraph.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
fb_graph-2.7.17 spec/fb_graph/request_filters/debugger_spec.rb
fb_graph-2.7.16 spec/fb_graph/request_filters/debugger_spec.rb
fb_graph-2.7.15 spec/fb_graph/request_filters/debugger_spec.rb
fb_graph-2.7.14 spec/fb_graph/request_filters/debugger_spec.rb
fb_graph-2.7.13 spec/fb_graph/request_filters/debugger_spec.rb
fb_graph-2.7.12 spec/fb_graph/request_filters/debugger_spec.rb
fb_graph-2.7.11 spec/fb_graph/request_filters/debugger_spec.rb
fb_graph-2.7.10 spec/fb_graph/request_filters/debugger_spec.rb
fb_graph-2.7.9 spec/fb_graph/request_filters/debugger_spec.rb