Sha256: 21ad3cd5f72a87df45ae78884ffea9ba71e614d83d1d12dcc26da1599b53d29d

Contents?: true

Size: 902 Bytes

Versions: 36

Compression:

Stored size: 902 Bytes

Contents

# frozen_string_literal: true

RSpec.describe HTTP::Options, "new" do
  it "supports a Options instance" do
    opts = HTTP::Options.new
    expect(HTTP::Options.new(opts)).to eq(opts)
  end

  context "with a Hash" do
    it "coerces :response correctly" do
      opts = HTTP::Options.new(:response => :object)
      expect(opts.response).to eq(:object)
    end

    it "coerces :headers correctly" do
      opts = HTTP::Options.new(:headers => {:accept => "json"})
      expect(opts.headers).to eq([%w[Accept json]])
    end

    it "coerces :proxy correctly" do
      opts = HTTP::Options.new(:proxy => {:proxy_address => "127.0.0.1", :proxy_port => 8080})
      expect(opts.proxy).to eq(:proxy_address => "127.0.0.1", :proxy_port => 8080)
    end

    it "coerces :form correctly" do
      opts = HTTP::Options.new(:form => {:foo => 42})
      expect(opts.form).to eq(:foo => 42)
    end
  end
end

Version data entries

36 entries across 36 versions & 3 rubygems

Version Path
direct7-0.0.18 vendor/bundle/ruby/2.7.0/gems/http-5.1.1/spec/lib/http/options/new_spec.rb
direct7-0.0.17 vendor/bundle/ruby/2.7.0/gems/http-5.1.1/spec/lib/http/options/new_spec.rb
direct7-0.0.16 vendor/bundle/ruby/2.7.0/gems/http-5.1.1/spec/lib/http/options/new_spec.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/http-5.2.0/spec/lib/http/options/new_spec.rb
direct7-0.0.13 vendor/bundle/ruby/2.7.0/gems/http-5.1.1/spec/lib/http/options/new_spec.rb
direct7-0.0.12 vendor/bundle/ruby/2.7.0/gems/http-5.1.1/spec/lib/http/options/new_spec.rb
http-5.2.0 spec/lib/http/options/new_spec.rb
direct7-0.0.11 vendor/bundle/ruby/2.7.0/gems/http-5.1.1/spec/lib/http/options/new_spec.rb
http-5.1.1 spec/lib/http/options/new_spec.rb
http-5.1.0 spec/lib/http/options/new_spec.rb
http-5.0.4 spec/lib/http/options/new_spec.rb
http-5.0.3 spec/lib/http/options/new_spec.rb
http-5.0.2 spec/lib/http/options/new_spec.rb
http-5.0.1 spec/lib/http/options/new_spec.rb
http-5.0.0 spec/lib/http/options/new_spec.rb
http-4.4.1 spec/lib/http/options/new_spec.rb
http-4.4.0 spec/lib/http/options/new_spec.rb
http-5.0.0.pre3 spec/lib/http/options/new_spec.rb
http-5.0.0.pre2 spec/lib/http/options/new_spec.rb
http-4.3.0 spec/lib/http/options/new_spec.rb