govuk_notify_rails 1.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/lib/govuk_notify_rails/delivery.rb +6 -9
  3. data/lib/govuk_notify_rails/mail_ext.rb +1 -0
  4. data/lib/govuk_notify_rails/mailer.rb +6 -0
  5. data/lib/govuk_notify_rails/version.rb +1 -1
  6. data/spec/dummy/{README.rdoc → README.md} +1 -5
  7. data/spec/dummy/Rakefile +1 -1
  8. data/spec/dummy/app/assets/config/manifest.js +3 -0
  9. data/spec/dummy/app/assets/javascripts/application.js +4 -1
  10. data/spec/dummy/app/assets/javascripts/cable.js +13 -0
  11. data/spec/dummy/app/assets/stylesheets/application.css +3 -3
  12. data/spec/dummy/app/controllers/application_controller.rb +0 -2
  13. data/spec/dummy/app/jobs/application_job.rb +2 -0
  14. data/spec/dummy/app/mailers/application_mailer.rb +4 -0
  15. data/spec/dummy/app/mailers/notify_mailer.rb +1 -0
  16. data/spec/dummy/app/models/application_record.rb +3 -0
  17. data/spec/dummy/app/views/layouts/application.html.erb +9 -8
  18. data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
  19. data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
  20. data/spec/dummy/bin/rails +6 -1
  21. data/spec/dummy/bin/rake +5 -0
  22. data/spec/dummy/bin/setup +15 -10
  23. data/spec/dummy/bin/spring +17 -0
  24. data/spec/dummy/bin/update +29 -0
  25. data/spec/dummy/config.ru +2 -1
  26. data/spec/dummy/config/application.rb +5 -15
  27. data/spec/dummy/config/environment.rb +1 -1
  28. data/spec/dummy/config/environments/development.rb +27 -11
  29. data/spec/dummy/config/environments/production.rb +27 -17
  30. data/spec/dummy/config/environments/test.rb +7 -7
  31. data/spec/dummy/config/initializers/application_controller_renderer.rb +6 -0
  32. data/spec/dummy/config/initializers/cookies_serializer.rb +2 -0
  33. data/spec/dummy/config/initializers/govuk_notify_rails.rb +1 -2
  34. data/spec/dummy/config/initializers/new_framework_defaults.rb +24 -0
  35. data/spec/dummy/config/initializers/wrap_parameters.rb +6 -1
  36. data/spec/dummy/config/puma.rb +47 -0
  37. data/spec/dummy/config/routes.rb +1 -54
  38. data/spec/dummy/config/secrets.yml +3 -3
  39. data/spec/dummy/config/spring.rb +6 -0
  40. data/spec/dummy/log/development.log +7 -428
  41. data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
  42. data/spec/dummy/public/apple-touch-icon.png +0 -0
  43. data/spec/dummy/public/robots.txt +5 -0
  44. data/spec/govuk_notify_delivery/delivery_spec.rb +29 -11
  45. data/spec/mailers/notify_mailer_spec.rb +5 -0
  46. metadata +54 -16
  47. data/spec/dummy/log/test.log +0 -6
File without changes
@@ -0,0 +1,5 @@
1
+ # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
2
+ #
3
+ # To ban all spiders from the entire site uncomment the next two lines:
4
+ # User-agent: *
5
+ # Disallow: /
@@ -3,36 +3,54 @@ require 'govuk_notify_rails/delivery'
3
3
 
4
4
  describe GovukNotifyRails::Delivery do
5
5
  describe '#deliver!' do
6
- let(:service_id) { 'service-123' }
7
- let(:secret_key) { 'secret' }
6
+ let(:api_key) { 'api-key' }
8
7
  let(:notify_client) { double('NotifyClient') }
9
8
 
10
9
  let(:personalisation) { { name: 'John' } }
10
+ let(:reference) { 'my_reference' }
11
11
 
12
12
  let(:message) do
