Sha256: f5ff423dafd239051d171c4ea9928c0476323d74fee05ee5aebdf99aebdf0254

Contents?: true

Size: 545 Bytes

Versions: 6

Compression:

Stored size: 545 Bytes

Contents

require 'spec_helper'

describe HTTP::Options, 'headers' do

  let(:opts) { HTTP::Options.new }

  it 'defaults to be empty' do
    expect(opts.headers).to be_empty
  end

  it 'may be specified with with_headers' do
    opts2 = opts.with_headers('accept' => 'json')
    expect(opts.headers).to be_empty
    expect(opts2.headers).to eq([%w[Accept json]])
  end

  it 'accepts any object that respond to :to_hash' do
    x = Struct.new(:to_hash).new('accept' => 'json')
    expect(opts.with_headers(x).headers['accept']).to eq('json')
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
http-0.6.4 spec/http/options/headers_spec.rb
http-0.6.3 spec/http/options/headers_spec.rb
http-0.6.2 spec/http/options/headers_spec.rb
http-0.6.1 spec/http/options/headers_spec.rb
http-0.6.0 spec/http/options/headers_spec.rb
http-0.6.0.pre spec/http/options/headers_spec.rb