activity_notification 1.0.2 → 1.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.
- checksums.yaml +4 -4
 - data/.codeclimate.yml +33 -0
 - data/.rubocop.yml +1157 -0
 - data/.yardopts +3 -0
 - data/CHANGELOG.md +25 -0
 - data/Gemfile.lock +15 -17
 - data/README.md +154 -27
 - data/activity_notification.gemspec +1 -1
 - data/app/controllers/activity_notification/notifications_controller.rb +30 -104
 - data/app/controllers/activity_notification/notifications_with_devise_controller.rb +1 -33
 - data/app/controllers/activity_notification/subscriptions_controller.rb +184 -0
 - data/app/controllers/activity_notification/subscriptions_with_devise_controller.rb +6 -0
 - data/app/mailers/activity_notification/mailer.rb +3 -3
 - data/app/views/activity_notification/notifications/default/_index.html.erb +3 -0
 - data/app/views/activity_notification/notifications/default/index.html.erb +8 -10
 - data/app/views/activity_notification/notifications/default/show.html.erb +24 -2
 - data/app/views/activity_notification/subscriptions/default/_form.html.erb +52 -0
 - data/app/views/activity_notification/subscriptions/default/_notification_keys.html.erb +89 -0
 - data/app/views/activity_notification/subscriptions/default/_subscription.html.erb +73 -0
 - data/app/views/activity_notification/subscriptions/default/_subscriptions.html.erb +13 -0
 - data/app/views/activity_notification/subscriptions/default/create.js.erb +5 -0
 - data/app/views/activity_notification/subscriptions/default/destroy.js.erb +5 -0
 - data/app/views/activity_notification/subscriptions/default/index.html.erb +197 -0
 - data/app/views/activity_notification/subscriptions/default/show.html.erb +177 -0
 - data/app/views/activity_notification/subscriptions/default/subscribe.js.erb +8 -0
 - data/app/views/activity_notification/subscriptions/default/subscribe_to_email.js.erb +6 -0
 - data/app/views/activity_notification/subscriptions/default/unsubscribe.js.erb +8 -0
 - data/app/views/activity_notification/subscriptions/default/unsubscribe_to_email.js.erb +6 -0
 - data/gemfiles/Gemfile.rails-4.2.lock +18 -20
 - data/gemfiles/Gemfile.rails-5.0.lock +18 -20
 - data/lib/activity_notification.rb +7 -3
 - data/lib/activity_notification/apis/notification_api.rb +95 -61
 - data/lib/activity_notification/apis/subscription_api.rb +51 -0
 - data/lib/activity_notification/common.rb +1 -1
 - data/lib/activity_notification/config.rb +65 -17
 - data/lib/activity_notification/controllers/common_controller.rb +118 -0
 - data/lib/activity_notification/controllers/devise_authentication_controller.rb +41 -0
 - data/lib/activity_notification/helpers/view_helpers.rb +131 -3
 - data/lib/activity_notification/mailers/helpers.rb +6 -8
 - data/lib/activity_notification/models/concerns/notifiable.rb +45 -27
 - data/lib/activity_notification/models/concerns/subscriber.rb +149 -0
 - data/lib/activity_notification/models/concerns/target.rb +100 -66
 - data/lib/activity_notification/models/notification.rb +7 -5
 - data/lib/activity_notification/models/subscription.rb +93 -0
 - data/lib/activity_notification/rails/routes.rb +148 -33
 - data/lib/activity_notification/renderable.rb +3 -4
 - data/lib/activity_notification/roles/acts_as_notifiable.rb +14 -1
 - data/lib/activity_notification/roles/acts_as_target.rb +11 -8
 - data/lib/activity_notification/version.rb +1 -1
 - data/lib/generators/activity_notification/controllers_generator.rb +2 -2
 - data/lib/generators/activity_notification/install_generator.rb +0 -1
 - data/lib/generators/activity_notification/migration/migration_generator.rb +8 -2
 - data/lib/generators/activity_notification/models_generator.rb +53 -0
 - data/lib/generators/activity_notification/views_generator.rb +7 -7
 - data/lib/generators/templates/activity_notification.rb +17 -3
 - data/lib/generators/templates/controllers/notifications_controller.rb +18 -17
 - data/lib/generators/templates/controllers/notifications_with_devise_controller.rb +18 -17
 - data/lib/generators/templates/controllers/subscriptions_controller.rb +79 -0
 - data/lib/generators/templates/controllers/subscriptions_with_devise_controller.rb +87 -0
 - data/lib/generators/templates/migrations/migration.rb +57 -0
 - data/lib/generators/templates/models/README +10 -0
 - data/lib/generators/templates/{notification → models}/notification.rb +1 -3
 - data/lib/generators/templates/models/subscription.rb +4 -0
 - data/spec/concerns/apis/notification_api_spec.rb +48 -11
 - data/spec/concerns/apis/subscription_api_spec.rb +167 -0
 - data/spec/concerns/models/notifiable_spec.rb +60 -0
 - data/spec/concerns/models/subscriber_spec.rb +525 -0
 - data/spec/concerns/models/target_spec.rb +271 -42
 - data/spec/controllers/common_controller_spec.rb +25 -0
 - data/spec/controllers/dummy_common_controller.rb +5 -0
 - data/spec/controllers/notifications_controller_shared_examples.rb +2 -6
 - data/spec/controllers/subscriptions_controller_shared_examples.rb +735 -0
 - data/spec/controllers/subscriptions_controller_spec.rb +12 -0
 - data/spec/controllers/subscriptions_with_devise_controller_spec.rb +91 -0
 - data/spec/factories/dummy/dummy_subscriber.rb +4 -0
 - data/spec/factories/subscriptions.rb +8 -0
 - data/spec/generators/controllers_generator_spec.rb +25 -2
 - data/spec/generators/migration/migration_generator_spec.rb +3 -3
 - data/spec/generators/models_generator_spec.rb +96 -0
 - data/spec/generators/views_generator_spec.rb +84 -0
 - data/spec/helpers/view_helpers_spec.rb +143 -0
 - data/spec/mailers/mailer_spec.rb +5 -4
 - data/spec/models/dummy/dummy_subscriber_spec.rb +5 -0
 - data/spec/models/notification_spec.rb +7 -7
 - data/spec/models/subscription_spec.rb +158 -0
 - data/spec/rails_app/app/controllers/users/notifications_controller.rb +67 -0
 - data/spec/rails_app/app/controllers/users/notifications_with_devise_controller.rb +75 -0
 - data/spec/rails_app/app/controllers/users/subscriptions_controller.rb +79 -0
 - data/spec/rails_app/app/controllers/users/subscriptions_with_devise_controller.rb +87 -0
 - data/spec/rails_app/app/models/admin.rb +1 -0
 - data/spec/rails_app/app/models/dummy/dummy_subscriber.rb +4 -0
 - data/spec/rails_app/app/models/user.rb +2 -1
 - data/spec/rails_app/app/views/activity_notification/mailer/dummy_subscribers/test_key.text.erb +1 -0
 - data/spec/rails_app/app/views/articles/index.html.erb +6 -0
 - data/spec/rails_app/config/initializers/activity_notification.rb +17 -3
 - data/spec/rails_app/config/routes.rb +2 -2
 - data/spec/rails_app/db/migrate/20160715050420_create_activity_notification_tables.rb +33 -0
 - data/spec/rails_app/db/schema.rb +18 -0
 - data/spec/roles/acts_as_notifiable_spec.rb +1 -1
 - data/spec/roles/acts_as_target_spec.rb +1 -1
 - metadata +70 -11
 - data/lib/generators/activity_notification/notification/notification_generator.rb +0 -20
 - data/lib/generators/templates/active_record/migration.rb +0 -18
 - data/spec/generators/notification/notification_generator_spec.rb +0 -41
 - data/spec/rails_app/db/migrate/20160715050420_create_notifications.rb +0 -18
 