13
- instance_double(Mail::Message,
14
- to: ['email@example.com'],
15
- govuk_notify_template: 'template-123',
16
- govuk_notify_personalisation: personalisation)
13
+ instance_double(
14
+ Mail::Message,
15
+ to: ['email@example.com'],
16
+ govuk_notify_template: 'template-123',
17
+ govuk_notify_reference: reference,
18
+ govuk_notify_personalisation: personalisation
19
+ )
17
20
  end
18
21
 
19
- subject { described_class.new(service_id: service_id, secret_key: secret_key) }
22
+ subject { described_class.new(api_key: api_key) }
20
23
 
21
24
  before(:each) do
22
- allow(notify_client).to receive(:new).with(service_id, secret_key).and_return(notify_client)
25
+ allow(notify_client).to receive(:new).with(api_key).and_return(notify_client)
23
26
  allow(subject).to receive(:notify_client).and_return(notify_client)
24
27
  end
25
28
 
26
29
  it 'should deliver the message payload' do
27
- expect(notify_client).to receive(:send_email).with({to: 'email@example.com', template: 'template-123', personalisation: {name: 'John'}})
30
+ expect(notify_client).to receive(:send_email).with(
31
+ {email_address: 'email@example.com', template_id: 'template-123', reference: reference, personalisation: personalisation}
32
+ )
28
33
  subject.deliver!(message)
29
34
  end
30
35
 
31
36
  context 'no personalisation set' do
32
37
  let(:personalisation) { nil }
33
38
 
34
- it 'supports message without personalisation' do
35
- expect(notify_client).to receive(:send_email).with({to: 'email@example.com', template: 'template-123'})
39
+ it 'supports messages without personalisation' do
40
+ expect(notify_client).to receive(:send_email).with(
41
+ {email_address: 'email@example.com', template_id: 'template-123', reference: reference}
42
+ )
43
+ subject.deliver!(message)
44
+ end
45
+ end
46
+
47
+ context 'no reference set' do
48
+ let(:reference) { nil }
49
+
50
+ it 'supports messages without a reference' do
51
+ expect(notify_client).to receive(:send_email).with(
52
+ {email_address: 'email@example.com', template_id: 'template-123', personalisation: personalisation}
53
+ )
36
54
  subject.deliver!(message)
37
55
  end
38
56
  end
@@ -4,6 +4,7 @@ require 'govuk_notify_rails/mailer'
4
4
  RSpec.describe NotifyMailer, type: :mailer do
5
5
  describe 'new_message_test_email' do
6
6
  let(:template) { '9661d08a-486d-4c67-865e-ad976f17871d' }
7
+ let(:reference) { 'my_reference' }
7
8
  let(:user) { double('User', name: 'Test Name', email: 'test@example.com') }
8
9
  let(:mail) { described_class.test_email(user) }
9
10
 
@@ -23,6 +24,10 @@ RSpec.describe NotifyMailer, type: :mailer do
23
24
  expect(mail.govuk_notify_template).to eq(template)
24
25
  end
25
26
 
27
+ it 'sets the reference' do
28
+ expect(mail.govuk_notify_reference).to eq(reference)
29
+ end
30
+
26
31
  it 'sets the personalisation' do
27
32
  expect(mail.govuk_notify_personalisation.keys).to eq([:full_name])
28
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_notify_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesus Laiz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-31 00:00:00.000000000 Z
11
+ date: 2017-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -17,9 +17,6 @@ dependencies:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 4.1.0
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: 5.0.0
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
@@ -27,23 +24,20 @@ dependencies:
27
24
  - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: 4.1.0
30
- - - "<"
31
- - !ruby/object:Gem::Version
32
- version: 5.0.0
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: notifications-ruby-client
35
29
  requirement: !ruby/object:Gem::Requirement
36
30
  requirements:
37
31
  - - ">="
38
32
  - !ruby/object:Gem::Version
39
- version: 1.0.0
33
+ version: 2.0.0
40
34
  type: :runtime
41
35
  prerelease: false
42
36
  version_requirements: !ruby/object:Gem::Requirement
43
37
  requirements:
44
38
  - - ">="
45
39
  - !ruby/object:Gem::Version
46
- version: 1.0.0
40
+ version: 2.0.0
47
41
  - !ruby/object:Gem::Dependency
48
42
  name: bundler
