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,48 @@
1
+ $:<< File.expand_path(File.dirname(__FILE__) + '/../..')
2
+ require 'test_helper.rb'
3
+ require 'savon'
4
+
5
+ class SavonClientTest < ActionDispatch::IntegrationTest
6
+
7
+ def setup
8
+ SavonClientTest.app = Rails.application
9
+
10
+ # Initialize sets view paths
11
+ SavonClientTest.app.initialize! unless SavonClientTest.app.initialized?
12
+
13
+ # Assign routes
14
+ QbwcTestApplication::Application.routes.draw do
15
+ _assign_routes
16
+ end
17
+
18
+ QBWC.clear_jobs
19
+ end
20
+
21
+ # http://blog.johnsonch.com/2013/04/18/rails-3-soap-and-testing-oh-my/
22
+ test "qbwc/action serverVersion" do
23
+ host = 'www.example.com'
24
+ url_base = "http://#{host}"
25
+ url_path = '/qbwc/action'
26
+
27
+ # http://httpirb.com/
28
+ # https://github.com/savonrb/httpi
29
+ HTTPI.adapter = :rack
30
+ HTTPI::Adapter::Rack.mount(host, SavonClientTest.app)
31
+
32
+ # https://github.com/savonrb/savon#usage-example
33
+ # https://github.com/inossidabile/wash_out#usage
34
+ client = Savon::Client.new({:wsdl => url_base + url_path })
35
+ result = client.call(:server_version, :message => nil)
36
+
37
+ # Use this assertion when QBWC::Controller.server_version_response returns nil
38
+ if WashOut::VERSION == "0.10.0"
39
+ assert_equal({:"@xsi:type"=>"xsd:string"}, result.body[:server_version_response][:server_version_result])
40
+ else
41
+ assert_nil result.body[:server_version_response][:server_version_result]
42
+ end
43
+
44
+ # Use this assertion when QBWC::Controller.server_version_response returns a value
45
+ # assert_equal("SERVER_VERSION_RESPONSE", result.body[:server_version_response][:server_version_result])
46
+ end
47
+
48
+ end
@@ -26,12 +26,10 @@ class SessionTest < ActionDispatch::IntegrationTest
26
26
  assert_equal 2, QBWC.pending_jobs(COMPANY, session).count
27
27
 
28
28
  # Simulate controller 1st send_request and receive_response
29
- request = session.current_request
30
29
  session.response = QBWC_CUSTOMER_QUERY_RESPONSE_INFO
31
30
  assert_equal 50, session.progress
32
31
 
33
32
  # Simulate controller 2nd send_request and receive_response
34
- request = session.current_request
35
33
  session.response = QBWC_CUSTOMER_QUERY_RESPONSE_INFO
36
34
  assert_equal 100, session.progress
37
35
  end
@@ -48,12 +46,10 @@ class SessionTest < ActionDispatch::IntegrationTest
48
46
  assert_equal 2, QBWC.pending_jobs(COMPANY, session).count
49
47
 
50
48
  # Simulate controller 1st send_request and receive_response
51
- request = session.current_request
52
49
  session.response = QBWC_CUSTOMER_ADD_RESPONSE_LONG
53
50
  assert_equal 50, session.progress
54
51
 
55
52
  # Simulate controller 2nd send_request and receive_response
56
- request = session.current_request
57
53
  session.response = QBWC_CUSTOMER_QUERY_RESPONSE_INFO
58
54
  assert_equal 100, session.progress
59
55
  end
@@ -89,7 +85,7 @@ class SessionTest < ActionDispatch::IntegrationTest
89
85
  assert_equal 1, QBWC.pending_jobs(COMPANY, session).count
90
86
 
91
87
  # Simulate controller send_request
92
- request = session.request_to_send
88
+ session.request_to_send
93
89
  end
94
90
 
95
91
  class ConditionalTestWorker < QBWC::Worker
