qbwc 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/ci.yml +66 -0
  3. data/.gitignore +3 -1
  4. data/Appraisals +36 -0
  5. data/CHANGELOG.md +27 -0
  6. data/Gemfile +1 -1
  7. data/Gemfile.lock +276 -0
  8. data/README.md +4 -6
  9. data/Rakefile +2 -0
  10. data/gemfiles/.bundle/config +2 -0
  11. data/gemfiles/rails_5.1.gemfile +9 -0
  12. data/gemfiles/rails_5.1.gemfile.lock +217 -0
  13. data/gemfiles/rails_5.2.gemfile +9 -0
  14. data/gemfiles/rails_5.2.gemfile.lock +225 -0
  15. data/gemfiles/rails_6.0.gemfile +9 -0
  16. data/gemfiles/rails_6.0.gemfile.lock +241 -0
  17. data/gemfiles/rails_6.1.gemfile +9 -0
  18. data/gemfiles/rails_6.1.gemfile.lock +244 -0
  19. data/gemfiles/rails_7.0.gemfile +9 -0
  20. data/gemfiles/rails_7.0.gemfile.lock +243 -0
  21. data/gemfiles/rails_7.1.gemfile +8 -0
  22. data/gemfiles/rails_7.1.gemfile.lock +292 -0
  23. data/lib/generators/qbwc/install/templates/db/migrate/change_request_index.rb +1 -1
  24. data/lib/generators/qbwc/install/templates/db/migrate/create_qbwc_jobs.rb +1 -1
  25. data/lib/generators/qbwc/install/templates/db/migrate/create_qbwc_sessions.rb +2 -2
  26. data/lib/generators/qbwc/install/templates/db/migrate/index_qbwc_jobs.rb +1 -1
  27. data/lib/generators/qbwc/install/templates/db/migrate/session_pending_jobs_text.rb +1 -1
  28. data/lib/qbwc/active_record/job.rb +10 -3
  29. data/lib/qbwc/controller.rb +7 -7
  30. data/lib/qbwc/job.rb +1 -1
  31. data/lib/qbwc/session.rb +3 -2
  32. data/lib/qbwc/version.rb +1 -1
  33. data/qbwc.gemspec +9 -6
  34. data/test/qbwc/controllers/controller_test.rb +15 -9
  35. data/test/qbwc/integration/job_management_test.rb +2 -2
  36. data/test/qbwc/integration/request_generation_test.rb +12 -12
  37. data/test/qbwc/integration/response_test.rb +2 -0
  38. data/test/qbwc/integration/routes_test.rb +6 -6
  39. data/test/qbwc/integration/savon_client_test.rb +48 -0
  40. data/test/qbwc/integration/session_test.rb +1 -5
  41. data/test/test_helper.rb +63 -6
  42. metadata +61 -28
  43. data/.travis.yml +0 -8
  44. data/Guardfile +0 -46
  45. data/test/wash_out_helper.rb +0 -76
