Sha256: b416175a0a867a92f957ad74900f4a69c50868a07c56e3a1f5dfd584b7c8e8dd

Contents?: true

Size: 1.15 KB

Versions: 16

Compression:

Stored size: 1.15 KB

Contents

require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))

module Hoth
  describe Transport do

    it "should create a new transport by transport name for a given service" do
      service = mock("ServiceMock")
      Transport.should_receive(:new_transport_with_encoding).with(:transport_name, service)
      Transport.create(:transport_name, service)
    end

    it "should create a new transport instance with encoding from a transport name" do
      transport = Transport.new_transport_with_encoding :json_via_http, mock("ServiceMock")
      transport.should be_kind_of(Transport::Http)
      transport.encoder.should == Encoding::Json
    end

    it "should create a new transport instance with encoding from a transport alias" do
      transport = Transport.new_transport_with_encoding :http, mock("ServiceMock")
      transport.should be_kind_of(Transport::Http)
      transport.encoder.should == Encoding::Json
    end

    it "should raise an exception if transport name does not exist" do
      lambda { Transport.new_transport_with_encoding :not_existing_transport, mock("ServiceMock") }.should raise_error(TransportException)
    end

  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
hoth-0.4.2 spec/unit/transport_spec.rb
hoth-0.4.1 spec/unit/transport_spec.rb
hoth-0.4.0 spec/unit/transport_spec.rb
hoth-0.3.4 spec/unit/transport_spec.rb
hoth-0.3.3 spec/unit/transport_spec.rb
hoth-0.3.2.beta4 spec/unit/transport_spec.rb
hoth-0.3.2.beta3 spec/unit/transport_spec.rb
hoth-0.3.2.beta2 spec/unit/transport_spec.rb
hoth-0.3.2.beta1 spec/unit/transport_spec.rb
hoth-0.3.1 spec/unit/transport_spec.rb
sk-hoth-0.3.5 spec/unit/transport_spec.rb
sk-hoth-0.3.4 spec/unit/transport_spec.rb
sk-hoth-0.3.2 spec/unit/transport_spec.rb
sk-hoth-0.3.1 spec/unit/transport_spec.rb
sk-hoth-0.3.0 spec/unit/transport_spec.rb
hoth-0.3.0 spec/unit/transport_spec.rb