Sha256: 99705718995d54ce1f699d00494764fe76f42af0f7cdd968df1045b7068023b6
Contents?: true
Size: 1.26 KB
Versions: 2
Compression:
Stored size: 1.26 KB
Contents
require 'spec_helper' describe Http::Options, "new" do let(:user_agent) { "RubyHttpGem/#{Http::VERSION}" } it 'supports a Options instance' do opts = Http::Options.new Http::Options.new(opts).should eq(opts) end context 'with a Hash' do it 'coerces :response correctly' do opts = Http::Options.new(:response => :object) opts.response.should eq(:object) end it 'coerces :headers correctly' do opts = Http::Options.new(:headers => {:accept => "json"}) opts.headers.should eq(:accept => "json", "User-Agent" => user_agent) end it 'coerces :proxy correctly' do opts = Http::Options.new(:proxy => {:proxy_address => "127.0.0.1", :proxy_port => 8080}) opts.proxy.should eq(:proxy_address => "127.0.0.1", :proxy_port => 8080) end it 'coerces :form correctly' do opts = Http::Options.new(:form => {:foo => 42}) opts.form.should eq(:foo => 42) end it 'coerces :callbacks correctly' do before, after = Proc.new{|r| :before}, Proc.new{|r| :after} callbacks = {:request => [before], :response => [after]} opts = Http::Options.new(:callbacks => callbacks) opts.callbacks.should eq({ :request => [before], :response => [after] }) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
http-0.5.0.pre | spec/http/options/new_spec.rb |
http-0.4.0 | spec/http/options/new_spec.rb |