@@ -0,0 +1,292 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ qbwc (1.1.0)
5
+ actionpack (>= 5.0.1)
6
+ qbxml (>= 0.3.0)
7
+ wash_out (>= 0.12.0)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ actioncable (7.1.5.1)
13
+ actionpack (= 7.1.5.1)
14
+ activesupport (= 7.1.5.1)
15
+ nio4r (~> 2.0)
16
+ websocket-driver (>= 0.6.1)
17
+ zeitwerk (~> 2.6)
18
+ actionmailbox (7.1.5.1)
19
+ actionpack (= 7.1.5.1)
20
+ activejob (= 7.1.5.1)
21
+ activerecord (= 7.1.5.1)
22
+ activestorage (= 7.1.5.1)
23
+ activesupport (= 7.1.5.1)
24
+ mail (>= 2.7.1)
25
+ net-imap
26
+ net-pop
27
+ net-smtp
28
+ actionmailer (7.1.5.1)
29
+ actionpack (= 7.1.5.1)
30
+ actionview (= 7.1.5.1)
31
+ activejob (= 7.1.5.1)
32
+ activesupport (= 7.1.5.1)
33
+ mail (~> 2.5, >= 2.5.4)
34
+ net-imap
35
+ net-pop
36
+ net-smtp
37
+ rails-dom-testing (~> 2.2)
38
+ actionpack (7.1.5.1)
39
+ actionview (= 7.1.5.1)
40
+ activesupport (= 7.1.5.1)
41
+ nokogiri (>= 1.8.5)
42
+ racc
43
+ rack (>= 2.2.4)
44
+ rack-session (>= 1.0.1)
45
+ rack-test (>= 0.6.3)
46
+ rails-dom-testing (~> 2.2)
47
+ rails-html-sanitizer (~> 1.6)
48
+ actiontext (7.1.5.1)
49
+ actionpack (= 7.1.5.1)
50
+ activerecord (= 7.1.5.1)
51
+ activestorage (= 7.1.5.1)
52
+ activesupport (= 7.1.5.1)
53
+ globalid (>= 0.6.0)
54
+ nokogiri (>= 1.8.5)
55
+ actionview (7.1.5.1)
56
+ activesupport (= 7.1.5.1)
57
+ builder (~> 3.1)
58
+ erubi (~> 1.11)
59
+ rails-dom-testing (~> 2.2)
60
+ rails-html-sanitizer (~> 1.6)
61
+ activejob (7.1.5.1)
62
+ activesupport (= 7.1.5.1)
63
+ globalid (>= 0.3.6)
64
+ activemodel (7.1.5.1)
65
+ activesupport (= 7.1.5.1)
66
+ activerecord (7.1.5.1)
67
+ activemodel (= 7.1.5.1)
68
+ activesupport (= 7.1.5.1)
69
+ timeout (>= 0.4.0)
70
+ activestorage (7.1.5.1)
71
+ actionpack (= 7.1.5.1)
72
+ activejob (= 7.1.5.1)
73
+ activerecord (= 7.1.5.1)
74
+ activesupport (= 7.1.5.1)
75
+ marcel (~> 1.0)
76
+ activesupport (7.1.5.1)
77
+ base64
78
+ benchmark (>= 0.3)
79
+ bigdecimal
80
+ concurrent-ruby (~> 1.0, >= 1.0.2)
81
+ connection_pool (>= 2.2.5)
82
+ drb
83
+ i18n (>= 1.6, < 2)
84
+ logger (>= 1.4.2)
85
+ minitest (>= 5.1)
86
+ mutex_m
87
+ securerandom (>= 0.3)
88
+ tzinfo (~> 2.0)
89
+ addressable (2.8.7)
90
+ public_suffix (>= 2.0.2, < 7.0)
91
+ akami (1.3.3)
92
+ base64
93
+ gyoku (>= 0.4.0)
94
+ nokogiri
95
+ appraisal (2.5.0)
96
+ bundler
97
+ rake
98
+ thor (>= 0.14.0)
99
+ base64 (0.2.0)
100
+ benchmark (0.4.0)
101
+ bigdecimal (3.1.9)
102
+ builder (3.3.0)
103
+ byebug (11.1.3)
104
+ concurrent-ruby (1.3.5)
105
+ connection_pool (2.5.0)
106
+ crack (1.0.0)
107
+ bigdecimal
108
+ rexml
109
+ crass (1.0.6)
110
+ date (3.4.1)
111
+ diff-lcs (1.6.0)
112
+ drb (2.2.1)
113
+ erubi (1.13.1)
114
+ faraday (2.12.2)
115
+ faraday-net_http (>= 2.0, < 3.5)
116
+ json
117
+ logger
118
+ faraday-net_http (3.4.0)
119
+ net-http (>= 0.5.0)
120
+ globalid (1.2.1)
121
+ activesupport (>= 6.1)
122
+ gyoku (1.4.0)
123
+ builder (>= 2.1.2)
124
+ rexml (~> 3.0)
125
+ hashdiff (1.1.2)
126
+ httpi (4.0.4)
127
+ base64
128
+ mutex_m
129
+ nkf
130
+ rack (>= 2.0, < 4)
131
+ i18n (1.14.7)
132
+ concurrent-ruby (~> 1.0)
133
+ io-console (0.8.0)
134
+ irb (1.15.1)
135
+ pp (>= 0.6.0)
136
+ rdoc (>= 4.0.0)
137
+ reline (>= 0.4.2)
138
+ json (2.10.2)
139
+ logger (1.6.6)
140
+ loofah (2.24.0)
141
+ crass (~> 1.0.2)
142
+ nokogiri (>= 1.12.0)
143
+ mail (2.8.1)
144
+ mini_mime (>= 0.1.1)
145
+ net-imap
146
+ net-pop
147
+ net-smtp
148
+ marcel (1.0.4)
149
+ mini_mime (1.1.5)
150
+ mini_portile2 (2.8.8)
151
+ minitest (5.25.5)
152
+ mutex_m (0.3.0)
153
+ net-http (0.6.0)
154
+ uri
155
+ net-imap (0.4.19)
156
+ date
157
+ net-protocol
158
+ net-pop (0.1.2)
159
+ net-protocol
160
+ net-protocol (0.2.2)
161
+ timeout
162
+ net-smtp (0.5.1)
163
+ net-protocol
164
+ nio4r (2.7.4)
165
+ nkf (0.2.0)
166
+ nokogiri (1.17.2-x86_64-linux)
167
+ racc (~> 1.4)
168
+ nori (2.7.1)
169
+ bigdecimal
170
+ pp (0.6.2)
171
+ prettyprint
172
+ prettyprint (0.2.0)
173
+ psych (5.2.3)
174
+ date
175
+ stringio
176
+ public_suffix (6.0.1)
177
+ qbxml (0.5.0)
178
+ activesupport (>= 5.0.0)
179
+ builder (~> 3.0)
180
+ nokogiri (~> 1.5)
181
+ racc (1.8.1)
182
+ rack (3.1.12)
183
+ rack-session (2.1.0)
184
+ base64 (>= 0.1.0)
185
+ rack (>= 3.0.0)
186
+ rack-test (2.2.0)
187
+ rack (>= 1.3)
188
+ rackup (2.2.1)
189
+ rack (>= 3)
190
+ rails (7.1.5.1)
191
+ actioncable (= 7.1.5.1)
192
+ actionmailbox (= 7.1.5.1)
193
+ actionmailer (= 7.1.5.1)
194
+ actionpack (= 7.1.5.1)
195
+ actiontext (= 7.1.5.1)
196
+ actionview (= 7.1.5.1)
197
+ activejob (= 7.1.5.1)
198
+ activemodel (= 7.1.5.1)
199
+ activerecord (= 7.1.5.1)
200
+ activestorage (= 7.1.5.1)
201
+ activesupport (= 7.1.5.1)
202
+ bundler (>= 1.15.0)
203
+ railties (= 7.1.5.1)
204
+ rails-dom-testing (2.2.0)
205
+ activesupport (>= 5.0.0)
206
+ minitest
207
+ nokogiri (>= 1.6)
208
+ rails-html-sanitizer (1.6.2)
209
+ loofah (~> 2.21)
210
+ nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
211
+ railties (7.1.5.1)
212
+ actionpack (= 7.1.5.1)
213
+ activesupport (= 7.1.5.1)
214
+ irb
215
+ rackup (>= 1.0.0)
216
+ rake (>= 12.2)
217
+ thor (~> 1.0, >= 1.2.2)
218
+ zeitwerk (~> 2.6)
219
+ rake (13.2.1)
220
+ rdoc (6.12.0)
221
+ psych (>= 4.0.0)
222
+ reline (0.6.0)
223
+ io-console (~> 0.5)
224
+ rexml (3.4.1)
225
+ rspec (3.13.0)
226
+ rspec-core (~> 3.13.0)
227
+ rspec-expectations (~> 3.13.0)
228
+ rspec-mocks (~> 3.13.0)
229
+ rspec-core (3.13.3)
230
+ rspec-support (~> 3.13.0)
231
+ rspec-expectations (3.13.3)
232
+ diff-lcs (>= 1.2.0, < 2.0)
233
+ rspec-support (~> 3.13.0)
234
+ rspec-mocks (3.13.2)
235
+ diff-lcs (>= 1.2.0, < 2.0)
236
+ rspec-support (~> 3.13.0)
237
+ rspec-support (3.13.2)
238
+ savon (2.15.1)
239
+ akami (~> 1.2)
240
+ builder (>= 2.1.2)
241
+ gyoku (~> 1.2)
242
+ httpi (>= 4, < 5)
243
+ mail (~> 2.5)
244
+ nokogiri (>= 1.8.1)
245
+ nori (~> 2.4)
246
+ wasabi (>= 3.7, < 6)
247
+ securerandom (0.3.2)
248
+ sqlite3 (2.0.4)
249
+ mini_portile2 (~> 2.8.0)
250
+ stringio (3.1.5)
251
+ thor (1.3.2)
252
+ timeout (0.4.3)
253
+ tzinfo (2.0.6)
254
+ concurrent-ruby (~> 1.0)
255
+ uri (1.0.3)
256
+ wasabi (5.1.0)
257
+ addressable
258
+ faraday (>= 1.9, < 3)
259
+ nokogiri (>= 1.13.9)
260
+ wash_out (0.12.0)
261
+ nori (>= 2.0.0)
262
+ webmock (3.25.1)
263
+ addressable (>= 2.8.0)
264
+ crack (>= 0.3.2)
265
+ hashdiff (>= 0.4.0, < 2.0.0)
266
+ websocket-driver (0.7.7)
267
+ base64
268
+ websocket-extensions (>= 0.1.0)
269
+ websocket-extensions (0.1.5)
270
+ zeitwerk (2.6.18)
271
+
272
+ PLATFORMS
273
+ x86_64-linux
274
+
275
+ DEPENDENCIES
276
+ actionpack (~> 7.1.0)
277
+ actionview (~> 7.1.0)
278
+ activerecord
279
+ appraisal
280
+ byebug
281
+ httpi
282
+ minitest
283
+ qbwc!
284
+ rails (>= 5.0.1, < 7.2)
285
+ rake
286
+ rspec
287
+ savon
288
+ sqlite3
289
+ webmock
290
+
291
+ BUNDLED WITH
292
+ 2.4.13
@@ -1,4 +1,4 @@
1
- class ChangeRequestIndex < ActiveRecord::Migration
1
+ class ChangeRequestIndex < ActiveRecord::Migration[5.0]
2
2
  def change