| 
         @@ -0,0 +1,12 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'controllers/subscriptions_controller_shared_examples'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            describe ActivityNotification::SubscriptionsController, type: :controller do
         
     | 
| 
      
 4 
     | 
    
         
            +
              let(:test_target)        { create(:user) }
         
     | 
| 
      
 5 
     | 
    
         
            +
              let(:target_type)        { :users }
         
     | 
| 
      
 6 
     | 
    
         
            +
              let(:typed_target_param) { :user_id }
         
     | 
| 
      
 7 
     | 
    
         
            +
              let(:extra_params)       { {} }
         
     | 
| 
      
 8 
     | 
    
         
            +
              let(:valid_session)      {}
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
              it_behaves_like :subscription_controller
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,91 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'controllers/subscriptions_controller_shared_examples'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            describe ActivityNotification::SubscriptionsWithDeviseController, type: :controller do
         
     | 
| 
      
 4 
     | 
    
         
            +
              let(:test_user)            { create(:confirmed_user) }
         
     | 
| 
      
 5 
     | 
    
         
            +
              let(:unauthenticated_user) { create(:confirmed_user) }
         
     | 
| 
      
 6 
     | 
    
         
            +
              let(:test_target)          { create(:admin, user: test_user) }
         
     | 
| 
      
 7 
     | 
    
         
            +
              let(:target_type)          { :admins }
         
     | 
| 
      
 8 
     | 
    
         
            +
              let(:typed_target_param)   { :admin_id }
         
     | 
| 
      
 9 
     | 
    
         
            +
              let(:extra_params)         { { devise_type: :users } }
         
     | 
| 
      
 10 
     | 
    
         
            +
              let(:valid_session)        {}
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
              context "signed in with devise as authenticated user" do
         
     | 
| 
      
 13 
     | 
    
         
            +
                before do
         
     | 
| 
      
 14 
     | 
    
         
            +
                  sign_in test_user
         
     | 
| 
      
 15 
     | 
    
         
            +
                end
         
     | 
| 
      
 16 
     | 
    
         
            +
              
         
     | 
| 
      
 17 
     | 
    
         
            +
                it_behaves_like :subscription_controller
         
     | 
| 
      
 18 
     | 
    
         
            +
              end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
              context "signed in with devise as unauthenticated user" do
         
     | 
| 
      
 21 
     | 
    
         
            +
                let(:target_params) { { target_type: target_type, devise_type: :users } }
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                describe "GET #index" do
         
     | 
| 
      
 24 
     | 
    
         
            +
                  before do
         
     | 
| 
      
 25 
     | 
    
         
            +
                    sign_in unauthenticated_user
         
     | 
| 
      
 26 
     | 
    
         
            +
                    get_with_compatibility :index, target_params.merge({ typed_target_param => test_target }), valid_session
         
     | 
| 
      
 27 
     | 
    
         
            +
                  end
         
     | 
| 
      
 28 
     | 
    
         
            +
              
         
     | 
| 
      
 29 
     | 
    
         
            +
                  it "returns 403 as http status code" do
         
     | 
| 
      
 30 
     | 
    
         
            +
                    expect(response.status).to eq(403)
         
     | 
| 
      
 31 
     | 
    
         
            +
                  end
         
     | 
| 
      
 32 
     | 
    
         
            +
                end
         
     | 
| 
      
 33 
     | 
    
         
            +
              end
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
              context "unsigned in with devise" do
         
     | 
| 
      
 36 
     | 
    
         
            +
                let(:target_params) { { target_type: target_type, devise_type: :users } }
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
                describe "GET #index" do
         
     | 
| 
      
 39 
     | 
    
         
            +
                  before do
         
     | 
| 
      
 40 
     | 
    
         
            +
                    get_with_compatibility :index, target_params.merge({ typed_target_param => test_target }), valid_session
         
     | 
| 
      
 41 
     | 
    
         
            +
                  end
         
     | 
| 
      
 42 
     | 
    
         
            +
              
         
     | 
| 
      
 43 
     | 
    
         
            +
                  it "returns 302 as http status code" do
         
     | 
| 
      
 44 
     | 
    
         
            +
                    expect(response.status).to eq(302)
         
     | 
| 
      
 45 
     | 
    
         
            +
                  end
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
                  it "redirects to sign_in path" do
         
     | 
| 
      
 48 
     | 
    
         
            +
                    expect(response).to redirect_to new_user_session_path
         
     | 
| 
      
 49 
     | 
    
         
            +
                  end
         
     | 
| 
      
 50 
     | 
    
         
            +
                end
         
     | 
| 
      
 51 
     | 
    
         
            +
              end
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
              context "without devise_type parameter" do
         
     | 
| 
      
 54 
     | 
    
         
            +
                let(:target_params) { { target_type: target_type } }
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
                describe "GET #index" do
         
     | 
| 
      
 57 
     | 
    
         
            +
                  before do
         
     | 
| 
      
 58 
     | 
    
         
            +
                    get_with_compatibility :index, target_params.merge({ typed_target_param => test_target }), valid_session
         
     | 
| 
      
 59 
     | 
    
         
            +
                  end
         
     | 
| 
      
 60 
     | 
    
         
            +
              
         
     | 
| 
      
 61 
     | 
    
         
            +
                  it "returns 400 as http status code" do
         
     | 
| 
      
 62 
     | 
    
         
            +
                    expect(response.status).to eq(400)
         
     | 
| 
      
 63 
     | 
    
         
            +
                  end
         
     | 
| 
      
 64 
     | 
    
         
            +
                end
         
     | 
