qbfc 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. data/.gitignore +11 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +85 -0
  4. data/Rakefile +84 -0
  5. data/VERSION +1 -0
  6. data/lib/qbfc.rb +41 -0
  7. data/lib/qbfc/base.rb +82 -0
  8. data/lib/qbfc/element.rb +243 -0
  9. data/lib/qbfc/entities/generated.rb +8 -0
  10. data/lib/qbfc/entity.rb +11 -0
  11. data/lib/qbfc/info.rb +42 -0
  12. data/lib/qbfc/infos/generated.rb +9 -0
  13. data/lib/qbfc/item.rb +29 -0
  14. data/lib/qbfc/items/generated.rb +11 -0
  15. data/lib/qbfc/list.rb +84 -0
  16. data/lib/qbfc/lists/account.rb +24 -0
  17. data/lib/qbfc/lists/generated.rb +15 -0
  18. data/lib/qbfc/lists/qb_class.rb +25 -0
  19. data/lib/qbfc/modifiable.rb +31 -0
  20. data/lib/qbfc/ole_wrapper.rb +201 -0
  21. data/lib/qbfc/qb_collection.rb +26 -0
  22. data/lib/qbfc/qb_types.rb +18 -0
  23. data/lib/qbfc/qbfc_const.rb +14 -0
  24. data/lib/qbfc/report.rb +95 -0
  25. data/lib/qbfc/reports/aging.rb +13 -0
  26. data/lib/qbfc/reports/budget_summary.rb +13 -0
  27. data/lib/qbfc/reports/custom_detail.rb +9 -0
  28. data/lib/qbfc/reports/custom_summary.rb +9 -0
  29. data/lib/qbfc/reports/general_detail.rb +44 -0
  30. data/lib/qbfc/reports/general_summary.rb +33 -0
  31. data/lib/qbfc/reports/job.rb +14 -0
  32. data/lib/qbfc/reports/payroll_detail.rb +13 -0
  33. data/lib/qbfc/reports/payroll_summary.rb +13 -0
  34. data/lib/qbfc/reports/rows.rb +51 -0
  35. data/lib/qbfc/reports/time.rb +12 -0
  36. data/lib/qbfc/request.rb +295 -0
  37. data/lib/qbfc/session.rb +147 -0
  38. data/lib/qbfc/terms.rb +10 -0
  39. data/lib/qbfc/terms/generated.rb +10 -0
  40. data/lib/qbfc/transaction.rb +110 -0
  41. data/lib/qbfc/transactions/generated.rb +25 -0
  42. data/lib/qbfc/voidable.rb +11 -0
  43. data/qbfc.gemspec +166 -0
  44. data/spec/fixtures/test.lgb +0 -0
  45. data/spec/fixtures/test.qbw +0 -0
  46. data/spec/fixtures/test.qbw.TLG +0 -0
  47. data/spec/integration/add_spec.rb +31 -0
  48. data/spec/integration/base_spec.rb +18 -0
  49. data/spec/integration/belongs_to_spec.rb +64 -0
  50. data/spec/integration/company_spec.rb +30 -0
  51. data/spec/integration/conditions_spec.rb +59 -0
  52. data/spec/integration/customer_spec.rb +46 -0
  53. data/spec/integration/element_finders_spec.rb +20 -0
  54. data/spec/integration/quick_test.rb +31 -0
  55. data/spec/integration/request_options_spec.rb +68 -0
  56. data/spec/rcov.opts +1 -0
  57. data/spec/spec.opts +6 -0
  58. data/spec/spec_helper.rb +62 -0
  59. data/spec/unit/base_spec.rb +138 -0
  60. data/spec/unit/element_finder_spec.rb +185 -0
  61. data/spec/unit/element_spec.rb +108 -0
  62. data/spec/unit/entities/generated_spec.rb +18 -0
  63. data/spec/unit/entity_spec.rb +18 -0
  64. data/spec/unit/info/generated_spec.rb +12 -0
  65. data/spec/unit/info_spec.rb +48 -0
  66. data/spec/unit/item_spec.rb +33 -0
  67. data/spec/unit/items/generated_spec.rb +16 -0
  68. data/spec/unit/list_finders_spec.rb +129 -0
  69. data/spec/unit/list_spec.rb +86 -0
  70. data/spec/unit/lists/account_spec.rb +20 -0
  71. data/spec/unit/lists/generated_spec.rb +15 -0
  72. data/spec/unit/lists/qb_class_spec.rb +9 -0
  73. data/spec/unit/modifiable_spec.rb +84 -0
  74. data/spec/unit/ole_wrapper_spec.rb +337 -0
  75. data/spec/unit/qb_collection_spec.rb +13 -0
  76. data/spec/unit/qbfc_const_spec.rb +10 -0
  77. data/spec/unit/qbfc_spec.rb +10 -0
  78. data/spec/unit/report_spec.rb +12 -0
  79. data/spec/unit/request_query_survey.txt +48 -0
  80. data/spec/unit/request_spec.rb +486 -0
  81. data/spec/unit/session_spec.rb +144 -0
  82. data/spec/unit/terms/generated_spec.rb +14 -0
  83. data/spec/unit/terms_spec.rb +18 -0
  84. data/spec/unit/transaction_finders_spec.rb +125 -0
  85. data/spec/unit/transaction_spec.rb +94 -0
  86. data/spec/unit/transactions/generated_spec.rb +20 -0
  87. data/spec/unit/voidable_spec.rb +32 -0
  88. data/tasks/qbfc_tasks.rake +4 -0
  89. metadata +182 -0
