hertz 0.1.0 → 1.0.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.
- checksums.yaml +4 -4
- data/README.md +14 -43
- data/lib/generators/hertz/templates/initializer.rb +0 -2
- data/lib/hertz/version.rb +1 -1
- data/lib/hertz.rb +0 -8
- data/spec/dummy/app/models/test_notification.rb +0 -5
- data/spec/dummy/config/database.yml +1 -10
- data/spec/dummy/config/initializers/hertz.rb +0 -2
- data/spec/dummy/db/migrate/20160508094342_remove_email_from_users.rb +5 -0
- data/spec/dummy/db/schema.rb +1 -2
- data/spec/dummy/log/development.log +28 -112
- data/spec/dummy/log/test.log +311 -2543
- data/spec/examples.txt +11 -13
- data/spec/factories/users.rb +0 -1
- data/spec/{lib/hertz → hertz}/notifiable_spec.rb +0 -0
- data/spec/{lib/hertz → hertz}/notification_deliverer_spec.rb +1 -1
- metadata +43 -51
- data/app/mailers/hertz/notification_mailer.rb +0 -24
- data/lib/hertz/courier/base.rb +0 -10
- data/lib/hertz/courier/email.rb +0 -10
- data/lib/tasks/hertz_tasks.rake +0 -4
- data/spec/dummy/app/mailers/application_mailer.rb +0 -2
- data/spec/lib/hertz/courier/email_spec.rb +0 -26
- data/spec/mailers/notification_mailer_spec.rb +0 -13
    
        data/spec/examples.txt
    CHANGED
    
    | @@ -1,13 +1,11 @@ | |
| 1 | 
            -
            example_id | 
| 2 | 
            -
             | 
| 3 | 
            -
            ./spec/ | 
| 4 | 
            -
            ./spec/ | 
| 5 | 
            -
            ./spec/ | 
| 6 | 
            -
            ./spec/ | 
| 7 | 
            -
            ./spec/ | 
