Sha256: 63aa6a260de89ee82972f9915797730907327732760d6d2496890fe2e1d8aaea

Contents?: true

Size: 874 Bytes

Versions: 2

Compression:

Stored size: 874 Bytes

Contents

require 'spec_helper'

module QBFC::Test
  class TxnVoid < QBFC::Transaction
    include QBFC::Voidable
    
    def qb_name
      "Check"
    end
  end
end

describe QBFC::Voidable do

  before(:each) do 
    @sess = mock(QBFC::Session)
    @ole_wrapper = mock(QBFC::OLEWrapper)
    @txn = QBFC::Test::TxnVoid.new(@sess, @ole_wrapper)
  end

  describe "#void" do
    it "should call a TxnVoidRq with Txn Type and ID" do
      @void_rq = mock(QBFC::Request)
      @ole_wrapper.should_receive(:txn_id).and_return('{123-456}')
      QBFC::Request.should_receive(:new).with(@sess, "TxnVoid").and_return(@void_rq)
      @void_rq.should_receive(:txn_void_type=).with(QBFC_CONST::const_get("TvtCheck"))
      @void_rq.should_receive(:txn_id=).with("{123-456}")
      @void_rq.should_receive(:submit)
      @txn.void.should be_true
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
jm81-qbfc-0.3.0 spec/unit/voidable_spec.rb
qbfc-0.3.0 spec/unit/voidable_spec.rb