hertz 2.0.0 → 2.1.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 (71) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +17 -12
  3. data/app/models/hertz/notification.rb +1 -1
  4. data/config/routes.rb +2 -0
  5. data/db/migrate/20160415174901_create_hertz_notifications.rb +2 -0
  6. data/db/migrate/20160627084018_create_hertz_notification_deliveries.rb +2 -0
  7. data/db/migrate/20160628084342_rename_notification_deliveries_to_deliveries.rb +2 -0
  8. data/db/migrate/20200112143142_convert_notification_meta_to_jsonb.rb +14 -0
  9. data/lib/hertz/notifiable.rb +8 -8
  10. data/lib/hertz/version.rb +1 -1
  11. data/spec/examples.txt +21 -0
  12. data/spec/hertz/notifiable_spec.rb +1 -1
  13. data/spec/hertz/notification_deliverer_spec.rb +8 -12
  14. data/spec/{dummy/public/favicon.ico → internal/app/assets/config/manifest.js} +0 -0
  15. data/spec/{dummy → internal}/app/models/test_notification.rb +2 -0
  16. data/spec/{dummy → internal}/app/models/user.rb +2 -0
  17. data/spec/internal/config/database.yml +3 -0
  18. data/spec/internal/config/routes.rb +5 -0
  19. data/spec/internal/db/schema.rb +7 -0
  20. data/spec/internal/log/test.log +2425 -0
  21. data/spec/internal/public/favicon.ico +0 -0
  22. data/spec/models/hertz/notification_spec.rb +26 -5
  23. data/spec/spec_helper.rb +13 -0
  24. data/spec/support/database_cleaner.rb +4 -3
  25. data/spec/support/factory_bot.rb +2 -0
  26. data/spec/support/faker.rb +2 -0
  27. metadata +59 -107
  28. data/spec/dummy/README.rdoc +0 -28
  29. data/spec/dummy/Rakefile +0 -6
  30. data/spec/dummy/app/assets/javascripts/application.js +0 -13
  31. data/spec/dummy/app/assets/stylesheets/application.css +0 -15
  32. data/spec/dummy/app/controllers/application_controller.rb +0 -5
  33. data/spec/dummy/app/helpers/application_helper.rb +0 -2
  34. data/spec/dummy/app/views/hertz/notification_mailer/test_notification.html.erb +0 -1
  35. data/spec/dummy/app/views/layouts/application.html.erb +0 -14
  36. data/spec/dummy/bin/bundle +0 -3
  37. data/spec/dummy/bin/rails +0 -4
  38. data/spec/dummy/bin/rake +0 -4
  39. data/spec/dummy/bin/setup +0 -29
  40. data/spec/dummy/config.ru +0 -4
  41. data/spec/dummy/config/application.rb +0 -22
  42. data/spec/dummy/config/boot.rb +0 -5
  43. data/spec/dummy/config/database.example.yml +0 -19
  44. data/spec/dummy/config/database.travis.yml +0 -4
  45. data/spec/dummy/config/environment.rb +0 -5
  46. data/spec/dummy/config/environments/development.rb +0 -41
  47. data/spec/dummy/config/environments/production.rb +0 -79
  48. data/spec/dummy/config/environments/test.rb +0 -42
  49. data/spec/dummy/config/initializers/assets.rb +0 -11
  50. data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
  51. data/spec/dummy/config/initializers/cookies_serializer.rb +0 -3
  52. data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  53. data/spec/dummy/config/initializers/hertz.rb +0 -2
  54. data/spec/dummy/config/initializers/inflections.rb +0 -16
  55. data/spec/dummy/config/initializers/mime_types.rb +0 -4
  56. data/spec/dummy/config/initializers/session_store.rb +0 -3
  57. data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
  58. data/spec/dummy/config/locales/en.yml +0 -23
  59. data/spec/dummy/config/routes.rb +0 -4
  60. data/spec/dummy/config/secrets.yml +0 -22
  61. data/spec/dummy/db/migrate/20160415175358_create_hertz_notifications.hertz.rb +0 -15
  62. data/spec/dummy/db/migrate/20160415175837_create_users.rb +0 -8
  63. data/spec/dummy/db/migrate/20160418122437_add_email_to_users.rb +0 -5
  64. data/spec/dummy/db/migrate/20160508094342_remove_email_from_users.rb +0 -5
  65. data/spec/dummy/db/migrate/20160627084119_create_hertz_notification_deliveries.hertz.rb +0 -13
  66. data/spec/dummy/db/migrate/20160628084413_rename_notification_deliveries_to_deliveries.hertz.rb +0 -6
  67. data/spec/dummy/db/schema.rb +0 -44
  68. data/spec/dummy/public/404.html +0 -67
  69. data/spec/dummy/public/422.html +0 -67
  70. data/spec/dummy/public/500.html +0 -66
  71. data/spec/rails_helper.rb +0 -21
