Sha256: 2c516dcd008e77cad284030a1d05f2528143f2c2dae3f9d684b15f183f80c5c4

Contents?: true

Size: 526 Bytes

Versions: 45

Compression:

Stored size: 526 Bytes

Contents

RSpec.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

45 entries across 45 versions & 1 rubygems

Version Path
http-2.0.1 spec/lib/http/options/headers_spec.rb
http-2.0.0 spec/lib/http/options/headers_spec.rb
http-2.0.0.pre spec/lib/http/options/headers_spec.rb
http-1.0.4 spec/lib/http/options/headers_spec.rb
http-0.9.9 spec/lib/http/options/headers_spec.rb
http-1.0.3 spec/lib/http/options/headers_spec.rb
http-1.0.2 spec/lib/http/options/headers_spec.rb
http-1.0.1 spec/lib/http/options/headers_spec.rb
http-1.0.0 spec/lib/http/options/headers_spec.rb
http-1.0.0.pre6 spec/lib/http/options/headers_spec.rb
http-1.0.0.pre5 spec/lib/http/options/headers_spec.rb
http-1.0.0.pre4 spec/lib/http/options/headers_spec.rb
http-1.0.0.pre3 spec/lib/http/options/headers_spec.rb
http-1.0.0.pre2 spec/lib/http/options/headers_spec.rb
http-1.0.0.pre1 spec/lib/http/options/headers_spec.rb
http-0.9.8 spec/lib/http/options/headers_spec.rb
http-0.9.7 spec/lib/http/options/headers_spec.rb
http-0.9.6 spec/lib/http/options/headers_spec.rb
http-0.9.5 spec/lib/http/options/headers_spec.rb
http-0.9.4 spec/lib/http/options/headers_spec.rb