data/test/test_helper.rb CHANGED
@@ -3,12 +3,31 @@ require 'bundler/setup'
3
3
  Bundler.setup
4
4
 
5
5
  require 'minitest/autorun'
6
+ require 'byebug'
6
7
 
7
8
  require 'active_support'
8
9
  require 'active_record'
9
10
  require 'action_controller'
10
11
  require 'rails'
11
12
 
13
+ # Determine location of local wash_out gem
14
+ # https://github.com/rubygems/rubygems/blob/master/lib/rubygems/commands/which_command.rb
15
+ require 'rubygems/commands/which_command'
16
+ which_command = Gem::Commands::WhichCommand.new
17
+ paths = which_command.find_paths('wash_out', $LOAD_PATH)
18
+ wash_out_lib = File.dirname(paths[0]) # Alternate technique: File.dirname(`gem which wash_out`)
19
+
20
+ if Rails.version < '7'
21
+ # Add wash_out to autoload_paths so that WashOutHelper can be included directly
22
+ # http://api.rubyonrails.org/classes/AbstractController/Helpers/ClassMethods.html#method-i-helper
23
+ # http://guides.rubyonrails.org/autoloading_and_reloading_constants.html#require-dependency
24
+ # http://guides.rubyonrails.org/autoloading_and_reloading_constants.html#autoload-paths
25
+ ActiveSupport::Dependencies.autoload_paths << "#{wash_out_lib}/../app/helpers"
26
+ else
27
+ # That doesn't work in Rails 7, but this does.
28
+ require "#{wash_out_lib}/../app/helpers/wash_out_helper.rb"
29
+ end
30
+
12
31
  $:<< File.expand_path(File.dirname(__FILE__) + '/../lib')
13
32
  require 'qbwc'
14
33
  require 'qbwc/controller'
@@ -38,7 +57,11 @@ module QbwcTestApplication
38
57
  Rails.application.configure do
39
58
  config.secret_key_base = "stub"
40
59
  config.eager_load = false
60
+ if config.respond_to?(:hosts)
61
+ config.hosts.clear
62
+ end
41
63
  end
64
+ ActiveRecord::Base.yaml_column_permitted_classes += [Symbol] if ActiveRecord::Base.respond_to?(:yaml_column_permitted_classes)
42
65
  ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
43
66
  require '../qbwc/lib/generators/qbwc/install/templates/db/migrate/create_qbwc_jobs'
44
67
  require '../qbwc/lib/generators/qbwc/install/templates/db/migrate/index_qbwc_jobs'
@@ -89,6 +112,8 @@ QbwcTestApplication::Application.routes.draw do
89
112
  end
90
113
 
91
114
  class QbwcController < ActionController::Base
115
+ protect_from_forgery with: :exception # Must precede QWBC::Controller to emulate Rails load order
116
+
92
117
  include Rails.application.routes.url_helpers
93
118
  include QBWC::Controller
94
119
  end
@@ -176,6 +201,12 @@ AUTHENTICATE_WASH_OUT_SOAP_DATA = {
176
201
  }
177
202
  }
178
203
 