| 
      
 65 
     | 
    
         
            +
              end
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
              context "with wrong devise_type parameter" do
         
     | 
| 
      
 68 
     | 
    
         
            +
                let(:target_params) { { target_type: target_type, devise_type: :dummy_targets } }
         
     | 
| 
      
 69 
     | 
    
         
            +
             
     | 
| 
      
 70 
     | 
    
         
            +
                describe "GET #index" do
         
     | 
| 
      
 71 
     | 
    
         
            +
                  before do
         
     | 
| 
      
 72 
     | 
    
         
            +
                    get_with_compatibility :index, target_params.merge({ typed_target_param => test_target }), valid_session
         
     | 
| 
      
 73 
     | 
    
         
            +
                  end
         
     | 
| 
      
 74 
     | 
    
         
            +
              
         
     | 
| 
      
 75 
     | 
    
         
            +
                  it "returns 403 as http status code" do
         
     | 
| 
      
 76 
     | 
    
         
            +
                    expect(response.status).to eq(403)
         
     | 
| 
      
 77 
     | 
    
         
            +
                  end
         
     | 
| 
      
 78 
     | 
    
         
            +
                end
         
     | 
| 
      
 79 
     | 
    
         
            +
              end
         
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
      
 81 
     | 
    
         
            +
              private
         
     | 
| 
      
 82 
     | 
    
         
            +
             
     | 
| 
      
 83 
     | 
    
         
            +
                def get_with_compatibility action, params, session
         
     | 
| 
      
 84 
     | 
    
         
            +
                  if Rails::VERSION::MAJOR <= 4
         
     | 
| 
      
 85 
     | 
    
         
            +
                    get action, params, session
         
     | 
| 
      
 86 
     | 
    
         
            +
                  else
         
     | 
| 
      
 87 
     | 
    
         
            +
                    get action, params: params, session: session
         
     | 
| 
      
 88 
     | 
    
         
            +
                  end
         
     | 
| 
      
 89 
     | 
    
         
            +
                end
         
     | 
| 
      
 90 
     | 
    
         
            +
             
     | 
| 
      
 91 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -38,11 +38,23 @@ describe ActivityNotification::Generators::ControllersGenerator, type: :generato 
     | 
|
| 
       38 
38 
     | 
    
         
             
                      it { is_expected.to exist }
         
     | 
| 
       39 
39 
     | 
    
         
             
                      it { is_expected.to contain(/class Users::NotificationsWithDeviseController < ActivityNotification::NotificationsWithDeviseController/) }
         
     | 
| 
       40 
40 
     | 
    
         
             
                    end
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
                    describe 'the subscriptions_controller' do
         
     | 
| 
      
 43 
     | 
    
         
            +
                      subject { file('app/controllers/users/subscriptions_controller.rb') }
         
     | 
| 
      
 44 
     | 
    
         
            +
                      it { is_expected.to exist }
         
     | 
| 
      
 45 
     | 
    
         
            +
                      it { is_expected.to contain(/class Users::SubscriptionsController < ActivityNotification::SubscriptionsController/) }
         
     | 
| 
      
 46 
     | 
    
         
            +
                    end
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
                    describe 'the subscriptions_with_devise_controller' do
         
     | 
| 
      
 49 
     | 
    
         
            +
                      subject { file('app/controllers/users/subscriptions_with_devise_controller.rb') }
         
     | 
| 
      
 50 
     | 
    
         
            +
                      it { is_expected.to exist }
         
     | 
| 
      
 51 
     | 
    
         
            +
                      it { is_expected.to contain(/class Users::SubscriptionsWithDeviseController < ActivityNotification::SubscriptionsWithDeviseController/) }
         
     | 
| 
      
 52 
     | 
    
         
            +
                    end
         
     | 
| 
       41 
53 
     | 
    
         
             
                  end
         
     | 
| 
       42 
54 
     | 
    
         | 
| 
       43 
     | 
    
         
            -
                  context 'with a controllers option as notifications' do
         
     | 
| 
      
 55 
     | 
    
         
            +
                  context 'with a controllers option as notifications and subscriptions' do
         
     | 
| 
       44 
56 
     | 
    
         
             
                    before do
         
     | 
| 
       45 
     | 
    
         
            -
                      run_generator %w(users --controllers notifications)
         
     | 
| 
      
 57 
     | 
    
         
            +
                      run_generator %w(users --controllers notifications subscriptions)
         
     | 
| 
       46 
58 
     | 
    
         
             
                    end
         
     | 
| 
       47 
59 
     | 
    
         | 
| 
       48 
60 
     | 
    
         
             
                    describe 'the notifications_controller' do
         
     | 
| 
         @@ -55,6 +67,17 @@ describe ActivityNotification::Generators::ControllersGenerator, type: :generato 
     | 
|
| 
       55 
67 
     | 
    
         
             
                      subject { file('app/controllers/users/notifications_with_devise_controller.rb') }
         
     | 
| 
       56 
68 
     | 
    
         
             
                      it { is_expected.not_to exist }
         
     | 
| 
       57 
69 
     | 
    
         
             
                    end
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
                    describe 'the subscriptions_controller' do
         
     | 
| 
      
 72 
     | 
    
         
            +
                      subject { file('app/controllers/users/subscriptions_controller.rb') }
         
     | 
| 
      
 73 
     | 
    
         
            +
                      it { is_expected.to exist }
         
     | 
| 
      
 74 
     | 
    
         
            +
                      it { is_expected.to contain(/class Users::SubscriptionsController < ActivityNotification::SubscriptionsController/) }
         
     | 
| 
      
 75 
     | 
    
         
            +
                    end
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
                    describe 'the subscriptions_with_devise_controller' do
         
     | 
| 
      
 78 
     | 
    
         
            +
                      subject { file('app/controllers/users/subscriptions_with_devise_controller.rb') }
         
     | 
| 
      
 79 
     | 
    
         
            +
                      it { is_expected.not_to exist }
         
     | 
| 
      
 80 
     | 
    
         
            +
                    end
         
     | 
| 
       58 
81 
     | 
    
         
             
                  end
         
     | 
| 
       59 
82 
     | 
    
         
             
                end
         
     | 
| 
       60 
83 
     | 
    
         | 
| 
         @@ -19,15 +19,15 @@ describe ActivityNotification::Generators::MigrationGenerator, type: :generator 
     | 
|
| 
       19 
19 
     | 
    
         
             
                  end
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
21 
     | 
    
         
             
                  describe 'CreateNotifications migration file' do
         
     | 
