Sha256: 850847030c25186bbd1b3e5933b228ccc9e26638ffb23ead880c7bb967a08bb9

Contents?: true

Size: 557 Bytes

Versions: 19

Compression:

Stored size: 557 Bytes

Contents

# frozen_string_literal: true

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

19 entries across 19 versions & 1 rubygems

Version Path
http-4.4.1 spec/lib/http/options/headers_spec.rb
http-4.4.0 spec/lib/http/options/headers_spec.rb
http-4.3.0 spec/lib/http/options/headers_spec.rb
http-4.2.0 spec/lib/http/options/headers_spec.rb
http-4.1.1 spec/lib/http/options/headers_spec.rb
http-4.1.0 spec/lib/http/options/headers_spec.rb
http-4.0.5 spec/lib/http/options/headers_spec.rb
http-4.0.4 spec/lib/http/options/headers_spec.rb
http-5.0.0.pre spec/lib/http/options/headers_spec.rb
http-4.0.3 spec/lib/http/options/headers_spec.rb
http-4.0.2 spec/lib/http/options/headers_spec.rb
http-4.0.1 spec/lib/http/options/headers_spec.rb
http-4.0.0 spec/lib/http/options/headers_spec.rb
http-3.3.0 spec/lib/http/options/headers_spec.rb
http-3.2.1 spec/lib/http/options/headers_spec.rb
http-3.2.0 spec/lib/http/options/headers_spec.rb
http-3.1.0 spec/lib/http/options/headers_spec.rb
http-3.0.0 spec/lib/http/options/headers_spec.rb
http-3.0.0.pre spec/lib/http/options/headers_spec.rb