Sha256: 1092fe612e82a8b4bb737b56dd439c70ee9e12d97c5f7fa26d8522f99a51d6fa

Contents?: true

Size: 788 Bytes

Versions: 8

Compression:

Stored size: 788 Bytes

Contents

if ENV['COVERAGE']
  require 'simplecov'
  SimpleCov.start do
    # add_filter 'faraday_middleware.rb'
    add_filter 'backwards_compatibility.rb'
  end
end

require 'rspec'

module ResponseMiddlewareExampleGroup
  def self.included(base)
    base.let(:options) { Hash.new }
    base.let(:middleware) {
      described_class.new(lambda {|env|
        Faraday::Response.new(env)
      }, options)
    }
  end

  def process(body, content_type = nil, options = {})
    env = {
      :body => body, :request => options,
      :response_headers => Faraday::Utils::Headers.new
    }
    env[:response_headers]['content-type'] = content_type if content_type
    middleware.call(env)
  end
end

RSpec.configure do |config|
  config.include ResponseMiddlewareExampleGroup, :type => :response
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
agiley-faraday_middleware-0.8.3.2 spec/helper.rb
agiley-faraday_middleware-0.8.3.1 spec/helper.rb
faraday_middleware-0.8.4 spec/helper.rb
agiley-faraday_middleware-0.8.3 spec/helper.rb
faraday_middleware-0.8.3 spec/helper.rb
faraday_middleware-0.8.2 spec/helper.rb
faraday_middleware-0.8.1 spec/helper.rb
faraday_middleware-0.8.0 spec/helper.rb