File without changes
@@ -81,11 +81,32 @@ RSpec.describe Hertz::Notification do
81
81
  end
82
82
  end
83
83
 
84
- it 'delivers itself upon creation' do
85
- expect(Hertz::NotificationDeliverer).to receive(:deliver)
86
- .with(subject)
87
- .once
84
+ describe '.deliver' do
85
+ it 'delivers itself upon creation' do
86
+ expect(Hertz::NotificationDeliverer).to receive(:deliver)
87
+ .with(subject)
88
+ .once
88
89
 
89
- subject.save!
90
+ subject.save!
91
+ end
92
+
93
+ context 'when updating' do
94
+ subject { create(:notification) }
95
+
96
+ it 'delivers itself upon update' do
97
+ expect(Hertz::NotificationDeliverer).to receive(:deliver)
98
+ .with(subject)
99
+ .once
100
+
101
+ subject.save!
102
+ end
103
+ end
104
+
105
+ it "doesn't deliver itself upon destruction" do
106
+ expect(Hertz::NotificationDeliverer).not_to receive(:deliver)
107
+ .with(subject)
108
+
109
+ subject.destroy!
110
+ end
90
111
  end
91
112
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file was generated by the `rails generate rspec:install` command. Conventionally, all
2
4
  # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
5
  # The generated `.rspec` file contains `--require spec_helper` which will cause
@@ -19,6 +21,15 @@
19
21
  require 'coveralls'
20
22
  Coveralls.wear!
21
23
 
24
+ require 'combustion'
25
+ Combustion.initialize! :all
26
+
27
+ require 'rspec/rails'
28
+ require 'hertz'
29
+
30
+ # Load RSpec helpers.
31
+ Dir[File.expand_path('spec/support/**/*.rb')].sort.each { |f| require f }
32
+
22
33
  RSpec.configure do |config|
23
34
  # rspec-expectations config goes here. You can use an alternate
24
35
  # assertion/expectation library such as wrong or the stdlib/minitest
@@ -73,4 +84,6 @@ RSpec.configure do |config|
73
84
  # test failures related to randomization by passing the same `--seed` value
74
85
  # as the one that triggered the failure.
75
86
  Kernel.srand config.seed
87
+
88
+ config.infer_spec_type_from_file_location!
76
89
  end
@@ -1,17 +1,18 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'database_cleaner'
2
4
 
3
5
  RSpec.configure do |config|
4
6
  config.before(:suite) do
5
7
  DatabaseCleaner.clean_with(:truncation,
6
- except: %w[spatial_ref_sys schema_migrations]
7
- )
8
+ except: %w[spatial_ref_sys schema_migrations])
8
9
  end
9
10
 
10
11
  config.before(:each) { DatabaseCleaner.strategy = :truncation }
11
12
 
12
13
  config.before(:each, js: true) do
13
14
  DatabaseCleaner.strategy = :truncation,
14
- { except: %w[spatial_ref_sys schema_migrations] }
15
+ { except: %w[spatial_ref_sys schema_migrations] }
15
16
  end
16
17
 
17
18
  config.before(:each) { DatabaseCleaner.start }
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'factory_bot_rails'
2
4
 
3
5
  RSpec.configure do |config|
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'faker'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hertz
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alessandro Desantis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-25 00:00:00.000000000 Z
11
+ date: 2020-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,20 +16,34 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 4.0.0
19
+ version: 5.2.0
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: 6.0.0
22
+ version: '7'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: 4.0.0
29
+ version: 5.2.0
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: 6.0.0
32
+ version: '7'
33
+ - !ruby/object:Gem::Dependency
34
+ name: combustion
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
33
47
  - !ruby/object:Gem::Dependency
