Sha256: 30b49a2dee629035c57b70759fe65b33ab09e728acdf8b3171096d4eb795b67d

Contents?: true

Size: 708 Bytes

Versions: 2

Compression:

Stored size: 708 Bytes

Contents

require_relative '../spec_helper'

describe Rhinestone::HeaderFilter do
  let(:important_headers) {
    ['Content-Type', 'ETag']
  }

  let(:headers) {
    FakeHeaders.new('Status' => 200, 'Content-Type' => 'application/json')
  }

  let(:filter) { Rhinestone::HeaderFilter.new(important_headers) }

  it "returns only the headers that are important and exist" do
    filter.filter(headers).should == {'Content-Type' => 'application/json'}
  end

  # limit the hash interface to only one method
  # because em-http returns headers uppercased with "indifferent access" via []
  class FakeHeaders
    def initialize(data)
      @data = data
    end

    def [](name)
      return @data[name]
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rhinestone-0.0.2 spec/rhinestone/header_filter_spec.rb
rhinestone-0.0.1 spec/rhinestone/header_filter_spec.rb