3
3
  change_column :qbwc_jobs, :request_index, :text, null: true, default: nil
4
4
  end
@@ -1,4 +1,4 @@
1
- class CreateQbwcJobs < ActiveRecord::Migration
1
+ class CreateQbwcJobs < ActiveRecord::Migration[5.0]
2
2
  def change
3
3
  create_table :qbwc_jobs, :force => true do |t|
4
4
  t.string :name
@@ -1,4 +1,4 @@
1
- class CreateQbwcSessions < ActiveRecord::Migration
1
+ class CreateQbwcSessions < ActiveRecord::Migration[5.0]
2
2
  def change
3
3
  create_table :qbwc_sessions, :force => true do |t|
4
4
  t.string :ticket
@@ -8,7 +8,7 @@ class CreateQbwcSessions < ActiveRecord::Migration
8
8
  t.string :current_job
9
9
  t.string :iterator_id
10
10
  t.string :error, :limit => 1000
11
- t.string :pending_jobs, :limit => 1000, :null => false, :default => ''
11
+ t.text :pending_jobs, :null => false, :default => ''
12
12
 
13
13
  t.timestamps :null => false
14
14
  end
@@ -1,4 +1,4 @@
1
- class IndexQbwcJobs < ActiveRecord::Migration
1
+ class IndexQbwcJobs < ActiveRecord::Migration[5.0]
2
2
  def change
