Sha256: ce7dd0d2394ecb97a08dcf34edb5905787ca62c119d2b5b3e1666c91848e6b8f

Contents?: true

Size: 1.2 KB

Versions: 2

Compression:

Stored size: 1.2 KB

Contents

require File.dirname(__FILE__) + "/spec_helper"

describe "Transporter creating transactions" do
  
  it "should raise an exception when transport_type is not one of :json, :rest or :soap" do
    lambda {
      tr = ::EWS::Transporter.new(LOCATION)
      tr.submit(basic_new_transaction, :banana)
    }.should raise_error
  end
  
  it "should not throw errors" do
    txn = basic_new_transaction

    lambda {
      tr = ::EWS::Transporter.new(LOCATION)
      tr.submit(txn)
    }.should_not raise_error(RuntimeError)
  end
  
  it "should return a Response object on server failure" do
    req = basic_find_transaction
    req.transaction_tag = 9000  # non-existent txn
    
    tr = ::EWS::Transporter.new(LOCATION)
    resp = tr.submit(req, :json)
    
    resp.should_not be_nil
    resp.error_number.should == 404
    resp.error_description.should == "Not Found"
  end
  
  it "should throw an exception when parsing a response to sending nonsense SOAP" do
    req = basic_find_transaction

    EWS::Transaction::Mapping.stubs(:request_to_soap).returns("Complete and utter rubbish. It's not even XML!!")
    tr = ::EWS::Transporter.new(LOCATION)
    lambda {
      tr.submit(req, :soap)
    }.should raise_error
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
exact4r-0.7 ./spec/transporter_spec.rb
exact4r-0.8 ./spec/transporter_spec.rb