Sha256: 547715f71a43c54d834f4c5adedf1c40f69f839eea659f579eb131fac557cdd0

Contents?: true

Size: 1.71 KB

Versions: 1

Compression:

Stored size: 1.71 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::Transaction::Transporter.new
      tr.submit(basic_new_transaction, :banana)
    }.should raise_error
  end
  
  it "should not throw errors" do
    txn = basic_new_transaction

    lambda {
      tr = ::EWS::Transaction::Transporter.new
      tr.submit(txn, json)
    }.should_not raise_error(RuntimeError)
  end
  
  
end

describe "Transporter finding transactions" do
  
  before :each do
    txn = basic_new_transaction
    @tr = ::EWS::Transaction::Transporter.new
    r = @tr.submit(txn, :json)
    @transaction_tag = r.transaction_tag
  end
  
  it "should support all transport types" do
    [:json, :rest, :soap].each do |type|
      txn = basic_find_transaction(:transaction_tag => @transaction_tag)
      resp = @tr.submit(txn, type)

      resp.transaction_tag.should == @transaction_tag
      resp.cc_number == "4111111111111"
      resp.exact_resp_code.should == "00"
      resp.exact_message.should == "Transaction Normal"
      resp.bank_message.should == "APPROVED"
    end
  end
  
end

describe "Transporter creating and finding transactions" do
  
  it "should support all transport types" do
    [:json, :rest, :soap].each do |type|
      tr = ::EWS::Transaction::Transporter.new
      new_txn = tr.submit(basic_new_transaction, type)
      new_txn.transaction_tag.should_not be_nil

      found_txn = tr.submit(basic_find_transaction(:transaction_tag => new_txn.transaction_tag), :json)
      found_txn.should_not be_nil
      found_txn.transaction_tag.should == new_txn.transaction_tag
    end
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
exact4r-0.5.1 ./spec/transporter_spec.rb