3
3
  add_index :qbwc_jobs, :name, unique: true
4
4
  add_index :qbwc_jobs, :company, length: 150
@@ -1,4 +1,4 @@
1
- class SessionPendingJobsText < ActiveRecord::Migration
1
+ class SessionPendingJobsText < ActiveRecord::Migration[5.0]
2
2
  def change
3
3
  change_column_default(:qbwc_sessions, :pending_jobs, nil)
4
4
  change_column :qbwc_sessions, :pending_jobs, :text, :limit => 1000, :null => false
@@ -1,8 +1,15 @@
1
1
  class QBWC::ActiveRecord::Job < QBWC::Job
2
2
  class QbwcJob < ActiveRecord::Base
3
- validates :name, :uniqueness => true, :presence => true
4
- serialize :requests, Hash
5
- serialize :request_index, Hash
3
+ validates :name, :uniqueness => { :case_sensitive => true }, :presence => true
4
+
5
+ if Rails.version >= '6.1'
6
+ serialize :requests, type: Hash
7
+ serialize :request_index, type: Hash
8
+ else
9
+ serialize :requests, Hash
10
+ serialize :request_index, Hash
11
+ end
12
+
6
13
  serialize :data
7
14
 
8
15
  def to_qbwc_job
@@ -9,10 +9,10 @@ module QBWC
9
9
 
10
10
  def self.included(base)
11
11
  base.class_eval do
12
- include WashOut::SOAP
13
- skip_before_filter :_parse_soap_parameters, :_authenticate_wsse, :_map_soap_parameters, :only => :qwc
14
- before_filter :get_session, :except => [:qwc, :authenticate, :_generate_wsdl]
15
- after_filter :save_session, :except => [:qwc, :authenticate, :_generate_wsdl, :close_connection, :connection_error]
12
+ soap_service
13
+ skip_before_action :_authenticate_wsse, :_map_soap_parameters, :only => :qwc
14
+ before_action :get_session, :except => [:qwc, :authenticate, :_generate_wsdl]
15
+ after_action :save_session, :except => [:qwc, :authenticate, :_generate_wsdl, :close_connection, :connection_error]
16
16
 
17
17
  # wash_out changed the format of app/views/wash_with_soap/rpc/response.builder in commit
