Sha256: 129413711bc01abf7e6949d493cefa93fefa68eebd00ab15bc9a9244d90fc867

Contents?: true

Size: 1.09 KB

Versions: 3

Compression:

Stored size: 1.09 KB

Contents

require File.dirname(__FILE__) + '/spec_helper.rb'

describe "Client" do
  
  it "should instantiate a client with a username and password" do
    c = PostalMethods::Client.new(PM_OPTS)
    c.class.should == PostalMethods::Client
  end
  
  it "should fail without a user/pass on instantiation" do
    lambda {PostalMethods::Client.new()}.should raise_error(PostalMethods::NoCredentialsException)
  end
  
  it "should create a driver client thru the factory" do
    c = PostalMethods::Client.new(PM_OPTS)
    c.prepare!
    c.rpc_driver.class.should == SOAP::RPC::Driver
  end
  
  it "should raise a connection error exception when the api is unreachable" do
    c = PostalMethods::Client.new(PM_OPTS)
    c.stubs(:api_uri).returns("http://invaliduri.tld/api_endpoint.wtf?")
    lambda {c.prepare!}.should raise_error(PostalMethods::NoConnectionError)
  end
    
  it "should be able to set a work mode" do
    c = PostalMethods::Client.new(PM_OPTS)
    c.work_mode.should == "Default"
    c.work_mode = "ProdUCTion"
    c.work_mode.should == "Production"
    c.work_mode.should be_a_kind_of(String)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
postalmethods-1.1.4 spec/postalmethods_spec.rb
postalmethods-1.1.3 spec/postalmethods_spec.rb
postalmethods-1.1.1 spec/postalmethods_spec.rb