defra_ruby_mocks 1.1.0 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +52 -2
- data/Rakefile +0 -2
- data/app/controllers/defra_ruby_mocks/company_controller.rb +1 -1
- data/app/controllers/defra_ruby_mocks/worldpay_controller.rb +33 -12
- data/app/services/defra_ruby_mocks/{worldpay_request_service.rb → worldpay_payment_service.rb} +3 -9
- data/app/services/defra_ruby_mocks/worldpay_refund_service.rb +37 -0
- data/app/services/defra_ruby_mocks/worldpay_request_handler_service.rb +40 -0
- data/app/services/defra_ruby_mocks/worldpay_resource_service.rb +55 -0
- data/app/services/defra_ruby_mocks/worldpay_response_service.rb +71 -52
- data/app/views/defra_ruby_mocks/worldpay/payment_request.xml.erb +4 -0
- data/app/views/defra_ruby_mocks/worldpay/refund_request.xml.erb +4 -0
- data/app/views/defra_ruby_mocks/worldpay/stuck.html.erb +37 -0
- data/lib/defra_ruby_mocks/engine.rb +2 -1
- data/lib/defra_ruby_mocks/missing_resource_error.rb +9 -0
- data/lib/defra_ruby_mocks/unrecognised_worldpay_request_error.rb +5 -0
- data/lib/defra_ruby_mocks/version.rb +1 -1
- data/spec/dummy/log/development.log +180 -0
- data/spec/dummy/log/test.log +1287 -323
- data/spec/examples.txt +99 -56
- data/spec/fixtures/{worldpay_request_invalid.xml → payment_request_invalid.xml} +0 -0
- data/spec/fixtures/{worldpay_request_valid.xml → payment_request_valid.xml} +0 -0
- data/spec/fixtures/refund_request_invalid.xml +6 -0
- data/spec/fixtures/refund_request_valid.xml +11 -0
- data/spec/fixtures/unrecognised_request.xml +6 -0
- data/spec/requests/worldpay_spec.rb +87 -26
- data/spec/services/{worldpay_request_service_spec.rb → worldpay_payment_service_spec.rb} +25 -22
- data/spec/services/worldpay_refund_service_spec.rb +68 -0
- data/spec/services/worldpay_request_handler_service_spec.rb +79 -0
- data/spec/services/worldpay_resource_service_spec.rb +112 -0
- data/spec/services/worldpay_response_service_spec.rb +185 -58
- data/spec/support/helpers/xml_matchers.rb +19 -0
- metadata +50 -17
- data/app/views/defra_ruby_mocks/worldpay/payments_service.xml.erb +0 -4
- data/lib/defra_ruby_mocks/missing_registration_error.rb +0 -9
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rspec/expectations"
|
4
|
+
|
5
|
+
RSpec::Matchers.define :be_xml do
|
6
|
+
match do
|
7
|
+
begin
|
8
|
+
Nokogiri::XML(actual, &:strict)
|
9
|
+
|
10
|
+
true
|
11
|
+
rescue Nokogiri::XML::SyntaxError
|
12
|
+
false
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
failure_message do |actual|
|
17
|
+
"expected that \"#{actual}\" would be a valid XML document"
|
18
|
+
end
|
19
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: defra_ruby_mocks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Defra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 4.2.11.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: sprockets
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 3.7.2
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 3.7.2
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: nokogiri
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,16 +112,16 @@ dependencies:
|
|
98
112
|
name: simplecov
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
|
-
- - "
|
115
|
+
- - "~>"
|
102
116
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
117
|
+
version: 0.17.1
|
104
118
|
type: :development
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
|
-
- - "
|
122
|
+
- - "~>"
|
109
123
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
124
|
+
version: 0.17.1
|
111
125
|
description: A Rails engine which can be used to mock external services when loaded
|
112
126
|
into an application
|
113
127
|
email:
|
@@ -124,17 +138,23 @@ files:
|
|
124
138
|
- app/controllers/defra_ruby_mocks/worldpay_controller.rb
|
125
139
|
- app/services/defra_ruby_mocks/base_service.rb
|
126
140
|
- app/services/defra_ruby_mocks/companies_house_service.rb
|
127
|
-
- app/services/defra_ruby_mocks/
|
141
|
+
- app/services/defra_ruby_mocks/worldpay_payment_service.rb
|
142
|
+
- app/services/defra_ruby_mocks/worldpay_refund_service.rb
|
143
|
+
- app/services/defra_ruby_mocks/worldpay_request_handler_service.rb
|
144
|
+
- app/services/defra_ruby_mocks/worldpay_resource_service.rb
|
128
145
|
- app/services/defra_ruby_mocks/worldpay_response_service.rb
|
129
146
|
- app/views/defra_ruby_mocks/company/not_found.json.erb
|
130
147
|
- app/views/defra_ruby_mocks/company/show.json.erb
|
131
|
-
- app/views/defra_ruby_mocks/worldpay/
|
148
|
+
- app/views/defra_ruby_mocks/worldpay/payment_request.xml.erb
|
149
|
+
- app/views/defra_ruby_mocks/worldpay/refund_request.xml.erb
|
150
|
+
- app/views/defra_ruby_mocks/worldpay/stuck.html.erb
|
132
151
|
- config/routes.rb
|
133
152
|
- lib/defra_ruby_mocks.rb
|
134
153
|
- lib/defra_ruby_mocks/configuration.rb
|
135
154
|
- lib/defra_ruby_mocks/engine.rb
|
136
155
|
- lib/defra_ruby_mocks/invalid_config_error.rb
|
137
|
-
- lib/defra_ruby_mocks/
|
156
|
+
- lib/defra_ruby_mocks/missing_resource_error.rb
|
157
|
+
- lib/defra_ruby_mocks/unrecognised_worldpay_request_error.rb
|
138
158
|
- lib/defra_ruby_mocks/version.rb
|
139
159
|
- lib/tasks/changelog.rake
|
140
160
|
- lib/tasks/defra_ruby_mocks_tasks.rake
|
@@ -176,19 +196,26 @@ files:
|
|
176
196
|
- spec/dummy/public/500.html
|
177
197
|
- spec/dummy/public/favicon.ico
|
178
198
|
- spec/examples.txt
|
179
|
-
- spec/fixtures/
|
180
|
-
- spec/fixtures/
|
199
|
+
- spec/fixtures/payment_request_invalid.xml
|
200
|
+
- spec/fixtures/payment_request_valid.xml
|
201
|
+
- spec/fixtures/refund_request_invalid.xml
|
202
|
+
- spec/fixtures/refund_request_valid.xml
|
203
|
+
- spec/fixtures/unrecognised_request.xml
|
181
204
|
- spec/lib/configuration_spec.rb
|
182
205
|
- spec/rails_helper.rb
|
183
206
|
- spec/requests/company_spec.rb
|
184
207
|
- spec/requests/worldpay_spec.rb
|
185
208
|
- spec/services/companies_house_service_spec.rb
|
186
|
-
- spec/services/
|
209
|
+
- spec/services/worldpay_payment_service_spec.rb
|
210
|
+
- spec/services/worldpay_refund_service_spec.rb
|
211
|
+
- spec/services/worldpay_request_handler_service_spec.rb
|
212
|
+
- spec/services/worldpay_resource_service_spec.rb
|
187
213
|
- spec/services/worldpay_response_service_spec.rb
|
188
214
|
- spec/spec_helper.rb
|
189
215
|
- spec/support/helpers/configuration.rb
|
190
216
|
- spec/support/helpers/helpers.rb
|
191
217
|
- spec/support/helpers/waste_carriers_engine.rb
|
218
|
+
- spec/support/helpers/xml_matchers.rb
|
192
219
|
- spec/support/pry.rb
|
193
220
|
- spec/support/simplecov.rb
|
194
221
|
homepage: https://github.com/DEFRA/defra-ruby-mocks
|
@@ -210,8 +237,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
210
237
|
- !ruby/object:Gem::Version
|
211
238
|
version: '0'
|
212
239
|
requirements: []
|
213
|
-
|
214
|
-
rubygems_version: 2.6.13
|
240
|
+
rubygems_version: 3.0.0
|
215
241
|
signing_key:
|
216
242
|
specification_version: 4
|
217
243
|
summary: Defra Ruby on Rails external API mocking engine
|
@@ -260,12 +286,19 @@ test_files:
|
|
260
286
|
- spec/support/simplecov.rb
|
261
287
|
- spec/support/pry.rb
|
262
288
|
- spec/support/helpers/helpers.rb
|
289
|
+
- spec/support/helpers/xml_matchers.rb
|
263
290
|
- spec/support/helpers/configuration.rb
|
264
291
|
- spec/support/helpers/waste_carriers_engine.rb
|
265
292
|
- spec/lib/configuration_spec.rb
|
266
|
-
- spec/fixtures/
|
267
|
-
- spec/fixtures/
|
293
|
+
- spec/fixtures/unrecognised_request.xml
|
294
|
+
- spec/fixtures/payment_request_invalid.xml
|
295
|
+
- spec/fixtures/refund_request_valid.xml
|
296
|
+
- spec/fixtures/payment_request_valid.xml
|
297
|
+
- spec/fixtures/refund_request_invalid.xml
|
268
298
|
- spec/rails_helper.rb
|
269
299
|
- spec/services/worldpay_response_service_spec.rb
|
300
|
+
- spec/services/worldpay_resource_service_spec.rb
|
270
301
|
- spec/services/companies_house_service_spec.rb
|
271
|
-
- spec/services/
|
302
|
+
- spec/services/worldpay_payment_service_spec.rb
|
303
|
+
- spec/services/worldpay_refund_service_spec.rb
|
304
|
+
- spec/services/worldpay_request_handler_service_spec.rb
|
@@ -1,4 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<!DOCTYPE paymentService PUBLIC "-//WorldPay//DTD WorldPay PaymentService v1//EN"
|
3
|
-
"http://dtd.worldpay.com/paymentService_v1.dtd">
|
4
|
-
<paymentService version="1.4" merchantCode="<%= @merchant_code %>"><reply><orderStatus orderCode="<%= @order_code %>"><reference id="<%= @worldpay_id %>"><%= @worldpay_url %></reference></orderStatus></reply></paymentService>
|