18
18
  # https://github.com/inossidabile/wash_out/commit/24a77f4a3d874562732c6e8c3a30e8defafea7cb
@@ -77,7 +77,7 @@ SB
77
77
  <AppURL>#{qbwc_action_url(:only_path => false)}</AppURL>
78
78
  <AppDescription>Quickbooks integration</AppDescription>
79
79
  <AppSupport>#{QBWC.support_site_url || root_url(:protocol => 'https://')}</AppSupport>
80
- <UserName>#{@username || QBWC.username}</UserName>
80
+ <UserName>#{QBWC.username}</UserName>
81
81
  <OwnerID>#{QBWC.owner_id}</OwnerID>
82
82
  <FileID>{#{file_id}}</FileID>
83
83
  <QBType>QBFS</QBType>
@@ -85,7 +85,7 @@ SB
85
85
  #{scheduler_block}
86
86
  </QBWCXML>
87
87
  QWC
88
- send_data qwc, :filename => "#{@filename || Rails.application.class.parent_name}.qwc", :content_type => 'application/x-qwc'
88
+ send_data qwc, :filename => "#{Rails.application.class.try(:module_parent_name) || Rails.application.class.parent_name}.qwc", :content_type => 'application/x-qwc'
89
89
  end
90
90
 
91
91
  class StringArray < WashOut::Type
@@ -162,7 +162,7 @@ QWC
162
162
  end
163
163
 
164
164
  def app_name
165
- "#{Rails.application.class.parent_name} #{Rails.env} #{@app_name_suffix}"
165
+ "#{Rails.application.class.try(:module_parent_name) || Rails.application.class.parent_name} #{Rails.env}"
166
166
  end
167
167
 
168
168
  def file_id
data/lib/qbwc/job.rb CHANGED
@@ -23,10 +23,10 @@ class QBWC::Job
23
23
 
24
24
  def process_response(qbxml_response, response, session, advance)
25
25
  QBWC.logger.info "Processing response."
26
+ QBWC.logger.info "Job '#{name}' received response: '#{qbxml_response}'." if QBWC.log_requests_and_responses
26
27
  request_list = requests(session)
27
28
  completed_request = request_list[request_index(session)] if request_list
28
29
  advance_next_request(session) if advance
29
- QBWC.logger.info "Job '#{name}' received response: '#{qbxml_response}'." if QBWC.log_requests_and_responses
30
30
  worker.handle_response(response, session, self, completed_request, data)
31
31
  end
32
32
 
data/lib/qbwc/session.rb CHANGED
@@ -18,7 +18,7 @@ class QBWC::Session
18
18
  @iterator_id = nil
19
19
  @initial_job_count = pending_jobs.length
20
20
 
21
- @ticket = ticket || Digest::SHA1.hexdigest("#{Rails.application.config.secret_token}#{Time.now.to_i}")
21
+ @ticket = ticket || Digest::SHA1.hexdigest("#{Rails.application.config.try(:secret_key_base) || Rails.application.config.try(:secret_token)}#{SecureRandom.uuid}")
22
22
 
23
23
  @@session = self
24
24
  reset(ticket.nil?)
@@ -61,8 +61,9 @@ class QBWC::Session
61
61
  request = self.next_request
62
62
  if request && self.iterator_id.present?
63
63
  request = request.to_hash
64
+ requestID = request.values.first["xml_attributes"]["requestID"]
64
65
  request.delete('xml_attributes')
65
- request.values.first['xml_attributes'] = {'iterator' => 'Continue', 'iteratorID' => self.iterator_id}
66
+ request.values.first['xml_attributes'] = {'iterator' => 'Continue', 'iteratorID' => self.iterator_id, 'requestID' => requestID}
66
67
  request = QBWC::Request.new(request)
67
68
  end
68
69
  request
data/lib/qbwc/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module QBWC
2
- VERSION = "1.0.0"
2
+ VERSION = "1.2.0"
3
3
  end
data/qbwc.gemspec CHANGED
@@ -22,18 +22,21 @@ Gem::Specification.new do |s|
22
22
  "README.md"
23
23
  ]
24
24
 
25
+ s.required_ruby_version = '>= 2.2.2'
26
+
25
27
  s.add_dependency "qbxml", [">= 0.3.0"]
26
- s.add_dependency "wash_out", [">= 0.7.1"]
28
+ s.add_dependency "wash_out", ['>=0.12.0']
29
+ s.add_dependency 'actionpack', ['>= 5.0.1']
27
30
 
28
- s.add_development_dependency('guard')
29
- s.add_development_dependency('guard-rspec')
30
- s.add_development_dependency('rb-fsevent')
31
31
  s.add_development_dependency('webmock')
