gds-api-adapters 27.1.1 → 27.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gds_api/test_helpers/email_alert_api.rb +17 -0
- data/lib/gds_api/version.rb +1 -1
- data/test/test_helpers/email_alert_api_test.rb +24 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc7475596bb3598a6a5a759f53d4741ca8ff8aea
|
4
|
+
data.tar.gz: 21a71b66b3be97ee6ce8f39af84cc78dc8e0cd0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1b8d8c47778a1a2c4042df7e08ff990cd75f190f2156d5d4ffeb568029579de9fb23129419d364f7708de31de303a3abe50ffa78e03ec4bccbf5df0e3fc63ee
|
7
|
+
data.tar.gz: bbe6af24984a932b38a1bf0b46698b647f91f9bfa72aad63f38d18cf75de155cc89f1727b586c9d52589ffe9edfaa7f37d9f528c4ec3f2c6cd9efb4b3619ef08
|
@@ -67,6 +67,23 @@ module GdsApi
|
|
67
67
|
{}
|
68
68
|
end
|
69
69
|
|
70
|
+
def stub_any_email_alert_api_call
|
71
|
+
stub_request(:any, %r{\A#{EMAIL_ALERT_API_ENDPOINT}})
|
72
|
+
end
|
73
|
+
|
74
|
+
def assert_email_alert_sent(attributes = nil)
|
75
|
+
if attributes
|
76
|
+
matcher = ->(request) do
|
77
|
+
payload = JSON.parse(request.body)
|
78
|
+
payload.select { |k, _| attributes.key?(k) } == attributes
|
79
|
+
end
|
80
|
+
else
|
81
|
+
matcher = nil
|
82
|
+
end
|
83
|
+
|
84
|
+
assert_requested(:post, notifications_url, times: 1, &matcher)
|
85
|
+
end
|
86
|
+
|
70
87
|
private
|
71
88
|
|
72
89
|
def subscriber_lists_url(query = nil)
|
data/lib/gds_api/version.rb
CHANGED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'gds_api/email_alert_api'
|
3
|
+
require 'gds_api/test_helpers/email_alert_api'
|
4
|
+
|
5
|
+
describe GdsApi::TestHelpers::EmailAlertApi do
|
6
|
+
include GdsApi::TestHelpers::EmailAlertApi
|
7
|
+
|
8
|
+
let(:base_api_url) { Plek.current.find("email-alert-api") }
|
9
|
+
let(:email_alert_api) { GdsApi::EmailAlertApi.new(base_api_url) }
|
10
|
+
|
11
|
+
describe "#assert_email_alert_sent" do
|
12
|
+
before { stub_any_email_alert_api_call }
|
13
|
+
|
14
|
+
it "matches a post request with any empty attributes by default" do
|
15
|
+
email_alert_api.send_alert({ "foo" => "bar" })
|
16
|
+
assert_email_alert_sent
|
17
|
+
end
|
18
|
+
|
19
|
+
it "matches a post request subset of attributes" do
|
20
|
+
email_alert_api.send_alert({ "foo" => "bar", "baz" => "qux" })
|
21
|
+
assert_email_alert_sent({ "foo" => "bar" })
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gds-api-adapters
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 27.
|
4
|
+
version: 27.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Stewart
|
@@ -442,6 +442,7 @@ files:
|
|
442
442
|
- test/support_api_test.rb
|
443
443
|
- test/support_test.rb
|
444
444
|
- test/test_helper.rb
|
445
|
+
- test/test_helpers/email_alert_api_test.rb
|
445
446
|
- test/test_helpers/pact_helper.rb
|
446
447
|
- test/test_helpers/panopticon_test.rb
|
447
448
|
- test/test_helpers/publishing_api_test.rb
|
@@ -486,6 +487,7 @@ test_files:
|
|
486
487
|
- test/test_helpers/publishing_api_test.rb
|
487
488
|
- test/test_helpers/pact_helper.rb
|
488
489
|
- test/test_helpers/panopticon_test.rb
|
490
|
+
- test/test_helpers/email_alert_api_test.rb
|
489
491
|
- test/licence_application_api_test.rb
|
490
492
|
- test/gov_uk_delivery_test.rb
|
491
493
|
- test/maslow_test.rb
|