Sha256: f3ffc87ed7757abe70d72ba9d39bb39b18a3cf10705d3376126a0978e1bac7a4

Contents?: true

Size: 554 Bytes

Versions: 21

Compression:

Stored size: 554 Bytes

Contents

RSpec::Matchers.define :match_response do |options|
  defaults = { :code => 200, :headers => { "Accept-encoding" => "utf-8" }, :body => "" }
  response = defaults.merge options

  match do |actual|
    expect(actual).to be_an(HTTPI::Response)
    expect(actual.code).to eq(response[:code])
    expect(downcase(actual.headers)).to eq(downcase(response[:headers]))
    expect(actual.body).to eq(response[:body])
  end

  def downcase(hash)
    hash.inject({}) do |memo, (key, value)|
      memo[key.downcase] = value.downcase
      memo
    end
  end

end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
httpi-4.0.3 spec/support/matchers.rb
httpi-4.0.2 spec/support/matchers.rb
httpi-4.0.1 spec/support/matchers.rb
httpi-3.0.2 spec/support/matchers.rb
httpi-3.0.1 spec/support/matchers.rb
httpi-3.0.0 spec/support/matchers.rb
httpi-2.5.0 spec/support/matchers.rb
httpi-2.4.5 spec/support/matchers.rb
httpi-2.4.4 spec/support/matchers.rb
httpi-2.4.3 spec/support/matchers.rb
httpi-2.4.2 spec/support/matchers.rb
httpi-2.4.1 spec/support/matchers.rb
httpi-2.4.0 spec/support/matchers.rb
httpi-2.3.0 spec/support/matchers.rb
httpi-2.2.7 spec/support/matchers.rb
httpi-2.2.6 spec/support/matchers.rb
httpi-2.2.5 spec/support/matchers.rb
httpi-2.2.4 spec/support/matchers.rb
httpi-2.2.3 spec/support/matchers.rb
httpi-2.2.1 spec/support/matchers.rb