32
32
  s.add_development_dependency('rspec')
33
33
  s.add_development_dependency('activerecord')
34
- s.add_development_dependency('actionpack')
35
- s.add_development_dependency('rails', [">= 4.1.0"])
34
+ s.add_development_dependency('rails', [">= 5.0.1", '< 7.2'])
36
35
  s.add_development_dependency('sqlite3')
37
36
  s.add_development_dependency('minitest')
38
37
  s.add_development_dependency('rake')
38
+ s.add_development_dependency('appraisal')
39
+ s.add_development_dependency('savon')
40
+ s.add_development_dependency('httpi')
41
+ s.add_development_dependency('byebug')
39
42
  end
@@ -8,6 +8,7 @@ class QBWCControllerTest < ActionController::TestCase
8
8
 
9
9
  def setup
10
10
  @routes = Rails.application.routes # https://github.com/blowmage/minitest-rails/issues/133#issuecomment-36401436
11
+ ActiveRecord::Base.yaml_column_permitted_classes += [Symbol] if ActiveRecord::Base.respond_to?(:yaml_column_permitted_classes)
11
12
  @controller = QbwcController.new # http://stackoverflow.com/a/7743176
12
13
  @session = QBWC::Session.new('foo', '')
13
14
 
@@ -31,13 +32,18 @@ class QBWCControllerTest < ActionController::TestCase
31
32
  #_inspect_routes
32
33
  process(:qwc)
33
34
 
