Sha256: 7af0ccfb2f523cee34ee20bececfe322e6d760a4d2d8093f6f5d05b02bea8ed7

Contents?: true

Size: 888 Bytes

Versions: 6

Compression:

Stored size: 888 Bytes

Contents

require 'spec_helper'

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

6 entries across 6 versions & 1 rubygems

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