34
48
  name: coveralls
35
49
  requirement: !ruby/object:Gem::Requirement
@@ -100,20 +114,34 @@ dependencies:
100
114
  - - ">="
101
115
  - !ruby/object:Gem::Version
102
116
  version: '0'
117
+ - !ruby/object:Gem::Dependency
118
+ name: gem-release
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ type: :development
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
103
131
  - !ruby/object:Gem::Dependency
104
132
  name: pg
105
133
  requirement: !ruby/object:Gem::Requirement
106
134
  requirements:
107
- - - "~>"
135
+ - - ">="
108
136
  - !ruby/object:Gem::Version
109
- version: '0.21'
137
+ version: '0'
110
138
  type: :development
111
139
  prerelease: false
112
140
  version_requirements: !ruby/object:Gem::Requirement
113
141
  requirements:
114
- - - "~>"
142
+ - - ">="
115
143
  - !ruby/object:Gem::Version
116
- version: '0.21'
144
+ version: '0'
117
145
  - !ruby/object:Gem::Dependency
118
146
  name: rspec-rails
119
147
  requirement: !ruby/object:Gem::Requirement
@@ -172,6 +200,7 @@ files:
172
200
  - db/migrate/20160415174901_create_hertz_notifications.rb
173
201
  - db/migrate/20160627084018_create_hertz_notification_deliveries.rb
174
202
  - db/migrate/20160628084342_rename_notification_deliveries_to_deliveries.rb
203
+ - db/migrate/20200112143142_convert_notification_meta_to_jsonb.rb
175
204
  - lib/generators/hertz/install_generator.rb
176
205
  - lib/generators/hertz/templates/initializer.rb
177
206
  - lib/hertz.rb
@@ -179,65 +208,27 @@ files:
179
208
  - lib/hertz/notifiable.rb
180
209
  - lib/hertz/notification_deliverer.rb
181
210
  - lib/hertz/version.rb
182
- - spec/dummy/README.rdoc
183
- - spec/dummy/Rakefile
184
- - spec/dummy/app/assets/javascripts/application.js
185
- - spec/dummy/app/assets/stylesheets/application.css
186
- - spec/dummy/app/controllers/application_controller.rb
187
- - spec/dummy/app/helpers/application_helper.rb
188
- - spec/dummy/app/models/test_notification.rb
189
- - spec/dummy/app/models/user.rb
190
- - spec/dummy/app/views/hertz/notification_mailer/test_notification.html.erb
191
- - spec/dummy/app/views/layouts/application.html.erb
192
- - spec/dummy/bin/bundle
193
- - spec/dummy/bin/rails
194
- - spec/dummy/bin/rake
195
- - spec/dummy/bin/setup
196
- - spec/dummy/config.ru
197
- - spec/dummy/config/application.rb
198
- - spec/dummy/config/boot.rb
199
- - spec/dummy/config/database.example.yml
200
- - spec/dummy/config/database.travis.yml
201
- - spec/dummy/config/environment.rb
202
- - spec/dummy/config/environments/development.rb
203
- - spec/dummy/config/environments/production.rb
204
- - spec/dummy/config/environments/test.rb
205
- - spec/dummy/config/initializers/assets.rb
206
- - spec/dummy/config/initializers/backtrace_silencers.rb
207
- - spec/dummy/config/initializers/cookies_serializer.rb
208
- - spec/dummy/config/initializers/filter_parameter_logging.rb
209
- - spec/dummy/config/initializers/hertz.rb
210
- - spec/dummy/config/initializers/inflections.rb
211
- - spec/dummy/config/initializers/mime_types.rb
212
- - spec/dummy/config/initializers/session_store.rb
213
- - spec/dummy/config/initializers/wrap_parameters.rb
214
- - spec/dummy/config/locales/en.yml
215
- - spec/dummy/config/routes.rb
216
- - spec/dummy/config/secrets.yml
217
- - spec/dummy/db/migrate/20160415175358_create_hertz_notifications.hertz.rb
218
- - spec/dummy/db/migrate/20160415175837_create_users.rb
219
- - spec/dummy/db/migrate/20160418122437_add_email_to_users.rb
220
- - spec/dummy/db/migrate/20160508094342_remove_email_from_users.rb
221
- - spec/dummy/db/migrate/20160627084119_create_hertz_notification_deliveries.hertz.rb
222
- - spec/dummy/db/migrate/20160628084413_rename_notification_deliveries_to_deliveries.hertz.rb
223
- - spec/dummy/db/schema.rb
224
- - spec/dummy/public/404.html
225
- - spec/dummy/public/422.html
226
- - spec/dummy/public/500.html
227
- - spec/dummy/public/favicon.ico
211
+ - spec/examples.txt
228
212
  - spec/factories/hertz/deliveries.rb
