Sha256: eae8c641a4ab2ccbac241416f05ad7b0d72e99d41f7dc75ec5308ed59705f6c3

Contents?: true

Size: 646 Bytes

Versions: 2

Compression:

Stored size: 646 Bytes

Contents

require 'spec_helper'

describe Http::Options, "headers" do

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

  it 'defaults to {}' do
    opts.headers.should eq({})
  end

  it 'may be specified with with_headers' do
    opts2 = opts.with_headers("accept" => "json")
    opts.headers.should eq({})
    opts2.headers.should eq("accept" => "json")
  end

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

  it 'recognizes invalid headers' do
    lambda{
      opts.with_headers(self)
    }.should raise_error(ArgumentError)
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
http-0.3.0 spec/http/options/headers_spec.rb
http-0.2.0 spec/http/options/headers_spec.rb