204
+ SERVER_VERSION_PARAMS = {
205
+ :@xmlns => "http://developer.intuit.com/"
206
+ }
207
+
208
+ SERVER_VERSION_SOAP_ACTION = :serverVersion
209
+
179
210
  SEND_REQUEST_PARAMS = {
180
211
  :qbXMLCountry => "US",
181
212
  :qbXMLMajorVers => "13",
@@ -202,18 +233,44 @@ RECEIVE_RESPONSE_ERROR_PARAMS = {
202
233
 
203
234
  RECEIVE_RESPONSE_SOAP_ACTION = :receiveResponseXML
204
235
 
236
+ #-------------------------------------------
237
+ def _controller_env_is_required?
238
+ # qbwc requires minimum wash_out 0.10.0
239
+ # wash_out 0.10.0 uses controller env
240
+ # wash_out 0.11.0 uses request.env
241
+ WashOut::VERSION == "0.10.0"
242
+ end
243
+
244
+ #-------------------------------------------
245
+ def _set_controller_env_if_required
246
+ if _controller_env_is_required?
247
+ @controller.set_request!(@request) if Rails::VERSION::MAJOR >= 5
248
+ @controller.env["wash_out.soap_data"] = @request.env["wash_out.soap_data"]
249
+ end
250
+ end
251
+
205
252
  #-------------------------------------------
206
253
  def _simulate_soap_request(http_action, soap_action, soap_params)
207
254
 
208
- ticket = QBWC::ActiveRecord::Session::QbwcSession.first.ticket
209
- wash_out_soap_data = { :Envelope => { :Body => { soap_action => soap_params.update(:ticket => ticket) }}}
255
+ session = QBWC::ActiveRecord::Session::QbwcSession.first
256
+ unless session.blank?
257
+ ticket = session.ticket
258
+ soap_params = soap_params.update(:ticket => ticket)
259
+ end
260
+
261
+ wash_out_soap_data = { :Envelope => { :Body => { soap_action => soap_params }}}
210
262
 
211
263
  # http://twobitlabs.com/2010/09/setting-request-headers-in-rails-functional-tests/
212
264
  @request.env["wash_out.soap_action"] = soap_action.to_s
213
265
  @request.env["wash_out.soap_data"] = wash_out_soap_data
214
- @controller.env["wash_out.soap_data"] = @request.env["wash_out.soap_data"]
266
+ _set_controller_env_if_required
267
+
268
+ if Rails::VERSION::MAJOR <= 4
269
+ post http_action, use_route: :qbwc_action
270
+ else
271
+ post http_action, params: { use_route: :qbwc_action }
272
+ end
215
273
 
216
- post http_action, use_route: :qbwc_action
217
274
  end
218
275
 
219
276
  #-------------------------------------------
@@ -221,7 +278,7 @@ def _authenticate
221
278
  # http://twobitlabs.com/2010/09/setting-request-headers-in-rails-functional-tests/
222
279
  @request.env["wash_out.soap_action"] = AUTHENTICATE_SOAP_ACTION.to_s
223
280
  @request.env["wash_out.soap_data"] = AUTHENTICATE_WASH_OUT_SOAP_DATA
224
- @controller.env["wash_out.soap_data"] = @request.env["wash_out.soap_data"]
281
+ _set_controller_env_if_required
225
282
 
226
283
  process(:authenticate)
227
284
  end
@@ -241,7 +298,7 @@ def _authenticate_wrong_password
241
298
  bad_password_soap_data[:Envelope][:Body][AUTHENTICATE_SOAP_ACTION][:strPassword] = 'something wrong'
242
299
  @request.env["wash_out.soap_action"] = AUTHENTICATE_SOAP_ACTION.to_s
243
300
  @request.env["wash_out.soap_data"] = bad_password_soap_data
244
- @controller.env["wash_out.soap_data"] = @request.env["wash_out.soap_data"]
301
+ _set_controller_env_if_required
245
302
 
246
303
  process(:authenticate)
247
304
  end
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qbwc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Skryl
8
8
  - Russell Osborne
9
9
  - German Garcia
10
10
  - Jason Barnabe
11
- autorequire:
11
+ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2016-03-03 00:00:00.000000000 Z
14
+ date: 2025-03-19 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: qbxml
@@ -33,16 +33,30 @@ dependencies:
33
33
  requirements:
34
34
  - - ">="
35
35
  - !ruby/object:Gem::Version
36
- version: 0.7.1
36
+ version: 0.12.0
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
41
  - - ">="
42
42
  - !ruby/object:Gem::Version
43
- version: 0.7.1
43
+ version: 0.12.0
44
44
  - !ruby/object:Gem::Dependency
45
- name: guard
45
+ name: actionpack
46
+ requirement: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: 5.0.1
51
+ type: :runtime
52
+ prerelease: false
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: 5.0.1
58
+ - !ruby/object:Gem::Dependency
59
+ name: webmock
46
60
  requirement: !ruby/object:Gem::Requirement
47
61
  requirements:
48
62
  - - ">="
@@ -56,7 +70,7 @@ dependencies:
56
70
  - !ruby/object:Gem::Version
57
71
  version: '0'
58
72
  - !ruby/object:Gem::Dependency
59
- name: guard-rspec
73
+ name: rspec
60
74
  requirement: !ruby/object:Gem::Requirement
61
75
  requirements:
62
76
  - - ">="
@@ -70,7 +84,7 @@ dependencies:
70
84
  - !ruby/object:Gem::Version
71
85
  version: '0'
72
86
  - !ruby/object:Gem::Dependency
73
- name: rb-fsevent
87
+ name: activerecord
74
88
  requirement: !ruby/object:Gem::Requirement
75
89
  requirements:
76
90
  - - ">="
@@ -84,21 +98,27 @@ dependencies:
84
98
  - !ruby/object:Gem::Version
85
99
  version: '0'
86
100
  - !ruby/object:Gem::Dependency
87
- name: webmock
101
+ name: rails
88
102
  requirement: !ruby/object:Gem::Requirement
89
103
  requirements:
90
104
  - - ">="
91
105
  - !ruby/object:Gem::Version
92
- version: '0'
106
+ version: 5.0.1
107
+ - - "<"
108
+ - !ruby/object:Gem::Version
109
+ version: '7.2'
93
110
  type: :development
94
111
  prerelease: false
95
112
  version_requirements: !ruby/object:Gem::Requirement
96
113
  requirements:
97
114
  - - ">="
98
115
  - !ruby/object:Gem::Version
99
- version: '0'
116
+ version: 5.0.1
117
+ - - "<"
118
+ - !ruby/object:Gem::Version
119
+ version: '7.2'
100
120
  - !ruby/object:Gem::Dependency
101
- name: rspec
121
+ name: sqlite3
102
122
  requirement: !ruby/object:Gem::Requirement
103
123
  requirements:
104
124
  - - ">="
@@ -112,7 +132,7 @@ dependencies:
112
132
  - !ruby/object:Gem::Version
113
133
  version: '0'
114
134
  - !ruby/object:Gem::Dependency
115
- name: activerecord
135
+ name: minitest
116
136
  requirement: !ruby/object:Gem::Requirement
117
137
  requirements:
118
138
  - - ">="
@@ -126,7 +146,7 @@ dependencies:
126
146
  - !ruby/object:Gem::Version
127
147
  version: '0'
128
148
  - !ruby/object:Gem::Dependency
129
- name: actionpack
149
+ name: rake
130
150
  requirement: !ruby/object:Gem::Requirement
131
151
  requirements:
132
152
  - - ">="
@@ -140,21 +160,21 @@ dependencies:
140
160
  - !ruby/object:Gem::Version
141
161
  version: '0'
142
162
  - !ruby/object:Gem::Dependency
143
- name: rails
163
+ name: appraisal
144
164
  requirement: !ruby/object:Gem::Requirement
145
165
  requirements:
146
166
  - - ">="
147
167
  - !ruby/object:Gem::Version
148
- version: 4.1.0
168
+ version: '0'
149
169
  type: :development
150
170
  prerelease: false
151
171
  version_requirements: !ruby/object:Gem::Requirement
152
172
  requirements:
153
173
  - - ">="
154
174
  - !ruby/object:Gem::Version
155
- version: 4.1.0
175
+ version: '0'
156
176
  - !ruby/object:Gem::Dependency
157
- name: sqlite3
177
+ name: savon
158
178
  requirement: !ruby/object:Gem::Requirement
159
179
  requirements:
160
180
  - - ">="
@@ -168,7 +188,7 @@ dependencies:
168
188
  - !ruby/object:Gem::Version
169
189
  version: '0'
170
190
  - !ruby/object:Gem::Dependency
171
- name: minitest
191
+ name: httpi
172
192
  requirement: !ruby/object:Gem::Requirement
173
193
  requirements:
174
194
  - - ">="
@@ -182,7 +202,7 @@ dependencies:
182
202
  - !ruby/object:Gem::Version
183
203
  version: '0'
184
204
  - !ruby/object:Gem::Dependency
185
- name: rake
205
+ name: byebug
186
206
  requirement: !ruby/object:Gem::Requirement
187
207
  requirements:
188
208
  - - ">="
@@ -206,15 +226,29 @@ extensions: []
206
226
  extra_rdoc_files:
207
227
  - README.md
208
228
  files:
229
+ - ".github/workflows/ci.yml"
209
230
  - ".gitignore"
210
231
  - ".rspec"
211
- - ".travis.yml"
232
+ - Appraisals
212
233
  - CHANGELOG.md
213
234
  - Gemfile
214
- - Guardfile
235
+ - Gemfile.lock
215
236
  - LICENSE.txt
216
237
  - README.md
217
238
  - Rakefile
239
+ - gemfiles/.bundle/config
240
+ - gemfiles/rails_5.1.gemfile
241
+ - gemfiles/rails_5.1.gemfile.lock
242
+ - gemfiles/rails_5.2.gemfile
243
+ - gemfiles/rails_5.2.gemfile.lock
244
+ - gemfiles/rails_6.0.gemfile
245
+ - gemfiles/rails_6.0.gemfile.lock
246
+ - gemfiles/rails_6.1.gemfile
247
+ - gemfiles/rails_6.1.gemfile.lock
248
+ - gemfiles/rails_7.0.gemfile
249
+ - gemfiles/rails_7.0.gemfile.lock
250
+ - gemfiles/rails_7.1.gemfile
251
+ - gemfiles/rails_7.1.gemfile.lock
218
252
  - lib/generators/qbwc/install/install_generator.rb
219
253
  - lib/generators/qbwc/install/templates/config/qbwc.rb
220
254
  - lib/generators/qbwc/install/templates/controllers/qbwc_controller.rb
@@ -241,13 +275,13 @@ files:
241
275
  - test/qbwc/integration/request_generation_test.rb
242
276
  - test/qbwc/integration/response_test.rb
243
277
  - test/qbwc/integration/routes_test.rb
278
+ - test/qbwc/integration/savon_client_test.rb
244
279
  - test/qbwc/integration/session_test.rb
245
280
  - test/test_helper.rb
246
- - test/wash_out_helper.rb
247
281
  homepage: ''
248
282
  licenses: []
249
283
  metadata: {}
250
- post_install_message:
284
+ post_install_message:
251
285
  rdoc_options: []
252
286
  require_paths:
253
287
  - lib
@@ -255,16 +289,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
255
289
  requirements:
256
290
  - - ">="
257
291
  - !ruby/object:Gem::Version
258
- version: '0'
292
+ version: 2.2.2
259
293
  required_rubygems_version: !ruby/object:Gem::Requirement
260
294
  requirements:
261
295
  - - ">="
262
296
  - !ruby/object:Gem::Version
263
297
  version: '0'
264
298
  requirements: []
265
- rubyforge_project: qbwc
266
- rubygems_version: 2.4.6
267
- signing_key:
299
+ rubygems_version: 3.5.11
300
+ signing_key:
268
301
  specification_version: 4
269
302
  summary: A Rails interface for Intuit's Quickbooks Web Connector
270
303
  test_files: []
data/.travis.yml DELETED
@@ -1,8 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 1.9
4
- - 2.0
5
- - 2.1
6
- - 2.2
7
- before_install:
8
- - gem update bundler
data/Guardfile DELETED
@@ -1,46 +0,0 @@
1
- # A sample Guardfile
2
- # More info at https://github.com/guard/guard#readme
3
-
4
- guard 'rspec' do
5
- watch(%r{^spec/.+_spec\.rb$})
6
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
- watch('spec/spec_helper.rb') { "spec" }
8
-
9
- # Rails example
10
- watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
11
- watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
12
- watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
13
- watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
14
- watch('config/routes.rb') { "spec/routing" }
15
- watch('app/controllers/application_controller.rb') { "spec/controllers" }
16
-
17
- # Capybara features specs
18
- watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
19
-
20
- # Turnip features and steps
21
- watch(%r{^spec/acceptance/(.+)\.feature$})
22
- watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
23
- end
24
-
25
-
26
- guard 'rspec' do
27
- watch(%r{^spec/.+_spec\.rb$})
28
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
29
- watch('spec/spec_helper.rb') { "spec" }
30
-
31
- # Rails example
32
- watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
33
- watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
34
- watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
35
- watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
36
- watch('config/routes.rb') { "spec/routing" }
37
- watch('app/controllers/application_controller.rb') { "spec/controllers" }
38
-
39
- # Capybara features specs
40
- watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
41
-
42
- # Turnip features and steps
43
- watch(%r{^spec/acceptance/(.+)\.feature$})
44
- watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
45
- end
46
-
@@ -1,76 +0,0 @@
1
- # Copy of what's in the gem. Can't figure out how to include it.
2
- module WashOutHelper
3
-
4
- def wsdl_data_options(param)
5
- case controller.soap_config.wsdl_style
6
- when 'rpc'
7
- { :"xsi:type" => param.namespaced_type }
8
- when 'document'
9
- { }
10
- end
11
- end
12
-
13
- def wsdl_data(xml, params)
14
- params.each do |param|
15
- tag_name = param.name
16
- param_options = wsdl_data_options(param)
17
-
18
- if !param.struct?
19
- if !param.multiplied
20
- xml.tag! tag_name, param.value, param_options
21
- else
22
- param.value = [] unless param.value.is_a?(Array)
23
- param.value.each do |v|
24
- xml.tag! tag_name, v, param_options
25
- end
26
- end
27
- else
28
- if !param.multiplied
29
- xml.tag! tag_name, param_options do
30
- wsdl_data(xml, param.map)
31
- end
32
- else
33
- param.map.each do |p|
34
- xml.tag! tag_name, param_options do
35
- wsdl_data(xml, p.map)
36
- end
37
- end
38
- end
39
- end
40
- end
41
- end
42
-
43
- def wsdl_type(xml, param, defined=[])
44
- more = []
45
-
46
- if param.struct?
47
- if !defined.include?(param.basic_type)
48
- xml.tag! "xsd:complexType", :name => param.basic_type do
49
- xml.tag! "xsd:sequence" do
50
- param.map.each do |value|
51
- more << value if value.struct?
52
- xml.tag! "xsd:element", wsdl_occurence(value, false, :name => value.name, :type => value.namespaced_type)
53
- end
54
- end
55
- end
56
-
57
- defined << param.basic_type
58
- elsif !param.classified?
59
- raise RuntimeError, "Duplicate use of `#{param.basic_type}` type name. Consider using classified types."
60
- end
61
- end
62
-
63
- more.each do |p|
64
- wsdl_type xml, p, defined
65
- end
66
- end
67
-
68
- def wsdl_occurence(param, inject, extend_with = {})
69
- data = !param.multiplied ? {} : {
70
- "#{'xsi:' if inject}minOccurs" => 0,
71
- "#{'xsi:' if inject}maxOccurs" => 'unbounded'
72
- }
73
-
74
- extend_with.merge(data)
75
- end
76
- end