Sha256: 93eeee0b7df4c877f437ea9c851aedd926611d23eb58bce41753bf516cc02be8

Contents?: true

Size: 1.24 KB

Versions: 2

Compression:

Stored size: 1.24 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 correctly decode error when 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)
    r = tr.submit(req, :soap)
    r.error_number.should == 401
    r.error_description.should == "Malformed XML Request."
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
exact4r-0.9.1 ./spec/transporter_spec.rb
exact4r-0.9 ./spec/transporter_spec.rb