| 
       22 
     | 
    
         
            -
                    subject { file(Dir["tmp/db/migrate/* 
     | 
| 
      
 22 
     | 
    
         
            +
                    subject { file(Dir["tmp/db/migrate/*_create_activity_notification_tables.rb"].first.gsub!('tmp/', '')) }
         
     | 
| 
       23 
23 
     | 
    
         
             
                    it { is_expected.to exist }
         
     | 
| 
       24 
     | 
    
         
            -
                    it { is_expected.to contain(/class  
     | 
| 
      
 24 
     | 
    
         
            +
                    it { is_expected.to contain(/class CreateActivityNotificationTables < ActiveRecord::Migration/) }
         
     | 
| 
       25 
25 
     | 
    
         
             
                  end
         
     | 
| 
       26 
26 
     | 
    
         
             
                end
         
     | 
| 
       27 
27 
     | 
    
         | 
| 
       28 
28 
     | 
    
         
             
                context 'with CreateCustomNotifications as name argument' do
         
     | 
| 
       29 
29 
     | 
    
         
             
                  before do
         
     | 
| 
       30 
     | 
    
         
            -
                    run_generator %w(CreateCustomNotifications)
         
     | 
| 
      
 30 
     | 
    
         
            +
                    run_generator %w(CreateCustomNotifications --tables notifications)
         
     | 
| 
       31 
31 
     | 
    
         
             
                  end
         
     | 
| 
       32 
32 
     | 
    
         | 
| 
       33 
33 
     | 
    
         
             
                  describe 'CreateCustomNotifications migration file' do
         
     | 
| 
         @@ -0,0 +1,96 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'generators/activity_notification/models_generator'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            describe ActivityNotification::Generators::ModelsGenerator, type: :generator do
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
              # setup_default_destination
         
     | 
| 
      
 6 
     | 
    
         
            +
              destination File.expand_path("../../../tmp", __FILE__)
         
     | 
| 
      
 7 
     | 
    
         
            +
              before { prepare_destination }
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
              it 'runs generating model tasks' do
         
     | 
| 
      
 10 
     | 
    
         
            +
                gen = generator %w(users)
         
     | 
| 
      
 11 
     | 
    
         
            +
                expect(gen).to receive :create_models
         
     | 
| 
      
 12 
     | 
    
         
            +
                expect(gen).to receive(:readme).and_return(true)
         
     | 
| 
      
 13 
     | 
    
         
            +
                gen.invoke_all
         
     | 
| 
      
 14 
     | 
    
         
            +
              end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
              describe 'the generated files' do
         
     | 
| 
      
 17 
     | 
    
         
            +
                context 'without target argument' do
         
     | 
| 
      
 18 
     | 
    
         
            +
                  it 'raises Thor::RequiredArgumentMissingError' do
         
     | 
| 
      
 19 
     | 
    
         
            +
                    expect { run_generator }
         
     | 
| 
      
 20 
     | 
    
         
            +
                    .to raise_error(Thor::RequiredArgumentMissingError)
         
     | 
| 
      
 21 
     | 
    
         
            +
                  end
         
     | 
| 
      
 22 
     | 
    
         
            +
                end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                context 'with users as target' do
         
     | 
| 
      
 25 
     | 
    
         
            +
                  context 'with target models as default' do
         
     | 
| 
      
 26 
     | 
    
         
            +
                    before do
         
     | 
| 
      
 27 
     | 
    
         
            +
                      run_generator %w(users)
         
     | 
| 
      
 28 
     | 
    
         
            +
                    end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                    describe 'the notification' do
         
     | 
| 
      
 31 
     | 
    
         
            +
                      subject { file('app/models/users/notification.rb') }
         
     | 
| 
      
 32 
     | 
    
         
            +
                      it { is_expected.to exist }
         
     | 
| 
      
 33 
     | 
    
         
            +
                      it { is_expected.to contain(/class Users::Notification < ActivityNotification::Notification/) }
         
     | 
| 
      
 34 
     | 
    
         
            +
                    end
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                    describe 'the subscription' do
         
     | 
| 
      
 37 
     | 
    
         
            +
                      subject { file('app/models/users/subscription.rb') }
         
     | 
| 
      
 38 
     | 
    
         
            +
                      it { is_expected.to exist }
         
     | 
| 
      
 39 
     | 
    
         
            +
                      it { is_expected.to contain(/class Users::Subscription < ActivityNotification::Subscription/) }
         
     | 
| 
      
 40 
     | 
    
         
            +
                    end
         
     | 
| 
      
 41 
     | 
    
         
            +
                  end
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
                  context 'with a models option as notification' do
         
     | 
| 
      
 44 
     | 
    
         
            +
                    before do
         
     | 
| 
      
 45 
     | 
    
         
            +
                      run_generator %w(users --models notification)
         
     | 
| 
      
 46 
     | 
    
         
            +
                    end
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
                    describe 'the notification' do
         
     | 
| 
      
 49 
     | 
    
         
            +
                      subject { file('app/models/users/notification.rb') }
         
     | 
| 
      
 50 
     | 
    
         
            +
                      it { is_expected.to exist }
         
     | 
| 
      
 51 
     | 
    
         
            +
                      it { is_expected.to contain(/class Users::Notification < ActivityNotification::Notification/) }
         
     | 
| 
      
 52 
     | 
    
         
            +
                    end
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
                    describe 'the subscription' do
         
     | 
| 
      
 55 
     | 
    
         
            +
                      subject { file('app/models/users/subscription.rb') }
         
     | 
| 
      
 56 
     | 
    
         
            +
                      it { is_expected.not_to exist }
         
     | 
| 
      
 57 
     | 
    
         
            +
                    end
         
     | 
| 
      
 58 
     | 
    
         
            +
                  end
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
                  context 'with a names option as custom_notification and custom_subscription' do
         
     | 
| 
      
 61 
     | 
    
         
            +
                    before do
         
     | 
| 
      
 62 
     | 
    
         
            +
                      run_generator %w(users --names custom_notification custom_subscription)
         
     | 
| 
      
 63 
     | 
    
         
            +
                    end
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
                    describe 'the notification' do
         
     | 
| 
      
 66 
     | 
    
         
            +
                      subject { file('app/models/users/custom_notification.rb') }
         
     | 
| 
      
 67 
     | 
    
         
            +
                      it { is_expected.to exist }
         
     | 
| 
      
 68 
     | 
    
         
            +
                      it { is_expected.to contain(/class Users::CustomNotification < ActivityNotification::Notification/) }
         
     | 
| 
      
 69 
     | 
    
         
            +
                    end
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
                    describe 'the subscription' do
         
     | 
| 
      
 72 
     | 
    
         
            +
                      subject { file('app/models/users/custom_subscription.rb') }
         
     | 
| 
      
 73 
     | 
    
         
            +
                      it { is_expected.to exist }
         
     | 
| 
      
 74 
     | 
    
         
            +
                      it { is_expected.to contain(/class Users::CustomSubscription < ActivityNotification::Subscription/) }
         
     | 
| 
      
 75 
     | 
    
         
            +
                    end
         
     | 
| 
      
 76 
     | 
    
         
            +
                  end
         
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
      
 78 
     | 
    
         
            +
                  context 'with a models option as notification and a names option as custom_notification' do
         
     | 
| 
      
 79 
     | 
    
         
            +
                    before do
         
     | 
| 
      
 80 
     | 
    
         
            +
                      run_generator %w(users --models notification --names custom_notification)
         
     | 
| 
      
 81 
     | 
    
         
            +
                    end
         
     | 
| 
      
 82 
     | 
    
         
            +
             
     | 
| 
      
 83 
     | 
    
         
            +
                    describe 'the notification' do
         
     | 
| 
      
 84 
     | 
    
         
            +
                      subject { file('app/models/users/custom_notification.rb') }
         
     | 
| 
      
 85 
     | 
    
         
            +
                      it { is_expected.to exist }
         
     | 
| 
      
 86 
     | 
    
         
            +
                      it { is_expected.to contain(/class Users::CustomNotification < ActivityNotification::Notification/) }
         
     | 
| 
      
 87 
     | 
    
         
            +
                    end
         
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
      
 89 
     | 
    
         
            +
                    describe 'the subscription' do
         
     | 
| 
      
 90 
     | 
    
         
            +
                      subject { file('app/models/users/subscription.rb') }
         
     | 
| 
      
 91 
     | 
    
         
            +
                      it { is_expected.not_to exist }
         
     | 
| 
      
 92 
     | 
    
         
            +
                    end
         
     | 
| 
      
 93 
     | 
    
         
            +
                  end
         
     | 
| 
      
 94 
     | 
    
         
            +
                end
         
     | 
| 
      
 95 
     | 
    
         
            +
              end
         
     | 
| 
      
 96 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -57,10 +57,87 @@ describe ActivityNotification::Generators::ViewsGenerator, type: :generator do 
     | 
|
| 
       57 
57 
     | 
    
         
             
                    end
         
     | 
| 
       58 
58 
     | 
    
         | 
| 
       59 
59 
     | 
    
         
             
                    describe 'the mailer views' do
         
     | 
| 
      
 60 
     | 
    
         
            +
                      describe 'default/batch_default.html.erb' do
         
     | 
| 
      
 61 
     | 
    
         
            +
                        subject { file('app/views/activity_notification/mailer/default/batch_default.html.erb') }
         
     | 
| 
      
 62 
     | 
    
         
            +
                        it { is_expected.to exist }
         
     | 
| 
      
 63 
     | 
    
         
            +
                      end
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
                      describe 'default/batch_default.text.erb' do
         
     | 
| 
      
 66 
     | 
    
         
            +
                        subject { file('app/views/activity_notification/mailer/default/batch_default.text.erb') }
         
     | 
| 
      
 67 
     | 
    
         
            +
                        it { is_expected.to exist }
         
     | 
| 
      
 68 
     | 
    
         
            +
                      end
         
     | 
| 
      
 69 
     | 
    
         
            +
             
     | 
| 
       60 
70 
     | 
    
         
             
                      describe 'default/default.html.erb' do
         
     | 
| 
       61 
71 
     | 
    
         
             
                        subject { file('app/views/activity_notification/mailer/default/default.html.erb') }
         
     | 
| 
       62 
72 
     | 
    
         
             
                        it { is_expected.to exist }
         
     | 
| 
       63 
73 
     | 
    
         
             
                      end
         
     | 
| 
      
 74 
     | 
    
         
            +
             
     | 
| 
      
 75 
     | 
    
         
            +
                      describe 'default/default.text.erb' do
         
     | 
| 
      
 76 
     | 
    
         
            +
                        subject { file('app/views/activity_notification/mailer/default/default.text.erb') }
         
     | 
| 
      
 77 
     | 
    
         
            +
                        it { is_expected.to exist }
         
     | 
| 
      
 78 
     | 
    
         
            +
                      end
         
     | 
| 
      
 79 
     | 
    
         
            +
                    end
         
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
      
 81 
     | 
    
         
            +
                    describe 'the subscription views' do
         
     | 
| 
      
 82 
     | 
    
         
            +
                      describe 'default/_form.html.erb' do
         
     | 
| 
      
 83 
     | 
    
         
            +
                        subject { file('app/views/activity_notification/subscriptions/default/_form.html.erb') }
         
     | 
| 
      
 84 
     | 
    
         
            +
                        it { is_expected.to exist }
         
     | 
| 
      
 85 
     | 
    
         
            +
                      end
         
     | 
| 
      
 86 
     | 
    
         
            +
             
     | 
| 
      
 87 
     | 
    
         
            +
                      describe 'default/_notification_keys.html.erb' do
         
     | 
| 
      
 88 
     | 
    
         
            +
                        subject { file('app/views/activity_notification/subscriptions/default/_notification_keys.html.erb') }
         
     | 
| 
      
 89 
     | 
    
         
            +
                        it { is_expected.to exist }
         
     | 
| 
      
 90 
     | 
    
         
            +
                      end
         
     | 
| 
      
 91 
     | 
    
         
            +
             
     | 
| 
      
 92 
     | 
    
         
            +
                      describe 'default/_subscription.html.erb' do
         
     | 
| 
      
 93 
     | 
    
         
            +
                        subject { file('app/views/activity_notification/subscriptions/default/_subscription.html.erb') }
         
     | 
| 
      
 94 
     | 
    
         
            +
                        it { is_expected.to exist }
         
     | 
| 
      
 95 
     | 
    
         
            +
                      end
         
     | 
| 
      
 96 
     | 
    
         
            +
             
     | 
| 
      
 97 
     | 
    
         
            +
                      describe 'default/_subscriptions.html.erb' do
         
     | 
| 
      
 98 
     | 
    
         
            +
                        subject { file('app/views/activity_notification/subscriptions/default/_subscriptions.html.erb') }
         
     | 
| 
      
 99 
     | 
    
         
            +
                        it { is_expected.to exist }
         
     | 
| 
      
 100 
     | 
    
         
            +
                      end
         
     | 
| 
      
 101 
     | 
    
         
            +
             
     | 
| 
      
 102 
     | 
    
         
            +
                      describe 'default/create.js.erb' do
         
     | 
| 
      
 103 
     | 
    
         
            +
                        subject { file('app/views/activity_notification/subscriptions/default/create.js.erb') }
         
     | 
| 
      
 104 
     | 
    
         
            +
                        it { is_expected.to exist }
         
     | 
| 
      
 105 
     | 
    
         
            +
                      end
         
     | 
| 
      
 106 
     | 
    
         
            +
             
     | 
| 
      
 107 
     | 
    
         
            +
                      describe 'default/destroy.js.erb' do
         
     | 
| 
      
 108 
     | 
    
         
            +
                        subject { file('app/views/activity_notification/subscriptions/default/destroy.js.erb') }
         
     | 
| 
      
 109 
     | 
    
         
            +
                        it { is_expected.to exist }
         
     | 
| 
      
 110 
     | 
    
         
            +
                      end
         
     | 
| 
      
 111 
     | 
    
         
            +
             
     | 
| 
      
 112 
     | 
    
         
            +
                      describe 'default/index.html.erb' do
         
     | 
| 
      
 113 
     | 
    
         
            +
                        subject { file('app/views/activity_notification/subscriptions/default/index.html.erb') }
         
     | 
| 
      
 114 
     | 
    
         
            +
                        it { is_expected.to exist }
         
     | 
| 
      
 115 
     | 
    
         
            +
                      end
         
     | 
| 
      
 116 
     | 
    
         
            +
             
     | 
| 
      
 117 
     | 
    
         
            +
                      describe 'default/show.html.erb' do
         
     | 
| 
      
 118 
     | 
    
         
            +
                        subject { file('app/views/activity_notification/subscriptions/default/show.html.erb') }
         
     | 
| 
      
 119 
     | 
    
         
            +
                        it { is_expected.to exist }
         
     | 
| 
      
 120 
     | 
    
         
            +
                      end
         
     | 
| 
      
 121 
     | 
    
         
            +
             
     | 
| 
      
 122 
     | 
    
         
            +
                      describe 'default/subscribe_to_email.js.erb' do
         
     | 
| 
      
 123 
     | 
    
         
            +
                        subject { file('app/views/activity_notification/subscriptions/default/subscribe_to_email.js.erb') }
         
     | 
| 
      
 124 
     | 
    
         
            +
                        it { is_expected.to exist }
         
     | 
| 
      
 125 
     | 
    
         
            +
                      end
         
     | 
| 
      
 126 
     | 
    
         
            +
             
     | 
| 
      
 127 
     | 
    
         
            +
                      describe 'default/subscribe.js.erb' do
         
     | 
| 
      
 128 
     | 
    
         
            +
                        subject { file('app/views/activity_notification/subscriptions/default/subscribe.js.erb') }
         
     | 
| 
      
 129 
     | 
    
         
            +
                        it { is_expected.to exist }
         
     | 
| 
      
 130 
     | 
    
         
            +
                      end
         
     | 
| 
      
 131 
     | 
    
         
            +
             
     | 
| 
      
 132 
     | 
    
         
            +
                      describe 'default/unsubscribe_to_email.js.erb' do
         
     | 
| 
      
 133 
     | 
    
         
            +
                        subject { file('app/views/activity_notification/subscriptions/default/unsubscribe_to_email.js.erb') }
         
     | 
| 
      
 134 
     | 
    
         
            +
                        it { is_expected.to exist }
         
     | 
| 
      
 135 
     | 
    
         
            +
                      end
         
     | 
| 
      
 136 
     | 
    
         
            +
             
     | 
| 
      
 137 
     | 
    
         
            +
                      describe 'default/unsubscribe.js.erb' do
         
     | 
| 
      
 138 
     | 
    
         
            +
                        subject { file('app/views/activity_notification/subscriptions/default/unsubscribe.js.erb') }
         
     | 
| 
      
 139 
     | 
    
         
            +
                        it { is_expected.to exist }
         
     | 
| 
      
 140 
     | 
    
         
            +
                      end
         
     | 
| 
       64 
141 
     | 
    
         
             
                    end
         
     | 
| 
       65 
142 
     | 
    
         
             
                  end
         
     | 
| 
       66 
143 
     | 
    
         | 
| 
         @@ -104,6 +181,13 @@ describe ActivityNotification::Generators::ViewsGenerator, type: :generator do 
     | 
|
| 
       104 
181 
     | 
    
         
             
                        it { is_expected.to exist }
         
     | 
| 
       105 
182 
     | 
    
         
             
                      end
         
     | 
| 
       106 
183 
     | 
    
         
             
                    end
         
     | 
| 
      
 184 
     | 
    
         
            +
             
     | 
| 
      
 185 
     | 
    
         
            +
                    describe 'the subscription views' do
         
     | 
| 
      
 186 
     | 
    
         
            +
                      describe 'users/index.html.erb' do
         
     | 
| 
      
 187 
     | 
    
         
            +
                        subject { file('app/views/activity_notification/subscriptions/users/index.html.erb') }
         
     | 
| 
      
 188 
     | 
    
         
            +
                        it { is_expected.to exist }
         
     | 
| 
      
 189 
     | 
    
         
            +
                      end
         
     | 
| 
      
 190 
     | 
    
         
            +
                    end
         
     | 
| 
       107 
191 
     | 
    
         
             
                  end
         
     | 
| 
       108 
192 
     | 
    
         
             
                end
         
     | 
| 
       109 
193 
     | 
    
         | 
| 
         @@ -4,6 +4,9 @@ describe ActivityNotification::ViewHelpers, type: :helper do 
     | 
|
| 
       4 
4 
     | 
    
         
             
                create(:notification, target: create(:confirmed_user))
         
     | 
| 
       5 
5 
     | 
    
         
             
              }
         
     | 
| 
       6 
6 
     | 
    
         
             
              let(:target_user)          { notification.target }
         
     | 
| 
      
 7 
     | 
    
         
            +
              let(:subscription)         {
         
     | 
| 
      
 8 
     | 
    
         
            +
                create(:subscription, target: target_user, key: notification.key)
         
     | 
| 
      
 9 
     | 
    
         
            +
              }
         
     | 
| 
       7 
10 
     | 
    
         
             
              let(:notification_2)       {
         
     | 
| 
       8 
11 
     | 
    
         
             
                create(:notification, target: create(:confirmed_user))
         
     | 
| 
       9 
12 
     | 
    
         
             
              }
         
     | 
| 
         @@ -304,4 +307,144 @@ describe ActivityNotification::ViewHelpers, type: :helper do 
     | 
|
| 
       304 
307 
     | 
    
         
             
                end
         
     | 
| 
       305 
308 
     | 
    
         
             
              end
         
     | 
| 
       306 
309 
     | 
    
         | 
| 
      
 310 
     | 
    
         
            +
              describe '#subscriptions_path_for' do
         
     | 
| 
      
 311 
     | 
    
         
            +
                it "returns path for the subscription target" do
         
     | 
| 
      
 312 
     | 
    
         
            +
                  expect(subscriptions_path_for(target_user))
         
     | 
| 
      
 313 
     | 
    
         
            +
                    .to eq(user_subscriptions_path(target_user))
         
     | 
| 
      
 314 
     | 
    
         
            +
                end
         
     | 
| 
      
 315 
     | 
    
         
            +
              end
         
     | 
| 
      
 316 
     | 
    
         
            +
             
     | 
| 
      
 317 
     | 
    
         
            +
              describe '#subscription_path_for' do
         
     | 
| 
      
 318 
     | 
    
         
            +
                it "returns path for the subscription target" do
         
     | 
| 
      
 319 
     | 
    
         
            +
                  expect(subscription_path_for(subscription))
         
     | 
| 
      
 320 
     | 
    
         
            +
                    .to eq(user_subscription_path(target_user, subscription))
         
     | 
| 
      
 321 
     | 
    
         
            +
                end
         
     | 
| 
      
 322 
     | 
    
         
            +
              end
         
     | 
| 
      
 323 
     | 
    
         
            +
             
     | 
| 
      
 324 
     | 
    
         
            +
              describe '#subscribe_subscription_path_for' do
         
     | 
| 
      
 325 
     | 
    
         
            +
                it "returns path for the subscription target" do
         
     | 
| 
      
 326 
     | 
    
         
            +
                  expect(subscribe_subscription_path_for(subscription))
         
     | 
| 
      
 327 
     | 
    
         
            +
                    .to eq(subscribe_user_subscription_path(target_user, subscription))
         
     | 
| 
      
 328 
     | 
    
         
            +
                end
         
     | 
| 
      
 329 
     | 
    
         
            +
              end
         
     | 
| 
      
 330 
     | 
    
         
            +
             
     | 
| 
      
 331 
     | 
    
         
            +
              describe '#subscribe_path_for' do
         
     | 
| 
      
 332 
     | 
    
         
            +
                it "returns path for the subscription target" do
         
     | 
| 
      
 333 
     | 
    
         
            +
                  expect(subscribe_path_for(subscription))
         
     | 
| 
      
 334 
     | 
    
         
            +
                    .to eq(subscribe_user_subscription_path(target_user, subscription))
         
     | 
| 
      
 335 
     | 
    
         
            +
                end
         
     | 
| 
      
 336 
     | 
    
         
            +
              end
         
     | 
| 
      
 337 
     | 
    
         
            +
             
     | 
| 
      
 338 
     | 
    
         
            +
              describe '#unsubscribe_subscription_path_for' do
         
     | 
| 
      
 339 
     | 
    
         
            +
                it "returns path for the subscription target" do
         
     | 
| 
      
 340 
     | 
    
         
            +
                  expect(unsubscribe_subscription_path_for(subscription))
         
     | 
| 
      
 341 
     | 
    
         
            +
                    .to eq(unsubscribe_user_subscription_path(target_user, subscription))
         
     | 
| 
      
 342 
     | 
    
         
            +
                end
         
     | 
| 
      
 343 
     | 
    
         
            +
              end
         
     | 
| 
      
 344 
     | 
    
         
            +
             
     | 
| 
      
 345 
     | 
    
         
            +
              describe '#unsubscribe_path_for' do
         
     | 
| 
      
 346 
     | 
    
         
            +
                it "returns path for the subscription target" do
         
     | 
| 
      
 347 
     | 
    
         
            +
                  expect(unsubscribe_path_for(subscription))
         
     | 
| 
      
 348 
     | 
    
         
            +
                    .to eq(unsubscribe_user_subscription_path(target_user, subscription))
         
     | 
| 
      
 349 
     | 
    
         
            +
                end
         
     | 
| 
      
 350 
     | 
    
         
            +
              end
         
     | 
| 
      
 351 
     | 
    
         
            +
             
     | 
| 
      
 352 
     | 
    
         
            +
              describe '#subscribe_to_email_subscription_path_for' do
         
     | 
| 
      
 353 
     | 
    
         
            +
                it "returns path for the subscription target" do
         
     | 
| 
      
 354 
     | 
    
         
            +
                  expect(subscribe_to_email_subscription_path_for(subscription))
         
     | 
| 
      
 355 
     | 
    
         
            +
                    .to eq(subscribe_to_email_user_subscription_path(target_user, subscription))
         
     | 
| 
      
 356 
     | 
    
         
            +
                end
         
     | 
| 
      
 357 
     | 
    
         
            +
              end
         
     | 
| 
      
 358 
     | 
    
         
            +
             
     | 
| 
      
 359 
     | 
    
         
            +
              describe '#subscribe_to_email_path_for' do
         
     | 
| 
      
 360 
     | 
    
         
            +
                it "returns path for the subscription target" do
         
     | 
| 
      
 361 
     | 
    
         
            +
                  expect(subscribe_to_email_path_for(subscription))
         
     | 
| 
      
 362 
     | 
    
         
            +
                    .to eq(subscribe_to_email_user_subscription_path(target_user, subscription))
         
     | 
| 
      
 363 
     | 
    
         
            +
                end
         
     | 
| 
      
 364 
     | 
    
         
            +
              end
         
     | 
| 
      
 365 
     | 
    
         
            +
             
     | 
| 
      
 366 
     | 
    
         
            +
              describe '#unsubscribe_to_email_subscription_path_for' do
         
     | 
| 
      
 367 
     | 
    
         
            +
                it "returns path for the subscription target" do
         
     | 
| 
      
 368 
     | 
    
         
            +
                  expect(unsubscribe_to_email_subscription_path_for(subscription))
         
     | 
| 
      
 369 
     | 
    
         
            +
                    .to eq(unsubscribe_to_email_user_subscription_path(target_user, subscription))
         
     | 
| 
      
 370 
     | 
    
         
            +
                end
         
     | 
| 
      
 371 
     | 
    
         
            +
              end
         
     | 
| 
      
 372 
     | 
    
         
            +
             
     | 
| 
      
 373 
     | 
    
         
            +
              describe '#unsubscribe_to_email_path_for' do
         
     | 
| 
      
 374 
     | 
    
         
            +
                it "returns path for the subscription target" do
         
     | 
| 
      
 375 
     | 
    
         
            +
                  expect(unsubscribe_to_email_path_for(subscription))
         
     | 
| 
      
 376 
     | 
    
         
            +
                    .to eq(unsubscribe_to_email_user_subscription_path(target_user, subscription))
         
     | 
| 
      
 377 
     | 
    
         
            +
                end
         
     | 
| 
      
 378 
     | 
    
         
            +
              end
         
     | 
| 
      
 379 
     | 
    
         
            +
             
     | 
| 
      
 380 
     | 
    
         
            +
              describe '#subscriptions_url_for' do
         
     | 
| 
      
 381 
     | 
    
         
            +
                it "returns url for the subscription target" do
         
     | 
| 
      
 382 
     | 
    
         
            +
                  expect(subscriptions_url_for(target_user))
         
     | 
| 
      
 383 
     | 
    
         
            +
                    .to eq(user_subscriptions_url(target_user))
         
     | 
| 
      
 384 
     | 
    
         
            +
                end
         
     | 
| 
      
 385 
     | 
    
         
            +
              end
         
     | 
| 
      
 386 
     | 
    
         
            +
             
     | 
| 
      
 387 
     | 
    
         
            +
              describe '#subscription_url_for' do
         
     | 
| 
      
 388 
     | 
    
         
            +
                it "returns url for the subscription target" do
         
     | 
| 
      
 389 
     | 
    
         
            +
                  expect(subscription_url_for(subscription))
         
     | 
| 
      
 390 
     | 
    
         
            +
                    .to eq(user_subscription_url(target_user, subscription))
         
     | 
| 
      
 391 
     | 
    
         
            +
                end
         
     | 
| 
      
 392 
     | 
    
         
            +
              end
         
     | 
| 
      
 393 
     | 
    
         
            +
             
     | 
| 
      
 394 
     | 
    
         
            +
              describe '#subscribe_subscription_url_for' do
         
     | 
| 
      
 395 
     | 
    
         
            +
                it "returns url for the subscription target" do
         
     | 
| 
      
 396 
     | 
    
         
            +
                  expect(subscribe_subscription_url_for(subscription))
         
     | 
| 
      
 397 
     | 
    
         
            +
                    .to eq(subscribe_user_subscription_url(target_user, subscription))
         
     | 
| 
      
 398 
     | 
    
         
            +
                end
         
     | 
| 
      
 399 
     | 
    
         
            +
              end
         
     | 
| 
      
 400 
     | 
    
         
            +
             
     | 
| 
      
 401 
     | 
    
         
            +
              describe '#subscribe_url_for' do
         
     | 
| 
      
 402 
     | 
    
         
            +
                it "returns url for the subscription target" do
         
     | 
| 
      
 403 
     | 
    
         
            +
                  expect(subscribe_url_for(subscription))
         
     | 
| 
      
 404 
     | 
    
         
            +
                    .to eq(subscribe_user_subscription_url(target_user, subscription))
         
     | 
| 
      
 405 
     | 
    
         
            +
                end
         
     | 
| 
      
 406 
     | 
    
         
            +
              end
         
     | 
| 
      
 407 
     | 
    
         
            +
             
     | 
| 
      
 408 
     | 
    
         
            +
              describe '#unsubscribe_subscription_url_for' do
         
     | 
| 
      
 409 
     | 
    
         
            +
                it "returns url for the subscription target" do
         
     | 
| 
      
 410 
     | 
    
         
            +
                  expect(unsubscribe_subscription_url_for(subscription))
         
     | 
| 
      
 411 
     | 
    
         
            +
                    .to eq(unsubscribe_user_subscription_url(target_user, subscription))
         
     | 
| 
      
 412 
     | 
    
         
            +
                end
         
     | 
| 
      
 413 
     | 
    
         
            +
              end
         
     | 
| 
      
 414 
     | 
    
         
            +
             
     | 
| 
      
 415 
     | 
    
         
            +
              describe '#unsubscribe_url_for' do
         
     | 
| 
      
 416 
     | 
    
         
            +
                it "returns url for the subscription target" do
         
     | 
| 
      
 417 
     | 
    
         
            +
                  expect(unsubscribe_url_for(subscription))
         
     | 
| 
      
 418 
     | 
    
         
            +
                    .to eq(unsubscribe_user_subscription_url(target_user, subscription))
         
     | 
| 
      
 419 
     | 
    
         
            +
                end
         
     | 
| 
      
 420 
     | 
    
         
            +
              end
         
     | 
| 
      
 421 
     | 
    
         
            +
             
     | 
| 
      
 422 
     | 
    
         
            +
              describe '#subscribe_to_email_subscription_url_for' do
         
     | 
| 
      
 423 
     | 
    
         
            +
                it "returns url for the subscription target" do
         
     | 
| 
      
 424 
     | 
    
         
            +
                  expect(subscribe_to_email_subscription_url_for(subscription))
         
     | 
| 
      
 425 
     | 
    
         
            +
                    .to eq(subscribe_to_email_user_subscription_url(target_user, subscription))
         
     | 
| 
      
 426 
     | 
    
         
            +
                end
         
     | 
| 
      
 427 
     | 
    
         
            +
              end
         
     | 
| 
      
 428 
     | 
    
         
            +
             
     | 
| 
      
 429 
     | 
    
         
            +
              describe '#subscribe_to_email_url_for' do
         
     | 
| 
      
 430 
     | 
    
         
            +
                it "returns url for the subscription target" do
         
     | 
| 
      
 431 
     | 
    
         
            +
                  expect(subscribe_to_email_url_for(subscription))
         
     | 
| 
      
 432 
     | 
    
         
            +
                    .to eq(subscribe_to_email_user_subscription_url(target_user, subscription))
         
     | 
| 
      
 433 
     | 
    
         
            +
                end
         
     | 
| 
      
 434 
     | 
    
         
            +
              end
         
     | 
| 
      
 435 
     | 
    
         
            +
             
     | 
| 
      
 436 
     | 
    
         
            +
              describe '#unsubscribe_to_email_subscription_url_for' do
         
     | 
| 
      
 437 
     | 
    
         
            +
                it "returns url for the subscription target" do
         
     | 
| 
      
 438 
     | 
    
         
            +
                  expect(unsubscribe_to_email_subscription_url_for(subscription))
         
     | 
| 
      
 439 
     | 
    
         
            +
                    .to eq(unsubscribe_to_email_user_subscription_url(target_user, subscription))
         
     | 
| 
      
 440 
     | 
    
         
            +
                end
         
     | 
| 
      
 441 
     | 
    
         
            +
              end
         
     | 
| 
      
 442 
     | 
    
         
            +
             
     | 
| 
      
 443 
     | 
    
         
            +
              describe '#unsubscribe_to_email_url_for' do
         
     | 
| 
      
 444 
     | 
    
         
            +
                it "returns url for the subscription target" do
         
     | 
| 
      
 445 
     | 
    
         
            +
                  expect(unsubscribe_to_email_url_for(subscription))
         
     | 
| 
      
 446 
     | 
    
         
            +
                    .to eq(unsubscribe_to_email_user_subscription_url(target_user, subscription))
         
     | 
| 
      
 447 
     | 
    
         
            +
                end
         
     | 
| 
      
 448 
     | 
    
         
            +
              end
         
     | 
| 
      
 449 
     | 
    
         
            +
             
     | 
| 
       307 
450 
     | 
    
         
             
            end
         
     |