49
43
  requirement: !ruby/object:Gem::Requirement
@@ -78,14 +72,28 @@ dependencies:
78
72
  requirements:
79
73
  - - "~>"
80
74
  - !ruby/object:Gem::Version
81
- version: '3.0'
75
+ version: '3.5'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.5'
83
+ - !ruby/object:Gem::Dependency
84
+ name: listen
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 3.0.5
82
90
  type: :development
83
91
  prerelease: false
84
92
  version_requirements: !ruby/object:Gem::Requirement
85
93
  requirements:
86
94
  - - "~>"
87
95
  - !ruby/object:Gem::Version
88
- version: '3.0'
96
+ version: 3.0.5
89
97
  description:
90
98
  email:
91
99
  - zheileman@users.noreply.github.com
@@ -99,18 +107,27 @@ files:
99
107
  - lib/govuk_notify_rails/mail_ext.rb
100
108
  - lib/govuk_notify_rails/mailer.rb
101
109
  - lib/govuk_notify_rails/version.rb
102
- - spec/dummy/README.rdoc
110
+ - spec/dummy/README.md
103
111
  - spec/dummy/Rakefile
112
+ - spec/dummy/app/assets/config/manifest.js
104
113
  - spec/dummy/app/assets/javascripts/application.js
114
+ - spec/dummy/app/assets/javascripts/cable.js
105
115
  - spec/dummy/app/assets/stylesheets/application.css
106
116
  - spec/dummy/app/controllers/application_controller.rb
107
117
  - spec/dummy/app/helpers/application_helper.rb
118
+ - spec/dummy/app/jobs/application_job.rb
119
+ - spec/dummy/app/mailers/application_mailer.rb
108
120
  - spec/dummy/app/mailers/notify_mailer.rb
121
+ - spec/dummy/app/models/application_record.rb
109
122
  - spec/dummy/app/views/layouts/application.html.erb
123
+ - spec/dummy/app/views/layouts/mailer.html.erb
124
+ - spec/dummy/app/views/layouts/mailer.text.erb
110
125
  - spec/dummy/bin/bundle
111
126
  - spec/dummy/bin/rails
112
127
  - spec/dummy/bin/rake
113
128
  - spec/dummy/bin/setup
129
+ - spec/dummy/bin/spring
130
+ - spec/dummy/bin/update
114
131
  - spec/dummy/config.ru
115
132
  - spec/dummy/config/application.rb
116
133
  - spec/dummy/config/boot.rb
@@ -118,6 +135,7 @@ files:
118
135
  - spec/dummy/config/environments/development.rb
119
136
  - spec/dummy/config/environments/production.rb
120
137
  - spec/dummy/config/environments/test.rb
138
+ - spec/dummy/config/initializers/application_controller_renderer.rb
121
139
  - spec/dummy/config/initializers/assets.rb
122
140
  - spec/dummy/config/initializers/backtrace_silencers.rb
123
141
  - spec/dummy/config/initializers/cookies_serializer.rb
@@ -125,17 +143,22 @@ files:
125
143
  - spec/dummy/config/initializers/govuk_notify_rails.rb
126
144
  - spec/dummy/config/initializers/inflections.rb
127
145
  - spec/dummy/config/initializers/mime_types.rb
146
+ - spec/dummy/config/initializers/new_framework_defaults.rb
128
147
  - spec/dummy/config/initializers/session_store.rb
129
148
  - spec/dummy/config/initializers/wrap_parameters.rb
130
149
  - spec/dummy/config/locales/en.yml
150
+ - spec/dummy/config/puma.rb
131
151
  - spec/dummy/config/routes.rb
132
152
  - spec/dummy/config/secrets.yml
153
+ - spec/dummy/config/spring.rb
133
154
  - spec/dummy/log/development.log
134
- - spec/dummy/log/test.log
135
155
  - spec/dummy/public/404.html
136
156
  - spec/dummy/public/422.html
137
157
  - spec/dummy/public/500.html
158
+ - spec/dummy/public/apple-touch-icon-precomposed.png
159
+ - spec/dummy/public/apple-touch-icon.png
138
160
  - spec/dummy/public/favicon.ico