229
213
  - spec/factories/hertz/notifications.rb
230
214
  - spec/factories/users.rb
231
215
  - spec/hertz/hertz_spec.rb
232
216
  - spec/hertz/notifiable_spec.rb
233
217
  - spec/hertz/notification_deliverer_spec.rb
218
+ - spec/internal/app/assets/config/manifest.js
219
+ - spec/internal/app/models/test_notification.rb
220
+ - spec/internal/app/models/user.rb
221
+ - spec/internal/config/database.yml
222
+ - spec/internal/config/routes.rb
223
+ - spec/internal/db/schema.rb
224
+ - spec/internal/log/test.log
225
+ - spec/internal/public/favicon.ico
234
226
  - spec/models/hertz/notification_spec.rb
235
- - spec/rails_helper.rb
236
227
  - spec/spec_helper.rb
237
228
  - spec/support/database_cleaner.rb
238
229
  - spec/support/factory_bot.rb
239
230
  - spec/support/faker.rb
240
- homepage: https://github.com/alessandro1997/hertz
231
+ homepage: https://github.com/aldesantis/hertz
241
232
  licenses:
242
233
  - MIT
243
234
  metadata: {}
@@ -256,62 +247,24 @@ required_rubygems_version: !ruby/object:Gem::Requirement
256
247
  - !ruby/object:Gem::Version
257
248
  version: '0'
258
249
  requirements: []
259
- rubyforge_project:
260
- rubygems_version: 2.7.7
250
+ rubygems_version: 3.1.2
261
251
  signing_key:
262
252
  specification_version: 4
263
253
  summary: A Rails engine for in-app notifications.
264
254
  test_files:
265
255
  - spec/spec_helper.rb
266
- - spec/dummy/app/models/test_notification.rb
267
- - spec/dummy/app/models/user.rb
268
- - spec/dummy/app/controllers/application_controller.rb
269
- - spec/dummy/app/views/hertz/notification_mailer/test_notification.html.erb
270
- - spec/dummy/app/views/layouts/application.html.erb
271
- - spec/dummy/app/assets/javascripts/application.js
272
- - spec/dummy/app/assets/stylesheets/application.css
273
- - spec/dummy/app/helpers/application_helper.rb
274
- - spec/dummy/bin/rake
275
- - spec/dummy/bin/setup
276
- - spec/dummy/bin/bundle
277
- - spec/dummy/bin/rails
278
- - spec/dummy/config/secrets.yml
279
- - spec/dummy/config/routes.rb
280
- - spec/dummy/config/locales/en.yml
281
- - spec/dummy/config/database.example.yml
282
- - spec/dummy/config/environments/production.rb
283
- - spec/dummy/config/environments/development.rb
284
- - spec/dummy/config/environments/test.rb
285
- - spec/dummy/config/database.travis.yml
286
- - spec/dummy/config/environment.rb
287
- - spec/dummy/config/application.rb
288
- - spec/dummy/config/boot.rb
289
- - spec/dummy/config/initializers/backtrace_silencers.rb
290
- - spec/dummy/config/initializers/mime_types.rb
291
- - spec/dummy/config/initializers/filter_parameter_logging.rb
292
- - spec/dummy/config/initializers/session_store.rb
293
- - spec/dummy/config/initializers/wrap_parameters.rb
294
- - spec/dummy/config/initializers/assets.rb
295
- - spec/dummy/config/initializers/cookies_serializer.rb
296
- - spec/dummy/config/initializers/hertz.rb
297
- - spec/dummy/config/initializers/inflections.rb
298
- - spec/dummy/config.ru
299
- - spec/dummy/Rakefile
300
- - spec/dummy/public/favicon.ico
301
- - spec/dummy/public/422.html
302
- - spec/dummy/public/500.html
303
- - spec/dummy/public/404.html
304
- - spec/dummy/db/schema.rb
305
- - spec/dummy/db/migrate/20160508094342_remove_email_from_users.rb
306
- - spec/dummy/db/migrate/20160628084413_rename_notification_deliveries_to_deliveries.hertz.rb
307
- - spec/dummy/db/migrate/20160418122437_add_email_to_users.rb
308
- - spec/dummy/db/migrate/20160415175837_create_users.rb
309
- - spec/dummy/db/migrate/20160415175358_create_hertz_notifications.hertz.rb
310
- - spec/dummy/db/migrate/20160627084119_create_hertz_notification_deliveries.hertz.rb
311
- - spec/dummy/README.rdoc
256
+ - spec/examples.txt
312
257
  - spec/hertz/notifiable_spec.rb