@@ -0,0 +1,144 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe QBFC::Session do
4
+
5
+ before(:each) do
6
+ @ole_object = mock("WIN32OLE")
7
+ @ole_object.stub!(:OpenConnection2)
8
+ @ole_object.stub!(:BeginSession)
9
+ WIN32OLE.stub!(:new).and_return(@ole_object)
10
+
11
+ @ole_wrapper = mock(QBFC::OLEWrapper)
12
+ QBFC::OLEWrapper.stub!(:new).and_return(@ole_wrapper)
13
+
14
+ @qb_sess = QBFC::Session.new()
15
+ end
16
+
17
+ it "should create an QBFC WIN32OLE object" do
18
+ WIN32OLE.should_receive(:new).with("QBFC6.QBSessionManager").and_return(@ole_object)
19
+ QBFC::Session.new()
20
+ end
21
+
22
+ it "should wrap WIN32OLE object" do
23
+ QBFC::OLEWrapper.should_receive(:new).with(@ole_object)
24
+ QBFC::Session.new()
25
+ end
26
+
27
+ it "should open connection to Quickbooks and establish a session" do
28
+ @ole_object.should_receive(:OpenConnection2)
29
+ QBFC::Session.new()
30
+ end
31
+
32
+ it "should begin a session with Quickbooks" do
33
+ @ole_object.should_receive(:BeginSession)
34
+ QBFC::Session.new()
35
+ end
36
+
37
+ it "should raise an error if session can't be established" do
38
+ @ole_object.should_receive(:BeginSession).and_raise(WIN32OLERuntimeError)
39
+ @ole_object.should_receive(:CloseConnection)
40
+ lambda { QBFC::Session.new }.should raise_error(QBFC::QuickbooksClosedError)
41
+ end
42
+
43
+ it "should accept an app_name option" do
44
+ @ole_object.should_receive(:OpenConnection2).with('', 'Test Application', 1)
45
+ QBFC::Session.new(:app_name => 'Test Application')
46
+ end
47
+
48
+ it "should accept an app_id option" do
49
+ @ole_object.should_receive(:OpenConnection2).with('ID', 'Test Application', 1)
50
+ QBFC::Session.new(:app_name => 'Test Application', :app_id => 'ID')
51
+ end
52
+
53
+ it "should accept a conn_type option" do
54
+ @ole_object.should_receive(:OpenConnection2).with('', 'Test Application', 0)
55
+ QBFC::Session.new(:app_name => 'Test Application', :conn_type => QBFC_CONST::CtUnknown)
56
+ end
57
+
58
+ it "should accept an open mode constant" do
59
+ @ole_object.should_receive(:BeginSession).with('', 0)
60
+ QBFC::Session.new(:open_mode => QBFC_CONST::OmSingleUser )
61
+
62
+ @ole_object.should_receive(:BeginSession).with('', 1)
63
+ QBFC::Session.new(:open_mode => QBFC_CONST::OmMultiUser)
64
+
65
+ @ole_object.should_receive(:BeginSession).with('', 2)
66
+ QBFC::Session.new(:open_mode => QBFC_CONST::OmDontCare)
67
+ end
68
+
69
+ it "should accept a filename option" do
70
+ @ole_object.should_receive(:BeginSession).with('TestCompany.qbw', 2)
71
+ QBFC::Session.new(:filename => 'TestCompany.qbw')
72
+ end
73
+
74
+ it "should close session and connection on close" do
75
+ @ole_wrapper.should_receive(:EndSession)
76
+ @ole_wrapper.should_receive(:CloseConnection)
77
+ @qb_sess.close()
78
+ end
79
+
80
+ describe "::open" do
81
+
82
+ before(:each) do
83
+ @ole_wrapper.stub!(:EndSession)
84
+ @ole_wrapper.stub!(:CloseConnection)
85
+ end
86
+
87
+ it "should accept a block" do
88
+ QBFC::Session.open do |qb|
89
+ qb.should be_kind_of(QBFC::Session)
90
+ end
91
+ end
92
+
93
+ it "should return session if called without a block" do
94
+ QBFC::Session.open.should be_kind_of(QBFC::Session)
95
+ end
96
+ end
97
+
98
+ it "should create an instance of QBFC::Base descendant from a singular method with params" do
99
+ @base = mock(QBFC::Base)
100
+ QBFC::Customer.should_receive(:find_by_unique_id).with(@qb_sess, '1234-5678').and_return(@base)
101
+ @qb_sess.customer('1234-5678').should == @base
102
+
103
+ QBFC::Vendor.should_receive(:find_by_unique_id).with(@qb_sess, '1234-5678').and_return(@base)
104
+ @qb_sess.vendor('1234-5678').should == @base
105
+ end
106
+
107
+ it "should create an instance of QBFC::Base descendant from a singular method" do
108
+ @base = mock(QBFC::Base)
109
+ QBFC::Customer.should_receive(:find).with(@qb_sess, :first).and_return(@base)
110
+ @qb_sess.customer.should == @base
111
+ end
112
+
113
+ it "should create an instance of QBFC::QBCollection a plural method" do
114
+ @collection = mock(QBFC::QBCollection)
115
+ QBFC::QBCollection.should_receive(:new).with(@qb_sess, :Customer).and_return(@collection)
116
+ @qb_sess.customers.should == @collection
117
+
118
+ QBFC::QBCollection.should_receive(:new).with(@qb_sess, :Vendor).and_return(@collection)
119
+ @qb_sess.vendors.should == @collection
120
+ end
121
+
122
+ it "should create QBFC::QBCollection QBFC::QBClass from #classes" do
123
+ @collection = mock(QBFC::QBCollection)
124
+ QBFC::QBCollection.should_receive(:new).with(@qb_sess, :QBClass).and_return(@collection)
125
+ @qb_sess.classes.should == @collection
126
+ end
127
+
128
+ it "should create QBFC::QBCollection for QBFC::Terms from #terms" do
129
+ @collection = mock(QBFC::QBCollection)
130
+ QBFC::QBCollection.should_receive(:new).with(@qb_sess, :Terms).and_return(@collection)
131
+ @qb_sess.terms.should == @collection
132
+ end
133
+
134
+ it "should let OLEWrapper handle other unknown methods" do
135
+ @ole_wrapper.should_receive(:qbfc_method_missing).with(@qb_sess, :FullName).and_return(true)
136
+ @qb_sess.FullName
137
+
138
+ @ole_wrapper.should_receive(:qbfc_method_missing).with(@qb_sess, :full_name).and_return(true)
139
+ @qb_sess.full_name
140
+
141
+ @ole_wrapper.should_receive(:qbfc_method_missing).with(@qb_sess, :full_name=, 'Full Name').and_return(true)
142
+ @qb_sess.full_name = 'Full Name'
143
+ end
144
+ end
@@ -0,0 +1,14 @@
1
+ require 'spec_helper'
2
+
3
+ describe "QBFC::Terms generated.rb" do
4
+
5
+ it "should generate classes" do
6
+ QBFC::DateDrivenTerms.superclass.should be(QBFC::Terms)
7
+ QBFC::StandardTerms.superclass.should be(QBFC::Terms)
8
+ end
9
+
10
+ it "should not include Modifiable in any classes" do
11
+ QBFC::DateDrivenTerms.included_modules.should_not include(QBFC::Modifiable)
12
+ QBFC::StandardTerms.included_modules.should_not include(QBFC::Modifiable)
13
+ end
14
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe QBFC::Terms do
4
+
5
+ before(:each) do
6
+ @sess = mock(QBFC::Session)
7
+ @ole_wrapper = mock(QBFC::OLEWrapper)
8
+ end
9
+
10
+ it "is a base class" do
11
+ QBFC::Terms.is_base_class?.should be_true
12
+ end
13
+
14
+ describe ".find" do
15
+ it "should return subclass objects"
16
+ end
17
+
18
+ end
@@ -0,0 +1,125 @@
1
+ require 'spec_helper'
2
+
3
+ module QBFC::Test
4
+ class TxnFind < QBFC::Transaction
5
+ def self.qb_name
6
+ "Check"
7
+ end
8
+ end
9
+ end
10
+
11
+ describe QBFC::Transaction do
12
+
13
+ before(:each) do
14
+ @sess = mock(QBFC::Session)
15
+ @ole_wrapper = mock(QBFC::OLEWrapper)
16
+ @txn = QBFC::Test::Txn.new(@sess, @ole_wrapper)
17
+
18
+ # Request related mocks
19
+ @request = mock("QBFC::Request")
20
+ @request.stub!(:dup).and_return(@request)
21
+ @txn_query = mock("QBFC::OLEWrapper#txn_query")
22
+ @response = mock("QBFC::Request#response")
23
+
24
+ # Filter mock
25
+ @filter = mock("QBFC::OLEWrapper#Filter")
26
+ @request.stub!(:filter).and_return(@filter)
27
+ @request.stub!(:add_limit)
28
+ @request.stub!(:filter_available?).and_return(true)
29
+ @request.stub!(:apply_options)
30
+ end
31
+
32
+ def setup_request
33
+ QBFC::Request.should_receive(:new).with(@sess, 'CheckQuery').and_return(@request)
34
+ @request.should_receive(:kind_of?).with(QBFC::Request).and_return(true)
35
+ @request.stub!(:response).and_return(@response)
36
+ @response.stub!(:GetAt).with(0).and_return(@ole_wrapper)
37
+ @response.stub!(:ole_methods).and_return(["GetAt"])
38
+ end
39
+
40
+ describe ".find_by_ref" do
41
+ before(:each) do
42
+ @ref_list = mock("QBFC::OLEWrapper#ref_list")
43
+ end
44
+
45
+ def setup_request
46
+ super
47
+ @request.should_receive(:query).and_return(@txn_query)
48
+ @txn_query.should_receive(:RefNumberList).and_return(@ref_list)
49
+ @ref_list.should_receive(:Add).with("12345")
50
+ end
51
+
52
+ it "should set up Request, specifying RefNumberList" do
53
+ setup_request
54
+ QBFC::Test::TxnFind.find_by_ref(@sess, "12345")
55
+ end
56
+
57
+ it "should return a Transaction object" do
58
+ setup_request
59
+ list = QBFC::Test::TxnFind.find_by_ref(@sess, "12345")
60
+ list.should be_kind_of(QBFC::Test::TxnFind)
61
+ end
62
+
63
+ it "should return nil if none found" do
64
+ setup_request
65
+ @request.should_receive(:response).and_return(nil)
66
+ QBFC::Test::TxnFind.find_by_ref(@sess, "12345").should be_nil
67
+ end
68
+ end
69
+
70
+ describe ".find_by_id" do
71
+ before(:each) do
72
+ @txn_id_list = mock("QBFC::OLEWrapper#txn_id_list")
73
+ end
74
+
75
+ def setup_request
76
+ super
77
+ @request.should_receive(:query).and_return(@txn_query)
78
+ @txn_query.should_receive(:TxnIDList).and_return(@txn_id_list)
79
+ @txn_id_list.should_receive(:Add).with("123-456")
80
+ end
81
+
82
+ it "should set up Request, specifying TxnIDTxn" do
83
+ setup_request
84
+ QBFC::Test::TxnFind.find_by_id(@sess, "123-456")
85
+ end
86
+
87
+ it "should return a Transaction object" do
88
+ setup_request
89
+ list = QBFC::Test::TxnFind.find_by_id(@sess, "123-456")
90
+ list.should be_kind_of(QBFC::Test::TxnFind)
91
+ end
92
+
93
+ it "should return nil if none found" do
94
+ setup_request
95
+ @request.should_receive(:response).and_return(nil)
96
+ QBFC::Test::TxnFind.find_by_id(@sess, "123-456").should be_nil
97
+ end
98
+ end
99
+
100
+ describe ".find_by_name_or_id" do
101
+ it "should try to find_by_id" do
102
+ QBFC::Test::TxnFind.should_receive(:find_by_id).with(@sess, "123-456").and_return("Txn By ID")
103
+ QBFC::Test::TxnFind.find_by_ref_or_id(@sess, "123-456").should == "Txn By ID"
104
+ end
105
+
106
+ it "should try to find_by_ref if id fails" do
107
+ QBFC::Test::TxnFind.should_receive(:find_by_id).with(@sess, "123-456").and_return(nil)
108
+ QBFC::Test::TxnFind.should_receive(:find_by_ref).with(@sess, "123-456").and_return("Txn By Ref")
109
+ QBFC::Test::TxnFind.find_by_ref_or_id(@sess, "123-456").should == "Txn By Ref"
110
+ end
111
+
112
+ it "should return nil if both ref and id return nil" do
113
+ QBFC::Test::TxnFind.should_receive(:find_by_id).with(@sess, "123-456").and_return(nil)
114
+ QBFC::Test::TxnFind.should_receive(:find_by_ref).with(@sess, "123-456").and_return(nil)
115
+ QBFC::Test::TxnFind.find_by_ref_or_id(@sess, "123-456").should be_nil
116
+ end
117
+
118
+ it "should be aliased as .find_by_unique_id" do
119
+ QBFC::Test::TxnFind.should_receive(:find_by_id).with(@sess, "123-456").and_return(nil)
120
+ QBFC::Test::TxnFind.should_receive(:find_by_ref).with(@sess, "123-456").and_return(nil)
121
+ QBFC::Test::TxnFind.find_by_unique_id(@sess, "123-456").should be_nil
122
+ end
123
+ end
124
+
125
+ end
@@ -0,0 +1,94 @@
1
+ require 'spec_helper'
2
+
3
+ module QBFC::Test
4
+ class Txn < QBFC::Transaction
5
+ def qb_name
6
+ "Check"
7
+ end
8
+ end
9
+ end
10
+
11
+ describe QBFC::Transaction do
12
+
13
+ before(:each) do
14
+ @sess = mock(QBFC::Session)
15
+ @ole_wrapper = mock(QBFC::OLEWrapper)
16
+ @txn = QBFC::Test::Txn.new(@sess, @ole_wrapper)
17
+ end
18
+
19
+ describe "::ID_NAME" do
20
+ it "should be 'TxnID'" do
21
+ QBFC::Test::Txn::ID_NAME.should == "TxnID"
22
+ end
23
+ end
24
+
25
+ describe "#id" do
26
+ it "is an alias of txn_id" do
27
+ @ole_wrapper.should_receive(:txn_id).and_return('T123')
28
+ @txn.id.should == 'T123'
29
+ end
30
+ end
31
+
32
+ describe "#delete" do
33
+ it "should setup a TxnDelRq with Txn Type and ID" do
34
+ @del_rq = mock(QBFC::Request)
35
+ @ole_wrapper.should_receive(:txn_id).and_return('123-456')
36
+ QBFC::Request.should_receive(:new).with(@sess, "TxnDel").and_return(@del_rq)
37
+ @del_rq.should_receive(:txn_del_type=).with(QBFC_CONST::TdtCheck)
38
+ @del_rq.should_receive(:txn_id=).with('123-456')
39
+ @del_rq.should_receive(:submit)
40
+ @txn.delete.should be_true
41
+ end
42
+ end
43
+
44
+ describe "#display" do
45
+ before(:each) do
46
+ @display_rq = mock(QBFC::Request)
47
+ end
48
+
49
+ it "should call TxnDisplayAdd for new records" do
50
+ QBFC::Request.should_receive(:new).with(@sess, "TxnDisplayAdd").and_return(@display_rq)
51
+ @display_rq.should_receive(:txn_display_add_type=).with(QBFC_CONST::TdatCheck)
52
+ @display_rq.should_receive(:submit)
53
+ @txn.instance_variable_set(:@new_record, true)
54
+ @txn.display
55
+ end
56
+
57
+ it "should call TxnDisplayMod for existing records" do
58
+ @ole_wrapper.should_receive(:txn_id).and_return('123-456')
59
+
60
+ QBFC::Request.should_receive(:new).with(@sess, "TxnDisplayMod").and_return(@display_rq)
61
+ @display_rq.should_receive(:txn_display_mod_type=).with(QBFC_CONST::TdmtCheck)
62
+ @display_rq.should_receive(:txn_id=).with('123-456')
63
+ @display_rq.should_receive(:submit)
64
+ @txn.display
65
+ end
66
+ end
67
+
68
+ describe "#cleared_status=" do
69
+ before(:each) do
70
+ @ole_wrapper.should_receive(:txn_id).and_return('123-456')
71
+
72
+ @cs_rq = mock(QBFC::Request)
73
+ QBFC::Request.should_receive(:new).with(@sess, "ClearedStatusMod").and_return(@cs_rq)
74
+ @cs_rq.should_receive(:txn_id=).with('123-456')
75
+ @cs_rq.should_receive(:submit)
76
+ end
77
+
78
+ it "should submit a ClearedStatusModRq" do
79
+ @cs_rq.should_receive(:cleared_status=).with(QBFC_CONST::CsCleared)
80
+ @txn.cleared_status = QBFC_CONST::CsCleared
81
+ end
82
+
83
+ it "should accept true for CsCleared" do
84
+ @cs_rq.should_receive(:cleared_status=).with(QBFC_CONST::CsCleared)
85
+ @txn.cleared_status = true
86
+ end
87
+
88
+ it "should accept false for CsNotCleared" do
89
+ @cs_rq.should_receive(:cleared_status=).with(QBFC_CONST::CsNotCleared)
90
+ @txn.cleared_status = false
91
+ end
92
+
93
+ end
94
+ end
@@ -0,0 +1,20 @@
1
+ require 'spec_helper'
2
+
3
+ describe "QBFC::Transactions generated.rb" do
4
+
5
+ it "should generate classes" do
6
+ QBFC::Check.superclass.should be(QBFC::Transaction)
7
+ QBFC::Bill.superclass.should be(QBFC::Transaction)
8
+ QBFC::CreditMemo.superclass.should be(QBFC::Transaction)
9
+ end
10
+
11
+ it "should include Voidable in voidable classes" do
12
+ QBFC::Check.included_modules.should include(QBFC::Voidable)
13
+ QBFC::Estimate.included_modules.should_not include(QBFC::Voidable)
14
+ end
15
+
16
+ it "should include Modifiable in modifiable classes" do
17
+ QBFC::Check.included_modules.should include(QBFC::Modifiable)
18
+ QBFC::Deposit.included_modules.should_not include(QBFC::Modifiable)
19
+ end
20
+ end
@@ -0,0 +1,32 @@
1
+ require 'spec_helper'
2
+
3
+ module QBFC::Test
4
+ class TxnVoid < QBFC::Transaction
5
+ include QBFC::Voidable
6
+
7
+ def qb_name
8
+ "Check"
9
+ end
10
+ end
11
+ end
12
+
13
+ describe QBFC::Voidable do
14
+
15
+ before(:each) do
16
+ @sess = mock(QBFC::Session)
17
+ @ole_wrapper = mock(QBFC::OLEWrapper)
18
+ @txn = QBFC::Test::TxnVoid.new(@sess, @ole_wrapper)
19
+ end
20
+
21
+ describe "#void" do
22
+ it "should call a TxnVoidRq with Txn Type and ID" do
23
+ @void_rq = mock(QBFC::Request)
24
+ @ole_wrapper.should_receive(:txn_id).and_return('{123-456}')
25
+ QBFC::Request.should_receive(:new).with(@sess, "TxnVoid").and_return(@void_rq)
26
+ @void_rq.should_receive(:txn_void_type=).with(QBFC_CONST::const_get("TvtCheck"))
27
+ @void_rq.should_receive(:txn_id=).with("{123-456}")
28
+ @void_rq.should_receive(:submit)
29
+ @txn.void.should be_true
30
+ end
31
+ end
32
+ end