161
+ - spec/dummy/public/robots.txt
139
162
  - spec/govuk_notify_delivery/delivery_spec.rb
140
163
  - spec/mailers/notify_mailer_spec.rb
141
164
  - spec/spec_helper.rb
@@ -165,22 +188,32 @@ specification_version: 4
165
188
  summary: Custom ActionMailer delivery method for sending emails via GOV.UK Notify
166
189
  API
167
190
  test_files:
191
+ - spec/dummy/app/assets/config/manifest.js
168
192
  - spec/dummy/app/assets/javascripts/application.js
193
+ - spec/dummy/app/assets/javascripts/cable.js
169
194
  - spec/dummy/app/assets/stylesheets/application.css
170
195
  - spec/dummy/app/controllers/application_controller.rb
171
196
  - spec/dummy/app/helpers/application_helper.rb
197
+ - spec/dummy/app/jobs/application_job.rb
198
+ - spec/dummy/app/mailers/application_mailer.rb
172
199
  - spec/dummy/app/mailers/notify_mailer.rb
200
+ - spec/dummy/app/models/application_record.rb
173
201
  - spec/dummy/app/views/layouts/application.html.erb
202
+ - spec/dummy/app/views/layouts/mailer.html.erb
203
+ - spec/dummy/app/views/layouts/mailer.text.erb
174
204
  - spec/dummy/bin/bundle
175
205
  - spec/dummy/bin/rails
176
206
  - spec/dummy/bin/rake
177
207
  - spec/dummy/bin/setup
208
+ - spec/dummy/bin/spring
209
+ - spec/dummy/bin/update
178
210
  - spec/dummy/config/application.rb
179
211
  - spec/dummy/config/boot.rb
180
212
  - spec/dummy/config/environment.rb
181
213
  - spec/dummy/config/environments/development.rb
182
214
  - spec/dummy/config/environments/production.rb
183
215
  - spec/dummy/config/environments/test.rb
216
+ - spec/dummy/config/initializers/application_controller_renderer.rb
184
217
  - spec/dummy/config/initializers/assets.rb
185
218
  - spec/dummy/config/initializers/backtrace_silencers.rb
186
219
  - spec/dummy/config/initializers/cookies_serializer.rb
@@ -188,20 +221,25 @@ test_files:
188
221
  - spec/dummy/config/initializers/govuk_notify_rails.rb
189
222
  - spec/dummy/config/initializers/inflections.rb
190
223
  - spec/dummy/config/initializers/mime_types.rb
224
+ - spec/dummy/config/initializers/new_framework_defaults.rb
191
225
  - spec/dummy/config/initializers/session_store.rb
192
226
  - spec/dummy/config/initializers/wrap_parameters.rb
193
227
  - spec/dummy/config/locales/en.yml
228
+ - spec/dummy/config/puma.rb
194
229
  - spec/dummy/config/routes.rb
195
230
  - spec/dummy/config/secrets.yml
231
+ - spec/dummy/config/spring.rb
196
232
  - spec/dummy/config.ru
197
233
  - spec/dummy/log/development.log
198
- - spec/dummy/log/test.log
199
234
  - spec/dummy/public/404.html
200
235
  - spec/dummy/public/422.html
201
236
  - spec/dummy/public/500.html
237
+ - spec/dummy/public/apple-touch-icon-precomposed.png
238
+ - spec/dummy/public/apple-touch-icon.png
202
239
  - spec/dummy/public/favicon.ico
240
+ - spec/dummy/public/robots.txt
203
241
  - spec/dummy/Rakefile
204
- - spec/dummy/README.rdoc
242
+ - spec/dummy/README.md
205
243
  - spec/govuk_notify_delivery/delivery_spec.rb
206
244
  - spec/mailers/notify_mailer_spec.rb
207
245
  - spec/spec_helper.rb
@@ -1,6 +0,0 @@
1
- -----------------------------------
2
- GovukNotifyRailsTest: test_truth
3
- -----------------------------------
4
- -----------------------------------
5
- GovukNotifyRailsTest: test_truth
6
- -----------------------------------