313
258
  - spec/hertz/notification_deliverer_spec.rb
314
259
  - spec/hertz/hertz_spec.rb
260
+ - spec/internal/app/models/test_notification.rb
261
+ - spec/internal/app/models/user.rb
262
+ - spec/internal/app/assets/config/manifest.js
263
+ - spec/internal/config/routes.rb
264
+ - spec/internal/config/database.yml
265
+ - spec/internal/public/favicon.ico
266
+ - spec/internal/db/schema.rb
267
+ - spec/internal/log/test.log
315
268
  - spec/models/hertz/notification_spec.rb
316
269
  - spec/support/factory_bot.rb
317
270
  - spec/support/faker.rb
@@ -319,4 +272,3 @@ test_files:
319
272
  - spec/factories/hertz/deliveries.rb
320
273
  - spec/factories/hertz/notifications.rb
321
274
  - spec/factories/users.rb
322
- - spec/rails_helper.rb
@@ -1,28 +0,0 @@
1
- == README
2
-
3
- This README would normally document whatever steps are necessary to get the
4
- application up and running.
5
-
6
- Things you may want to cover:
7
-
8
- * Ruby version
9
-
10
- * System dependencies
11
-
12
- * Configuration
13
-
14
- * Database creation
15
-
16
- * Database initialization
17
-
18
- * How to run the test suite
19
-
20
- * Services (job queues, cache servers, search engines, etc.)
21
-
22
- * Deployment instructions
23
-
24
- * ...
25
-
26
-
27
- Please feel free to use a different markup language if you do not plan to run
28
- <tt>rake doc:app</tt>.
@@ -1,6 +0,0 @@
1
- # Add your own tasks in files placed in lib/tasks ending in .rake,
2
- # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
-
4
- require File.expand_path('../config/application', __FILE__)
5
-
6
- Rails.application.load_tasks
@@ -1,13 +0,0 @@
1
- // This is a manifest file that'll be compiled into application.js, which will include all the files
2
- // listed below.
3
- //
4
- // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
- // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
- //
7
- // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
- // compiled file.
9
- //
10
- // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
- // about supported directives.
12
- //
13
- //= require_tree .
@@ -1,15 +0,0 @@
1
- /*
2
- * This is a manifest file that'll be compiled into application.css, which will include all the files
3
- * listed below.
4
- *
5
- * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
- *
8
- * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
- * compiled file so the styles you add here take precedence over styles defined in any styles
10
- * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
- * file per style scope.
12
- *
13
- *= require_tree .
14
- *= require_self
15
- */
@@ -1,5 +0,0 @@
1
- class ApplicationController < ActionController::Base
2
- # Prevent CSRF attacks by raising an exception.
3
- # For APIs, you may want to use :null_session instead.
4
- protect_from_forgery with: :exception
5
- end
@@ -1,2 +0,0 @@
1
- module ApplicationHelper
2
- end
@@ -1 +0,0 @@
1
- <p>This is a test notification!</p>
@@ -1,14 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Dummy</title>
5
- <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
6
- <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7
- <%= csrf_meta_tags %>
8
- </head>
9
- <body>
10
-
11
- <%= yield %>
12
-
13
- </body>
14
- </html>