| 8 | 
            -
            ./spec/models/hertz/notification_spec.rb[1: | 
| 9 | 
            -
            ./spec/models/hertz/notification_spec.rb[1: | 
| 10 | 
            -
            ./spec/models/hertz/notification_spec.rb[1: | 
| 11 | 
            -
            ./spec/models/hertz/notification_spec.rb[1: | 
| 12 | 
            -
            ./spec/models/hertz/notification_spec.rb[1:5:1]        | passed | 0.02096 seconds |
         | 
| 13 | 
            -
            ./spec/models/hertz/notification_spec.rb[1:6]          | passed | 0.00727 seconds |
         | 
| 1 | 
            +
            example_id                                         | status | run_time        |
         | 
| 2 | 
            +
            -------------------------------------------------- | ------ | --------------- |
         | 
| 3 | 
            +
            ./spec/hertz/notifiable_spec.rb[1:1:1]             | passed | 0.01387 seconds |
         | 
| 4 | 
            +
            ./spec/hertz/notifiable_spec.rb[1:2:1]             | passed | 0.0633 seconds  |
         | 
| 5 | 
            +
            ./spec/hertz/notification_deliverer_spec.rb[1:1:1] | passed | 0.01347 seconds |
         | 
| 6 | 
            +
            ./spec/models/hertz/notification_spec.rb[1:1:1]    | passed | 0.00661 seconds |
         | 
| 7 | 
            +
            ./spec/models/hertz/notification_spec.rb[1:2:1]    | passed | 0.00762 seconds |
         | 
| 8 | 
            +
            ./spec/models/hertz/notification_spec.rb[1:3:1]    | passed | 0.0372 seconds  |
         | 
| 9 | 
            +
            ./spec/models/hertz/notification_spec.rb[1:4:1]    | passed | 0.01552 seconds |
         | 
| 10 | 
            +
            ./spec/models/hertz/notification_spec.rb[1:5:1]    | passed | 0.01958 seconds |
         | 
| 11 | 
            +
            ./spec/models/hertz/notification_spec.rb[1:6]      | passed | 0.01646 seconds |
         | 
    
        data/spec/factories/users.rb
    CHANGED
    
    
| 
            File without changes
         | 
    
        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:  | 
| 4 | 
            +
              version: 1.0.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: 2016- | 
| 11 | 
            +
            date: 2016-05-08 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rails
         | 
| @@ -150,7 +150,6 @@ files: | |
| 150 150 | 
             
            - app/assets/stylesheets/hertz/application.css
         | 
| 151 151 | 
             
            - app/controllers/hertz/application_controller.rb
         | 
| 152 152 | 
             
            - app/helpers/hertz/application_helper.rb
         | 
| 153 | 
            -
            - app/mailers/hertz/notification_mailer.rb
         | 
| 154 153 | 
             
            - app/models/hertz/notification.rb
         | 
| 155 154 | 
             
            - app/views/layouts/hertz/application.html.erb
         | 
| 156 155 | 
             
            - config/routes.rb
         | 
| @@ -158,20 +157,16 @@ files: | |
| 158 157 | 
             
            - lib/generators/hertz/install_generator.rb
         | 
| 159 158 | 
             
            - lib/generators/hertz/templates/initializer.rb
         | 
| 160 159 | 
             
            - lib/hertz.rb
         | 
| 161 | 
            -
            - lib/hertz/courier/base.rb
         | 
| 162 | 
            -
            - lib/hertz/courier/email.rb
         | 
| 163 160 | 
             
            - lib/hertz/engine.rb
         | 
| 164 161 | 
             
            - lib/hertz/notifiable.rb
         | 
| 165 162 | 
             
            - lib/hertz/notification_deliverer.rb
         | 
| 166 163 | 
             
            - lib/hertz/version.rb
         | 
| 167 | 
            -
            - lib/tasks/hertz_tasks.rake
         | 
| 168 164 | 
             
            - spec/dummy/README.rdoc
         | 
| 169 165 | 
             
            - spec/dummy/Rakefile
         | 
| 170 166 | 
             
            - spec/dummy/app/assets/javascripts/application.js
         | 
| 171 167 | 
             
            - spec/dummy/app/assets/stylesheets/application.css
         | 
| 172 168 | 
             
            - spec/dummy/app/controllers/application_controller.rb
         | 
| 173 169 | 
             
            - spec/dummy/app/helpers/application_helper.rb
         | 
| 174 | 
            -
            - spec/dummy/app/mailers/application_mailer.rb
         | 
| 175 170 | 
             
            - spec/dummy/app/models/test_notification.rb
         | 
| 176 171 | 
             
            - spec/dummy/app/models/user.rb
         | 
| 177 172 | 
             
            - spec/dummy/app/views/hertz/notification_mailer/test_notification.html.erb
         | 
| @@ -204,6 +199,7 @@ files: | |
| 204 199 | 
             
            - spec/dummy/db/migrate/20160415175358_create_hertz_notifications.hertz.rb
         | 
| 205 200 | 
             
            - spec/dummy/db/migrate/20160415175837_create_users.rb
         | 
| 206 201 | 
             
            - spec/dummy/db/migrate/20160418122437_add_email_to_users.rb
         | 
| 202 | 
            +
            - spec/dummy/db/migrate/20160508094342_remove_email_from_users.rb
         | 
| 207 203 | 
             
            - spec/dummy/db/schema.rb
         | 
| 208 204 | 
             
            - spec/dummy/log/development.log
         | 
| 209 205 | 
             
            - spec/dummy/log/test.log
         | 
| @@ -214,10 +210,8 @@ files: | |
| 214 210 | 
             
            - spec/examples.txt
         | 
| 215 211 | 
             
            - spec/factories/hertz/notifications.rb
         | 
| 216 212 | 
             
            - spec/factories/users.rb
         | 
| 217 | 
            -
            - spec/ | 
| 218 | 
            -
            - spec/ | 
| 219 | 
            -
            - spec/lib/hertz/notification_deliverer_spec.rb
         | 
| 220 | 
            -
            - spec/mailers/notification_mailer_spec.rb
         | 
| 213 | 
            +
            - spec/hertz/notifiable_spec.rb
         | 
| 214 | 
            +
            - spec/hertz/notification_deliverer_spec.rb
         | 
| 221 215 | 
             
            - spec/models/hertz/notification_spec.rb
         | 
| 222 216 | 
             
            - spec/rails_helper.rb
         | 
| 223 217 | 
             
            - spec/spec_helper.rb
         | 
| @@ -248,61 +242,59 @@ signing_key: | |
| 248 242 | 
             
            specification_version: 4
         | 
| 249 243 | 
             
            summary: A Rails engine for in-app notifications.
         | 
| 250 244 | 
             
            test_files:
         | 
| 251 | 
            -
            - spec/ | 
| 252 | 
            -
            - spec/ | 
| 245 | 
            +
            - spec/spec_helper.rb
         | 
| 246 | 
            +
            - spec/hertz/notifiable_spec.rb
         | 
| 247 | 
            +
            - spec/hertz/notification_deliverer_spec.rb
         | 
| 253 248 | 
             
            - spec/factories/hertz/notifications.rb
         | 
| 254 249 | 
             
            - spec/factories/users.rb
         | 
| 255 | 
            -
            - spec/spec_helper.rb
         | 
| 256 | 
            -
            - spec/mailers/notification_mailer_spec.rb
         | 
| 257 | 
            -
            - spec/lib/hertz/notification_deliverer_spec.rb
         | 
| 258 | 
            -
            - spec/lib/hertz/courier/email_spec.rb
         | 
| 259 | 
            -
            - spec/lib/hertz/notifiable_spec.rb
         | 
| 260 | 
            -
            - spec/support/database_cleaner.rb
         | 
| 261 250 | 
             
            - spec/support/factory_girl.rb
         | 
| 251 | 
            +
            - spec/support/database_cleaner.rb
         | 
| 252 | 
            +
            - spec/models/hertz/notification_spec.rb
         | 
| 253 | 
            +
            - spec/examples.txt
         | 
| 262 254 | 
             
            - spec/rails_helper.rb
         | 
| 263 | 
            -
            - spec/dummy/public/404.html
         | 
| 264 | 
            -
            - spec/dummy/public/422.html
         | 
| 265 | 
            -
            - spec/dummy/public/500.html
         | 
| 266 | 
            -
            - spec/dummy/public/favicon.ico
         | 
| 267 | 
            -
            - spec/dummy/config.ru
         | 
| 268 | 
            -
            - spec/dummy/db/migrate/20160418122437_add_email_to_users.rb
         | 
| 269 | 
            -
            - spec/dummy/db/migrate/20160415175358_create_hertz_notifications.hertz.rb
         | 
| 270 255 | 
             
            - spec/dummy/db/migrate/20160415175837_create_users.rb
         | 
| 256 | 
            +
            - spec/dummy/db/migrate/20160508094342_remove_email_from_users.rb
         | 
| 257 | 
            +
            - spec/dummy/db/migrate/20160415175358_create_hertz_notifications.hertz.rb
         | 
| 258 | 
            +
            - spec/dummy/db/migrate/20160418122437_add_email_to_users.rb
         | 
| 271 259 | 
             
            - spec/dummy/db/schema.rb
         | 
| 272 | 
            -
            - spec/dummy/ | 
| 260 | 
            +
            - spec/dummy/bin/rake
         | 
| 261 | 
            +
            - spec/dummy/bin/rails
         | 
| 262 | 
            +
            - spec/dummy/bin/setup
         | 
| 263 | 
            +
            - spec/dummy/bin/bundle
         | 
| 264 | 
            +
            - spec/dummy/app/views/hertz/notification_mailer/test_notification.html.erb
         | 
| 265 | 
            +
            - spec/dummy/app/views/layouts/application.html.erb
         | 
| 273 266 | 
             
            - spec/dummy/app/models/user.rb
         | 
| 267 | 
            +
            - spec/dummy/app/models/test_notification.rb
         | 
| 268 | 
            +
            - spec/dummy/app/helpers/application_helper.rb
         | 
| 274 269 | 
             
            - spec/dummy/app/controllers/application_controller.rb
         | 
| 275 | 
            -
            - spec/dummy/app/mailers/application_mailer.rb
         | 
| 276 270 | 
             
            - spec/dummy/app/assets/stylesheets/application.css
         | 
| 277 271 | 
             
            - spec/dummy/app/assets/javascripts/application.js
         | 
| 278 | 
            -
            - spec/dummy/ | 
| 279 | 
            -
            - spec/dummy/ | 
| 280 | 
            -
            - spec/dummy/ | 
| 281 | 
            -
            - spec/dummy/ | 
| 282 | 
            -
            - spec/dummy/ | 
| 283 | 
            -
            - spec/dummy/config | 
| 284 | 
            -
            - spec/dummy/config/environments/test.rb
         | 
| 285 | 
            -
            - spec/dummy/config/secrets.yml
         | 
| 272 | 
            +
            - spec/dummy/public/422.html
         | 
| 273 | 
            +
            - spec/dummy/public/favicon.ico
         | 
| 274 | 
            +
            - spec/dummy/public/500.html
         | 
| 275 | 
            +
            - spec/dummy/public/404.html
         | 
| 276 | 
            +
            - spec/dummy/README.rdoc
         | 
| 277 | 
            +
            - spec/dummy/config.ru
         | 
| 286 278 | 
             
            - spec/dummy/config/boot.rb
         | 
| 287 | 
            -
            - spec/dummy/config/ | 
| 288 | 
            -
            - spec/dummy/config/application.rb
         | 
| 289 | 
            -
            - spec/dummy/config/environment.rb
         | 
| 290 | 
            -
            - spec/dummy/config/initializers/assets.rb
         | 
| 279 | 
            +
            - spec/dummy/config/initializers/inflections.rb
         | 
| 291 280 | 
             
            - spec/dummy/config/initializers/backtrace_silencers.rb
         | 
| 281 | 
            +
            - spec/dummy/config/initializers/cookies_serializer.rb
         | 
| 292 282 | 
             
            - spec/dummy/config/initializers/session_store.rb
         | 
| 293 | 
            -
            - spec/dummy/config/initializers/ | 
| 283 | 
            +
            - spec/dummy/config/initializers/assets.rb
         | 
| 294 284 | 
             
            - spec/dummy/config/initializers/wrap_parameters.rb
         | 
| 295 | 
            -
            - spec/dummy/config/initializers/ | 
| 296 | 
            -
            - spec/dummy/config/initializers/inflections.rb
         | 
| 297 | 
            -
            - spec/dummy/config/initializers/filter_parameter_logging.rb
         | 
| 285 | 
            +
            - spec/dummy/config/initializers/mime_types.rb
         | 
| 298 286 | 
             
            - spec/dummy/config/initializers/hertz.rb
         | 
| 299 | 
            -
            - spec/dummy/config/ | 
| 287 | 
            +
            - spec/dummy/config/initializers/filter_parameter_logging.rb
         | 
| 288 | 
            +
            - spec/dummy/config/application.rb
         | 
| 289 | 
            +
            - spec/dummy/config/secrets.yml
         | 
| 290 | 
            +
            - spec/dummy/config/environments/development.rb
         | 
| 291 | 
            +
            - spec/dummy/config/environments/production.rb
         | 
| 292 | 
            +
            - spec/dummy/config/environments/test.rb
         | 
| 300 293 | 
             
            - spec/dummy/config/locales/en.yml
         | 
| 294 | 
            +
            - spec/dummy/config/database.yml
         | 
| 295 | 
            +
            - spec/dummy/config/environment.rb
         | 
| 296 | 
            +
            - spec/dummy/config/database.example.yml
         | 
| 297 | 
            +
            - spec/dummy/config/routes.rb
         | 
| 298 | 
            +
            - spec/dummy/Rakefile
         | 
| 301 299 | 
             
            - spec/dummy/log/test.log
         | 
| 302 300 | 
             
            - spec/dummy/log/development.log
         | 
| 303 | 
            -
            - spec/dummy/Rakefile
         | 
| 304 | 
            -
            - spec/dummy/README.rdoc
         | 
| 305 | 
            -
            - spec/dummy/bin/rake
         | 
| 306 | 
            -
            - spec/dummy/bin/bundle
         | 
| 307 | 
            -
            - spec/dummy/bin/rails
         | 
| 308 | 
            -
            - spec/dummy/bin/setup
         | 
| @@ -1,24 +0,0 @@ | |
| 1 | 
            -
            # frozen_string_literal: true
         | 
| 2 | 
            -
            module Hertz
         | 
| 3 | 
            -
              class NotificationMailer < Hertz.base_mailer
         | 
| 4 | 
            -
                def notification_email(notification)
         | 
| 5 | 
            -
                  @notification = notification
         | 
| 6 | 
            -
             | 
| 7 | 
            -
                  mail(
         | 
| 8 | 
            -
                    to: notification.receiver.hertz_email,
         | 
| 9 | 
            -
                    subject: notification.email_subject,
         | 
| 10 | 
            -
                    template_name: view_for(notification)
         | 
| 11 | 
            -
                  )
         | 
| 12 | 
            -
                end
         | 
| 13 | 
            -
             | 
| 14 | 
            -
                private
         | 
| 15 | 
            -
             | 
| 16 | 
            -
                def view_for(notification)
         | 
| 17 | 
            -
                  if notification.respond_to?(:email_template)
         | 
| 18 | 
            -
                    notification.email_template
         | 
| 19 | 
            -
                  else
         | 
| 20 | 
            -
                    notification.class.to_s.underscore
         | 
| 21 | 
            -
                  end
         | 
| 22 | 
            -
                end
         | 
| 23 | 
            -
              end
         | 
| 24 | 
            -
            end
         | 
    
        data/lib/hertz/courier/base.rb
    DELETED
    
    
    
        data/lib/hertz/courier/email.rb
    DELETED
    
    
    
        data/lib/tasks/hertz_tasks.rake
    DELETED
    
    
| @@ -1,26 +0,0 @@ | |
| 1 | 
            -
            # frozen_string_literal: true
         | 
| 2 | 
            -
            module Hertz
         | 
| 3 | 
            -
              module Courier
         | 
| 4 | 
            -
                RSpec.describe Email do
         | 
| 5 | 
            -
                  subject { described_class }
         | 
| 6 | 
            -
             | 
| 7 | 
            -
                  describe '.deliver_notification' do
         | 
| 8 | 
            -
                    let(:notification) { instance_double('Hertz::Notification') }
         | 
| 9 | 
            -
                    let(:email) { instance_spy('ActionMailer::MessageDelivery') }
         | 
| 10 | 
            -
             | 
| 11 | 
            -
                    before(:each) do
         | 
| 12 | 
            -
                      allow(Hertz::NotificationMailer).to receive(:notification_email)
         | 
| 13 | 
            -
                        .with(notification)
         | 
| 14 | 
            -
                        .and_return(email)
         | 
| 15 | 
            -
                    end
         | 
| 16 | 
            -
             | 
| 17 | 
            -
                    it 'sends an email' do
         | 
| 18 | 
            -
                      subject.deliver_notification(notification)
         | 
| 19 | 
            -
             | 
| 20 | 
            -
                      expect(email).to have_received(:deliver_later)
         | 
| 21 | 
            -
                        .once
         | 
| 22 | 
            -
                    end
         | 
| 23 | 
            -
                  end
         | 
| 24 | 
            -
                end
         | 
| 25 | 
            -
              end
         | 
| 26 | 
            -
            end
         | 
| @@ -1,13 +0,0 @@ | |
| 1 | 
            -
            # frozen_string_literal: true
         | 
| 2 | 
            -
            module Hertz
         | 
| 3 | 
            -
              RSpec.describe NotificationMailer do
         | 
| 4 | 
            -
                describe '.notification_email' do
         | 
| 5 | 
            -
                  let(:notification) { build_stubbed(:test_notification) }
         | 
| 6 | 
            -
                  subject { described_class.notification_email(notification) }
         | 
| 7 | 
            -
             | 
| 8 | 
            -
                  it 'sends the email to the receiver' do
         | 
| 9 | 
            -
                    expect(subject.to).to eq([notification.receiver.email])
         | 
| 10 | 
            -
                  end
         | 
| 11 | 
            -
                end
         | 
| 12 | 
            -
              end
         | 
| 13 | 
            -
            end
         |