34
- assert_match /QBWCXML/, @response.body
35
- assert_match Regexp.new("AppName.*QbwcTestApplication #{Rails.env}.*AppName"), @response.body
36
- assert_match /AppURL.*http:\/\/test.host\/qbwc\/action.*AppURL/, @response.body
37
- assert_match /AppDescription.*Quickbooks integration.*AppDescription/, @response.body
38
- assert_match /AppSupport.*https:\/\/test.host\/.*AppSupport/, @response.body
39
- assert_match /UserName.*#{QBWC_USERNAME}.*UserName/, @response.body
40
- assert_match /FileID.*{90A44FB5-33D9-4815-AC85-BC87A7E7D1EB}.*FileID/, @response.body
35
+ assert_match(/QBWCXML/, @response.body)
36
+ assert_match(Regexp.new("AppName.*QbwcTestApplication #{Rails.env}.*AppName"), @response.body)
37
+ assert_match(/AppURL.*http:\/\/test.host\/qbwc\/action.*AppURL/, @response.body)
38
+ assert_match(/AppDescription.*Quickbooks integration.*AppDescription/, @response.body)
39
+ assert_match(/AppSupport.*https:\/\/test.host\/.*AppSupport/, @response.body)
40
+ assert_match(/UserName.*#{QBWC_USERNAME}.*UserName/, @response.body)
41
+ assert_match(/FileID.*{90A44FB5-33D9-4815-AC85-BC87A7E7D1EB}.*FileID/, @response.body)
42
+ end
43
+
44
+ test "server_version" do
45
+ _simulate_soap_request('server_version', SERVER_VERSION_SOAP_ACTION, SERVER_VERSION_PARAMS)
46
+ assert_match(/tns:serverVersionResult/, @response.body)
41
47
  end
42
48
 
43
49
  test "authenticate with no jobs" do
@@ -101,7 +107,7 @@ class QBWCControllerTest < ActionController::TestCase
101
107
  _authenticate_with_queued_job
102
108
  _simulate_soap_request('receive_response', RECEIVE_RESPONSE_SOAP_ACTION, RECEIVE_RESPONSE_PARAMS)
103
109
 
104
- assert_match /tns:receiveResponseXMLResult.*100..tns:receiveResponseXMLResult/, @response.body
110
+ assert_match(/tns:receiveResponseXMLResult.*100..tns:receiveResponseXMLResult/, @response.body)
105
111
  end
106
112
 
107
113
  class CheckErrorValuesWorker < QBWC::Worker
@@ -137,7 +143,7 @@ class QBWCControllerTest < ActionController::TestCase
137
143
  _simulate_soap_request('receive_response', RECEIVE_RESPONSE_SOAP_ACTION, RECEIVE_RESPONSE_ERROR_PARAMS)
138
144
 
139
145
  assert $HANDLE_RESPONSE_EXECUTED # https://github.com/skryl/qbwc/pull/50#discussion_r23764154
140
- assert_match /tns:receiveResponseXMLResult.*#{receive_response_xml_result}..tns:receiveResponseXMLResult/, @response.body
146
+ assert_match(/tns:receiveResponseXMLResult.*#{receive_response_xml_result}..tns:receiveResponseXMLResult/, @response.body)
141
147
  end
142
148
 
143
149
  test "receive_response error stop" do
@@ -50,7 +50,7 @@ class JobManagementTest < ActionDispatch::IntegrationTest
50
50
 
51
51
  test "requests with default session" do
52
52
  job = QBWC.add_job(:integration_test, true, '', QBWC::Worker)
53
- session = QBWC::Session.new('foo', '')
53
+ QBWC::Session.new('foo', '')
54
54
  assert_nil job.requests
55
55
  end
56
56
 
@@ -62,7 +62,7 @@ class JobManagementTest < ActionDispatch::IntegrationTest
62
62
 
63
63
  test "next_request with default session" do
64
64
  job = QBWC.add_job(:integration_test, true, '', QBWC::Worker)
65
- session = QBWC::Session.new('foo', '')
65
+ QBWC::Session.new('foo', '')
66
66
  assert_nil job.next_request
67
67
  end
68
68
 
@@ -30,7 +30,7 @@ class RequestGenerationTest < ActionDispatch::IntegrationTest
30
30
 
31
31
  class SingleRequestWorker < QBWC::Worker
32
32
  def requests(job, session, data)
33
- $SINGLE_REQUESTS_INVOKED_COUNT += 1 if $SINGLE_REQUESTS_INVOKED_COUNT.is_a?(Integer)
33
+ $SINGLE_REQUESTS_INVOKED_COUNT += 1 if defined?($SINGLE_REQUESTS_INVOKED_COUNT) && $SINGLE_REQUESTS_INVOKED_COUNT.is_a?(Integer)
34
34
  {:customer_query_rq => {:full_name => 'Quincy Bob William Carlos'}}
35
35
  end
36
36
  end
@@ -41,14 +41,14 @@ class RequestGenerationTest < ActionDispatch::IntegrationTest
41
41
  session = QBWC::Session.new('foo', '')
42
42
  nr = session.next_request
43
43
  assert_not_nil nr
44
- assert_match /FullName.*Quincy Bob William Carlos.*FullName/, nr.request
44
+ assert_match(/FullName.*Quincy Bob William Carlos.*FullName/, nr.request)
45
45
  simulate_response(session)
46
46
  assert_nil session.next_request
47
47
  end
48
48
 
49
49
  class SingleStringRequestWorker < QBWC::Worker
50
50
  def requests(job, session, data)
51
- $SINGLE_REQUESTS_INVOKED_COUNT += 1 if $SINGLE_REQUESTS_INVOKED_COUNT.is_a?(Integer)
51
+ $SINGLE_REQUESTS_INVOKED_COUNT += 1 if defined?($SINGLE_REQUESTS_INVOKED_COUNT) && $SINGLE_REQUESTS_INVOKED_COUNT.is_a?(Integer)
52
52
  QBWC_CUSTOMER_QUERY_RQ
53
53
  end
54
54
  end
@@ -59,7 +59,7 @@ class RequestGenerationTest < ActionDispatch::IntegrationTest
59
59
  session = QBWC::Session.new('foo', '')
60
60
  nr = session.next_request
61
61
  assert_not_nil nr
62
- assert_match /FullName.*#{QBWC_USERNAME}.*FullName/, nr.request
62
+ assert_match(/FullName.*#{QBWC_USERNAME}.*FullName/, nr.request)
63
63
  simulate_response(session)
64
64
  assert_nil session.next_request
65
65
  end
@@ -130,17 +130,17 @@ class RequestGenerationTest < ActionDispatch::IntegrationTest
130
130
 
131
131
  req1 = session.next_request
132
132
  assert_not_nil req1
133
- assert_match /xml.*FullName.*Quincy Bob William Carlos.*FullName/m, req1.request
133
+ assert_match(/xml.*FullName.*Quincy Bob William Carlos.*FullName/m, req1.request)
134
134
  simulate_response(session)
135
135
 
136
136
  req2 = session.next_request
137
137
  assert_not_nil req2
138
- assert_match /xml.*FullName.*Quentin Billy Wyatt Charles.*FullName/m, req2.request
138
+ assert_match(/xml.*FullName.*Quentin Billy Wyatt Charles.*FullName/m, req2.request)
139
139
  simulate_response(session)
140
140
 
141
141
  req3 = session.next_request
142
142
  assert_not_nil req3
143
- assert_match /xml.*FullName.*Quigley Brian Wally Colin.*FullName/m, req3.request
143
+ assert_match(/xml.*FullName.*Quigley Brian Wally Colin.*FullName/m, req3.request)
144
144
  simulate_response(session)
145
145
 
146
146
  assert_nil session.next_request
@@ -261,11 +261,11 @@ class RequestGenerationTest < ActionDispatch::IntegrationTest
261
261
  session = QBWC::Session.new('foo', '')
262
262
  request = session.next_request
263
263
  assert_not_nil request
264
- assert_match /CustomerAddRq.*\/CustomerAddRq/m, request.request
264
+ assert_match(/CustomerAddRq.*\/CustomerAddRq/m, request.request)
265
265
  simulate_response(session)
266
266
  assert_nil session.next_request
267
267
 
268
- assert_match /CustomerAddRq.*\/CustomerAddRq/m, extract_request(QBWC::ActiveRecord::Job::QbwcJob.first, session)[0]
268
+ assert_match(/CustomerAddRq.*\/CustomerAddRq/m, extract_request(QBWC::ActiveRecord::Job::QbwcJob.first, session)[0])
269
269
  QBWC.jobs.each {|job| assert job.requests_provided_when_job_added == true}
270
270
  end
271
271
 
@@ -296,7 +296,7 @@ class RequestGenerationTest < ActionDispatch::IntegrationTest
296
296
  session = QBWC::Session.new('foo', '')
297
297
  request = session.next_request
298
298
  assert_not_nil request
299
- assert_match /FullName.#{QBWC_USERNAME}.\/FullName/, request.request
299
+ assert_match(/FullName.#{QBWC_USERNAME}.\/FullName/, request.request)
300
300
 
301
301
  expected = {[nil, ""] => [{:customer_query_rq => {:full_name => QBWC_USERNAME}}]}
302
302
  assert_equal expected, QBWC::ActiveRecord::Job::QbwcJob.first[:requests]
@@ -327,11 +327,11 @@ class RequestGenerationTest < ActionDispatch::IntegrationTest
327
327
 
328
328
  session = QBWC::Session.new('foo', '')
329
329
  request1 = session.next_request
330
- assert_match /FullName.#{QBWC_USERNAME}.\/FullName/, request1.request
330
+ assert_match(/FullName.#{QBWC_USERNAME}.\/FullName/, request1.request)
331
331
  simulate_response(session)
332
332
 
333
333
  request2 = session.next_request
334
- assert_match /FullName.usr2 name.\/FullName/, request2.request
334
+ assert_match(/FullName.usr2 name.\/FullName/, request2.request)
335
335
  simulate_response(session)
336
336
 
337
337
  assert_nil session.next_request
@@ -30,6 +30,8 @@ class ResponseTest < ActionDispatch::IntegrationTest
30
30
 
31
31
  # Simulate controller authenticate
32
32
  ticket_string = QBWC::ActiveRecord::Session.new(QBWC_USERNAME, COMPANY).ticket
33
+ assert_not_nil(ticket_string)
34
+
33
35
  session = QBWC::Session.new(nil, COMPANY)
34
36
 
35
37
  responses.each do |resp|
@@ -21,12 +21,12 @@ class RoutesTest < ActionDispatch::IntegrationTest
21
21
  #_inspect_routes
22
22
  get '/qbwc/qwc'
23
23
 
24
- assert_match /QBWCXML/, @response.body
25
- assert_match Regexp.new("AppName.*QbwcTestApplication #{Rails.env}.*AppName"), @response.body
26
- assert_match /AppURL.*http:\/\/www.example.com\/qbwc\/action.*AppURL/, @response.body
27
- assert_match /AppDescription.*Quickbooks integration.*AppDescription/, @response.body
28
- assert_match /AppSupport.*https:\/\/www.example.com\/.*AppSupport/, @response.body
29
- assert_match /UserName.*#{QBWC_USERNAME}.*UserName/, @response.body
24
+ assert_match(/QBWCXML/, @response.body)
25
+ assert_match(Regexp.new("AppName.*QbwcTestApplication #{Rails.env}.*AppName"), @response.body)
26
+ assert_match(/AppURL.*http:\/\/www.example.com\/qbwc\/action.*AppURL/, @response.body)
27
+ assert_match(/AppDescription.*Quickbooks integration.*AppDescription/, @response.body)
28
+ assert_match(/AppSupport.*https:\/\/www.example.com\/.*AppSupport/, @response.body)
29
+ assert_match(/UserName.*#{QBWC_USERNAME}.*UserName/, @response.body)
30
30
  end
31
31
 
32
32
  test "qbwc/action without soap returns successfully" do