Sha256: 5e6a450a6c511fc5381bc6579b4b58a316db37989eb9efb7cdea8f51b48e38e9
Contents?: true
Size: 1.19 KB
Versions: 8
Compression:
Stored size: 1.19 KB
Contents
require "spec_helper" require "httpi/adapter" describe HTTPI::Adapter do let(:adapter) { HTTPI::Adapter } describe ".use" do it "should default to HTTPClient" do adapter.use.should == :httpclient end it "should accept an adapter to use" do adapter.use = :curb adapter.use.should == :curb # reset to default adapter.use = HTTPI::Adapter::DEFAULT end it "should raise an ArgumentError in case of an invalid adapter" do lambda { adapter.use = :unknown }.should raise_error(ArgumentError) end end describe ".adapters" do it "should return a memoized Hash of adapters" do adapter.adapters.should have(3).items adapter.adapters.should include( :httpclient => HTTPI::Adapter::HTTPClient, :curb => HTTPI::Adapter::Curb, :net_http => HTTPI::Adapter::NetHTTP ) end end describe ".find" do it "should return the adapter for a given Symbol" do adapter.find(:httpclient).should == HTTPI::Adapter::HTTPClient end it "should raise an ArgumentError in case of an invalid adapter" do lambda { adapter.find :unknown }.should raise_error(ArgumentError) end end end
Version data entries
8 entries across 8 versions & 1 rubygems