activity_notification 2.4.0 → 2.5.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 +25 -29
- data/app/jobs/activity_notification/cascading_notification_job.rb +123 -0
- data/docs/Functions.md +202 -12
- data/docs/Setup.md +34 -2
- data/docs/Testing.md +12 -1
- data/lib/activity_notification/apis/cascading_notification_api.rb +208 -0
- data/lib/activity_notification/apis/notification_api.rb +3 -0
- data/lib/activity_notification/config.rb +10 -0
- data/lib/activity_notification/mailers/helpers.rb +27 -1
- data/lib/activity_notification/models/concerns/swagger/subscription_schema.rb +1 -1
- data/lib/activity_notification/version.rb +1 -1
- data/lib/generators/templates/activity_notification.rb +8 -0
- metadata +45 -481
- data/.codeclimate.yml +0 -33
- data/.coveralls.yml +0 -1
- data/.github/ISSUE_TEMPLATE/bug_report.md +0 -22
- data/.github/ISSUE_TEMPLATE/feature_request.md +0 -17
- data/.github/pull_request_template.md +0 -13
- data/.github/workflows/build.yml +0 -101
- data/.gitignore +0 -74
- data/.rspec +0 -3
- data/.rubocop.yml +0 -1157
- data/.yardopts +0 -6
- data/CHANGELOG.md +0 -439
- data/Gemfile +0 -31
- data/Procfile +0 -2
- data/Rakefile +0 -28
- data/activity_notification.gemspec +0 -44
- data/ai-curated-specs/issues/172/design.md +0 -220
- data/ai-curated-specs/issues/172/tasks.md +0 -326
- data/ai-curated-specs/issues/188/design.md +0 -227
- data/ai-curated-specs/issues/188/requirements.md +0 -78
- data/ai-curated-specs/issues/188/tasks.md +0 -203
- data/ai-curated-specs/issues/188/upstream-contributions.md +0 -592
- data/ai-curated-specs/issues/50/design.md +0 -235
- data/ai-curated-specs/issues/50/requirements.md +0 -49
- data/ai-curated-specs/issues/50/tasks.md +0 -232
- data/bin/_dynamodblocal +0 -4
- data/bin/bundle_update.sh +0 -7
- data/bin/deploy_on_heroku.sh +0 -16
- data/bin/install_dynamodblocal.sh +0 -5
- data/bin/start_dynamodblocal.sh +0 -47
- data/bin/stop_dynamodblocal.sh +0 -34
- data/gemfiles/Gemfile.rails-5.0 +0 -25
- data/gemfiles/Gemfile.rails-5.1 +0 -25
- data/gemfiles/Gemfile.rails-5.2 +0 -24
- data/gemfiles/Gemfile.rails-6.0 +0 -23
- data/gemfiles/Gemfile.rails-6.1 +0 -22
- data/gemfiles/Gemfile.rails-7.0 +0 -25
- data/gemfiles/Gemfile.rails-7.1 +0 -23
- data/gemfiles/Gemfile.rails-7.2 +0 -23
- data/gemfiles/Gemfile.rails-8.0 +0 -24
- data/package.json +0 -8
- data/spec/channels/notification_api_channel_shared_examples.rb +0 -59
- data/spec/channels/notification_api_channel_spec.rb +0 -49
- data/spec/channels/notification_api_with_devise_channel_spec.rb +0 -76
- data/spec/channels/notification_channel_shared_examples.rb +0 -59
- data/spec/channels/notification_channel_spec.rb +0 -48
- data/spec/channels/notification_with_devise_channel_spec.rb +0 -97
- data/spec/concerns/apis/notification_api_spec.rb +0 -1627
- data/spec/concerns/apis/subscription_api_spec.rb +0 -474
- data/spec/concerns/common_spec.rb +0 -213
- data/spec/concerns/models/group_spec.rb +0 -61
- data/spec/concerns/models/notifiable_spec.rb +0 -782
- data/spec/concerns/models/notifier_spec.rb +0 -71
- data/spec/concerns/models/subscriber_spec.rb +0 -800
- data/spec/concerns/models/target_spec.rb +0 -1285
- data/spec/concerns/renderable_spec.rb +0 -129
- data/spec/config_spec.rb +0 -85
- data/spec/controllers/common_controller_spec.rb +0 -25
- data/spec/controllers/controller_spec_utility.rb +0 -100
- data/spec/controllers/dummy_common_controller.rb +0 -5
- data/spec/controllers/notifications_api_controller_shared_examples.rb +0 -619
- data/spec/controllers/notifications_api_controller_spec.rb +0 -19
- data/spec/controllers/notifications_api_with_devise_controller_spec.rb +0 -60
- data/spec/controllers/notifications_controller_shared_examples.rb +0 -743
- data/spec/controllers/notifications_controller_spec.rb +0 -11
- data/spec/controllers/notifications_with_devise_controller_spec.rb +0 -97
- data/spec/controllers/subscriptions_api_controller_shared_examples.rb +0 -750
- data/spec/controllers/subscriptions_api_controller_spec.rb +0 -19
- data/spec/controllers/subscriptions_api_with_devise_controller_spec.rb +0 -60
- data/spec/controllers/subscriptions_controller_shared_examples.rb +0 -946
- data/spec/controllers/subscriptions_controller_spec.rb +0 -11
- data/spec/controllers/subscriptions_with_devise_controller_spec.rb +0 -97
- data/spec/factories/admins.rb +0 -5
- data/spec/factories/articles.rb +0 -5
- data/spec/factories/comments.rb +0 -6
- data/spec/factories/dummy/dummy_group.rb +0 -4
- data/spec/factories/dummy/dummy_notifiable.rb +0 -4
- data/spec/factories/dummy/dummy_notifier.rb +0 -4
- data/spec/factories/dummy/dummy_subscriber.rb +0 -4
- data/spec/factories/dummy/dummy_target.rb +0 -4
- data/spec/factories/notifications.rb +0 -7
- data/spec/factories/subscriptions.rb +0 -8
- data/spec/factories/users.rb +0 -11
- data/spec/generators/controllers_generator_spec.rb +0 -85
- data/spec/generators/install_generator_spec.rb +0 -43
- data/spec/generators/migration/migration_generator_spec.rb +0 -66
- data/spec/generators/models_generator_spec.rb +0 -96
- data/spec/generators/views_generator_spec.rb +0 -195
- data/spec/helpers/polymorphic_helpers_spec.rb +0 -89
- data/spec/helpers/view_helpers_spec.rb +0 -547
- data/spec/jobs/notification_resilience_job_spec.rb +0 -167
- data/spec/jobs/notify_all_job_spec.rb +0 -23
- data/spec/jobs/notify_job_spec.rb +0 -23
- data/spec/jobs/notify_to_job_spec.rb +0 -23
- data/spec/mailers/mailer_spec.rb +0 -214
- data/spec/mailers/notification_resilience_spec.rb +0 -263
- data/spec/models/dummy/dummy_group_spec.rb +0 -10
- data/spec/models/dummy/dummy_notifiable_spec.rb +0 -10
- data/spec/models/dummy/dummy_notifier_spec.rb +0 -10
- data/spec/models/dummy/dummy_subscriber_spec.rb +0 -8
- data/spec/models/dummy/dummy_target_spec.rb +0 -10
- data/spec/models/notification_spec.rb +0 -472
- data/spec/models/subscription_spec.rb +0 -215
- data/spec/optional_targets/action_cable_api_channel_spec.rb +0 -34
- data/spec/optional_targets/action_cable_channel_spec.rb +0 -41
- data/spec/optional_targets/amazon_sns_spec.rb +0 -47
- data/spec/optional_targets/base_spec.rb +0 -45
- data/spec/optional_targets/slack_spec.rb +0 -44
- data/spec/orm/dynamoid_spec.rb +0 -115
- data/spec/rails_app/Rakefile +0 -15
- data/spec/rails_app/app/assets/config/manifest.js +0 -3
- data/spec/rails_app/app/assets/images/.keep +0 -0
- data/spec/rails_app/app/assets/javascripts/application.js +0 -3
- data/spec/rails_app/app/assets/javascripts/cable.js +0 -12
- data/spec/rails_app/app/assets/stylesheets/application.css +0 -15
- data/spec/rails_app/app/assets/stylesheets/reset.css +0 -85
- data/spec/rails_app/app/assets/stylesheets/style.css +0 -244
- data/spec/rails_app/app/controllers/admins_controller.rb +0 -21
- data/spec/rails_app/app/controllers/application_controller.rb +0 -5
- data/spec/rails_app/app/controllers/articles_controller.rb +0 -67
- data/spec/rails_app/app/controllers/comments_controller.rb +0 -36
- data/spec/rails_app/app/controllers/concerns/.keep +0 -0
- data/spec/rails_app/app/controllers/spa_controller.rb +0 -7
- data/spec/rails_app/app/controllers/users/notifications_controller.rb +0 -2
- data/spec/rails_app/app/controllers/users/notifications_with_devise_controller.rb +0 -2
- data/spec/rails_app/app/controllers/users/subscriptions_controller.rb +0 -2
- data/spec/rails_app/app/controllers/users/subscriptions_with_devise_controller.rb +0 -2
- data/spec/rails_app/app/controllers/users_controller.rb +0 -26
- data/spec/rails_app/app/helpers/application_helper.rb +0 -2
- data/spec/rails_app/app/helpers/devise_helper.rb +0 -2
- data/spec/rails_app/app/javascript/App.vue +0 -40
- data/spec/rails_app/app/javascript/components/DeviseTokenAuth.vue +0 -82
- data/spec/rails_app/app/javascript/components/Top.vue +0 -98
- data/spec/rails_app/app/javascript/components/notifications/Index.vue +0 -200
- data/spec/rails_app/app/javascript/components/notifications/Notification.vue +0 -133
- data/spec/rails_app/app/javascript/components/notifications/NotificationContent.vue +0 -122
- data/spec/rails_app/app/javascript/components/subscriptions/Index.vue +0 -279
- data/spec/rails_app/app/javascript/components/subscriptions/NewSubscription.vue +0 -112
- data/spec/rails_app/app/javascript/components/subscriptions/NotificationKey.vue +0 -141
- data/spec/rails_app/app/javascript/components/subscriptions/Subscription.vue +0 -226
- data/spec/rails_app/app/javascript/config/development.js +0 -5
- data/spec/rails_app/app/javascript/config/environment.js +0 -7
- data/spec/rails_app/app/javascript/config/production.js +0 -5
- data/spec/rails_app/app/javascript/config/test.js +0 -5
- data/spec/rails_app/app/javascript/packs/application.js +0 -18
- data/spec/rails_app/app/javascript/packs/spa.js +0 -14
- data/spec/rails_app/app/javascript/router/index.js +0 -73
- data/spec/rails_app/app/javascript/store/index.js +0 -37
- data/spec/rails_app/app/mailers/.keep +0 -0
- data/spec/rails_app/app/mailers/custom_notification_mailer.rb +0 -5
- data/spec/rails_app/app/models/admin.rb +0 -35
- data/spec/rails_app/app/models/article.rb +0 -54
- data/spec/rails_app/app/models/comment.rb +0 -81
- data/spec/rails_app/app/models/dummy/dummy_base.rb +0 -11
- data/spec/rails_app/app/models/dummy/dummy_group.rb +0 -23
- data/spec/rails_app/app/models/dummy/dummy_notifiable.rb +0 -15
- data/spec/rails_app/app/models/dummy/dummy_notifiable_target.rb +0 -27
- data/spec/rails_app/app/models/dummy/dummy_notifier.rb +0 -15
- data/spec/rails_app/app/models/dummy/dummy_subscriber.rb +0 -14
- data/spec/rails_app/app/models/dummy/dummy_target.rb +0 -16
- data/spec/rails_app/app/models/user.rb +0 -73
- data/spec/rails_app/app/views/activity_notification/mailer/dummy_subscribers/test_key.text.erb +0 -1
- data/spec/rails_app/app/views/activity_notification/notifications/default/article/_update.html.erb +0 -146
- data/spec/rails_app/app/views/activity_notification/notifications/default/custom/_path_test.html.erb +0 -1
- data/spec/rails_app/app/views/activity_notification/notifications/default/custom/_test.html.erb +0 -1
- data/spec/rails_app/app/views/activity_notification/notifications/users/_custom_index.html.erb +0 -1
- data/spec/rails_app/app/views/activity_notification/notifications/users/custom/_test.html.erb +0 -1
- data/spec/rails_app/app/views/activity_notification/notifications/users/overridden/custom/_test.html.erb +0 -1
- data/spec/rails_app/app/views/activity_notification/optional_targets/admins/amazon_sns/comment/_default.text.erb +0 -10
- data/spec/rails_app/app/views/articles/_form.html.erb +0 -24
- data/spec/rails_app/app/views/articles/edit.html.erb +0 -8
- data/spec/rails_app/app/views/articles/index.html.erb +0 -113
- data/spec/rails_app/app/views/articles/new.html.erb +0 -7
- data/spec/rails_app/app/views/articles/show.html.erb +0 -49
- data/spec/rails_app/app/views/layouts/_header.html.erb +0 -46
- data/spec/rails_app/app/views/layouts/application.html.erb +0 -15
- data/spec/rails_app/app/views/spa/index.html.erb +0 -2
- data/spec/rails_app/babel.config.js +0 -72
- data/spec/rails_app/bin/bundle +0 -3
- data/spec/rails_app/bin/rails +0 -4
- data/spec/rails_app/bin/rake +0 -4
- data/spec/rails_app/bin/setup +0 -29
- data/spec/rails_app/bin/webpack +0 -18
- data/spec/rails_app/bin/webpack-dev-server +0 -18
- data/spec/rails_app/config/application.rb +0 -54
- data/spec/rails_app/config/boot.rb +0 -5
- data/spec/rails_app/config/cable.yml +0 -8
- data/spec/rails_app/config/database.yml +0 -36
- data/spec/rails_app/config/dynamoid.rb +0 -13
- data/spec/rails_app/config/environment.rb +0 -26
- data/spec/rails_app/config/environments/development.rb +0 -60
- data/spec/rails_app/config/environments/production.rb +0 -85
- data/spec/rails_app/config/environments/test.rb +0 -53
- data/spec/rails_app/config/initializers/activity_notification.rb +0 -104
- data/spec/rails_app/config/initializers/assets.rb +0 -11
- data/spec/rails_app/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/rails_app/config/initializers/cookies_serializer.rb +0 -3
- data/spec/rails_app/config/initializers/copy_it.aws.rb.template +0 -6
- data/spec/rails_app/config/initializers/devise.rb +0 -278
- data/spec/rails_app/config/initializers/devise_token_auth.rb +0 -55
- data/spec/rails_app/config/initializers/filter_parameter_logging.rb +0 -4
- data/spec/rails_app/config/initializers/inflections.rb +0 -16
- data/spec/rails_app/config/initializers/mime_types.rb +0 -4
- data/spec/rails_app/config/initializers/mysql.rb +0 -9
- data/spec/rails_app/config/initializers/session_store.rb +0 -3
- data/spec/rails_app/config/initializers/wrap_parameters.rb +0 -14
- data/spec/rails_app/config/initializers/zeitwerk.rb +0 -10
- data/spec/rails_app/config/locales/activity_notification.en.yml +0 -26
- data/spec/rails_app/config/locales/devise.en.yml +0 -62
- data/spec/rails_app/config/mongoid.yml +0 -13
- data/spec/rails_app/config/routes.rb +0 -50
- data/spec/rails_app/config/secrets.yml +0 -22
- data/spec/rails_app/config/webpack/development.js +0 -5
- data/spec/rails_app/config/webpack/environment.js +0 -7
- data/spec/rails_app/config/webpack/loaders/vue.js +0 -6
- data/spec/rails_app/config/webpack/production.js +0 -5
- data/spec/rails_app/config/webpack/test.js +0 -5
- data/spec/rails_app/config/webpacker.yml +0 -97
- data/spec/rails_app/config.ru +0 -4
- data/spec/rails_app/db/migrate/20160716000000_create_test_tables.rb +0 -42
- data/spec/rails_app/db/migrate/20181209000000_create_activity_notification_tables.rb +0 -33
- data/spec/rails_app/db/migrate/20191201000000_add_tokens_to_users.rb +0 -10
- data/spec/rails_app/db/schema.rb +0 -98
- data/spec/rails_app/db/seeds.rb +0 -95
- data/spec/rails_app/lib/custom_optional_targets/console_output.rb +0 -16
- data/spec/rails_app/lib/custom_optional_targets/raise_error.rb +0 -14
- data/spec/rails_app/lib/custom_optional_targets/wrong_target.rb +0 -13
- data/spec/rails_app/lib/mailer_previews/mailer_preview.rb +0 -29
- data/spec/rails_app/package.json +0 -23
- data/spec/rails_app/postcss.config.js +0 -12
- data/spec/rails_app/public/404.html +0 -67
- data/spec/rails_app/public/422.html +0 -67
- data/spec/rails_app/public/500.html +0 -66
- data/spec/rails_app/public/favicon.ico +0 -0
- data/spec/roles/acts_as_group_spec.rb +0 -30
- data/spec/roles/acts_as_notifiable_spec.rb +0 -432
- data/spec/roles/acts_as_notifier_spec.rb +0 -30
- data/spec/roles/acts_as_target_spec.rb +0 -36
- data/spec/spec_helper.rb +0 -56
- data/spec/version_spec.rb +0 -31
|
@@ -1,11 +0,0 @@
|
|
|
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 :subscriptions_controller
|
|
11
|
-
end
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
require 'controllers/subscriptions_controller_shared_examples'
|
|
2
|
-
|
|
3
|
-
describe ActivityNotification::SubscriptionsWithDeviseController, type: :controller do
|
|
4
|
-
include ActivityNotification::ControllerSpec::RequestUtility
|
|
5
|
-
|
|
6
|
-
let(:test_user) { create(:confirmed_user) }
|
|
7
|
-
let(:unauthenticated_user) { create(:confirmed_user) }
|
|
8
|
-
let(:test_target) { create(:admin, user: test_user) }
|
|
9
|
-
let(:target_type) { :admins }
|
|
10
|
-
let(:typed_target_param) { :admin_id }
|
|
11
|
-
let(:extra_params) { { devise_type: :users } }
|
|
12
|
-
let(:valid_session) {}
|
|
13
|
-
|
|
14
|
-
context "signed in with devise as authenticated user" do
|
|
15
|
-
before do
|
|
16
|
-
sign_in test_user
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
it_behaves_like :subscriptions_controller
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
context "signed in with devise as unauthenticated user" do
|
|
23
|
-
let(:target_params) { { target_type: target_type, devise_type: :users } }
|
|
24
|
-
|
|
25
|
-
describe "GET #index" do
|
|
26
|
-
before do
|
|
27
|
-
sign_in unauthenticated_user
|
|
28
|
-
get_with_compatibility :index, target_params.merge({ typed_target_param => test_target }), valid_session
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
it "returns 403 as http status code" do
|
|
32
|
-
expect(response.status).to eq(403)
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
context "unsigned in with devise" do
|
|
38
|
-
let(:target_params) { { target_type: target_type, devise_type: :users } }
|
|
39
|
-
|
|
40
|
-
describe "GET #index" do
|
|
41
|
-
before do
|
|
42
|
-
get_with_compatibility :index, target_params.merge({ typed_target_param => test_target }), valid_session
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
it "returns 302 as http status code" do
|
|
46
|
-
expect(response.status).to eq(302)
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
it "redirects to sign_in path" do
|
|
50
|
-
expect(response).to redirect_to new_user_session_path
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
context "without devise_type parameter" do
|
|
56
|
-
let(:target_params) { { target_type: target_type } }
|
|
57
|
-
|
|
58
|
-
describe "GET #index" do
|
|
59
|
-
before do
|
|
60
|
-
get_with_compatibility :index, target_params.merge({ typed_target_param => test_target }), valid_session
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
it "returns 400 as http status code" do
|
|
64
|
-
expect(response.status).to eq(400)
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
context "with wrong devise_type parameter" do
|
|
70
|
-
let(:target_params) { { target_type: target_type, devise_type: :dummy_targets } }
|
|
71
|
-
|
|
72
|
-
describe "GET #index" do
|
|
73
|
-
before do
|
|
74
|
-
get_with_compatibility :index, target_params.merge({ typed_target_param => test_target }), valid_session
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
it "returns 403 as http status code" do
|
|
78
|
-
expect(response.status).to eq(403)
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
context "without target_id and (typed_target)_id parameters for devise integrated controller with devise_type option" do
|
|
84
|
-
let(:target_params) { { target_type: target_type, devise_type: :users } }
|
|
85
|
-
|
|
86
|
-
describe "GET #index" do
|
|
87
|
-
before do
|
|
88
|
-
sign_in test_target.user
|
|
89
|
-
get_with_compatibility :index, target_params, valid_session
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
it "returns 200 as http status code" do
|
|
93
|
-
expect(response.status).to eq(200)
|
|
94
|
-
end
|
|
95
|
-
end
|
|
96
|
-
end
|
|
97
|
-
end
|
data/spec/factories/admins.rb
DELETED
data/spec/factories/articles.rb
DELETED
data/spec/factories/comments.rb
DELETED
data/spec/factories/users.rb
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
FactoryBot.define do
|
|
2
|
-
factory :user do
|
|
3
|
-
email { Array.new(10){[*"A".."Z", *"0".."9"].sample}.join + '@example.com' }
|
|
4
|
-
password { "password" }
|
|
5
|
-
password_confirmation { "password" }
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
factory :confirmed_user, parent: :user do
|
|
9
|
-
after(:build) { |user| user.skip_confirmation! }
|
|
10
|
-
end
|
|
11
|
-
end
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
require 'generators/activity_notification/controllers_generator'
|
|
2
|
-
|
|
3
|
-
describe ActivityNotification::Generators::ControllersGenerator, type: :generator do
|
|
4
|
-
|
|
5
|
-
# setup_default_destination
|
|
6
|
-
destination File.expand_path("../../../tmp", __FILE__)
|
|
7
|
-
before { prepare_destination }
|
|
8
|
-
|
|
9
|
-
it 'runs generating controllers tasks' do
|
|
10
|
-
gen = generator %w(users)
|
|
11
|
-
expect(gen).to receive :create_controllers
|
|
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 controllers as default' do
|
|
26
|
-
before do
|
|
27
|
-
run_generator %w(users)
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
describe 'the notifications_controller' do
|
|
31
|
-
subject { file('app/controllers/users/notifications_controller.rb') }
|
|
32
|
-
it { is_expected.to exist }
|
|
33
|
-
it { is_expected.to contain(/class Users::NotificationsController < ActivityNotification::NotificationsController/) }
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
describe 'the notifications_with_devise_controller' do
|
|
37
|
-
subject { file('app/controllers/users/notifications_with_devise_controller.rb') }
|
|
38
|
-
it { is_expected.to exist }
|
|
39
|
-
it { is_expected.to contain(/class Users::NotificationsWithDeviseController < ActivityNotification::NotificationsWithDeviseController/) }
|
|
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
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
context 'with a controllers option as notifications and subscriptions' do
|
|
56
|
-
before do
|
|
57
|
-
run_generator %w(users --controllers notifications subscriptions)
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
describe 'the notifications_controller' do
|
|
61
|
-
subject { file('app/controllers/users/notifications_controller.rb') }
|
|
62
|
-
it { is_expected.to exist }
|
|
63
|
-
it { is_expected.to contain(/class Users::NotificationsController < ActivityNotification::NotificationsController/) }
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
describe 'the notifications_with_devise_controller' do
|
|
67
|
-
subject { file('app/controllers/users/notifications_with_devise_controller.rb') }
|
|
68
|
-
it { is_expected.not_to exist }
|
|
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
|
|
81
|
-
end
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
end
|
|
85
|
-
end
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
require 'generators/activity_notification/install_generator'
|
|
2
|
-
|
|
3
|
-
describe ActivityNotification::Generators::InstallGenerator, type: :generator do
|
|
4
|
-
|
|
5
|
-
# setup_default_destination
|
|
6
|
-
destination File.expand_path("../../../tmp", __FILE__)
|
|
7
|
-
before { prepare_destination }
|
|
8
|
-
|
|
9
|
-
it 'runs both the initializer and locale tasks' do
|
|
10
|
-
gen = generator
|
|
11
|
-
expect(gen).to receive :copy_initializer
|
|
12
|
-
expect(gen).to receive :copy_locale
|
|
13
|
-
expect(gen).to receive(:readme).and_return(true)
|
|
14
|
-
gen.invoke_all
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
describe 'the generated files' do
|
|
18
|
-
context 'with active_record orm as default' do
|
|
19
|
-
before do
|
|
20
|
-
run_generator
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
describe 'the initializer' do
|
|
24
|
-
subject { file('config/initializers/activity_notification.rb') }
|
|
25
|
-
it { is_expected.to exist }
|
|
26
|
-
it { is_expected.to contain(/ActivityNotification.configure do |config|/) }
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
describe 'the locale file' do
|
|
30
|
-
subject { file('config/locales/activity_notification.en.yml') }
|
|
31
|
-
it { is_expected.to exist }
|
|
32
|
-
it { is_expected.to contain(/en:\n.+notification:\n.+default:/) }
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
context 'with orm option as not :active_record' do
|
|
37
|
-
it 'raises MissingORMError' do
|
|
38
|
-
expect { run_generator %w(--orm dummy) }
|
|
39
|
-
.to raise_error(TypeError)
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
require 'generators/activity_notification/migration/migration_generator'
|
|
2
|
-
|
|
3
|
-
describe ActivityNotification::Generators::MigrationGenerator, type: :generator do
|
|
4
|
-
|
|
5
|
-
# setup_default_destination
|
|
6
|
-
destination File.expand_path("../../../../tmp", __FILE__)
|
|
7
|
-
|
|
8
|
-
before do
|
|
9
|
-
prepare_destination
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
after do
|
|
13
|
-
if ActivityNotification.config.orm == :active_record
|
|
14
|
-
ActivityNotification::Notification.reset_column_information
|
|
15
|
-
ActivityNotification::Subscription.reset_column_information
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
it 'runs generating migration tasks' do
|
|
20
|
-
gen = generator
|
|
21
|
-
expect(gen).to receive :create_migrations
|
|
22
|
-
gen.invoke_all
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
describe 'the generated files' do
|
|
26
|
-
context 'without name argument' do
|
|
27
|
-
before do
|
|
28
|
-
run_generator
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
describe 'CreateNotifications migration file' do
|
|
32
|
-
subject { file(Dir["tmp/db/migrate/*_create_activity_notification_tables.rb"].first.gsub!('tmp/', '')) }
|
|
33
|
-
it { is_expected.to exist }
|
|
34
|
-
it { is_expected.to contain(/class CreateActivityNotificationTables < ActiveRecord::Migration\[\d\.\d\]/) }
|
|
35
|
-
|
|
36
|
-
if ActivityNotification.config.orm == :active_record
|
|
37
|
-
it 'can be executed to migrate scheme' do
|
|
38
|
-
require subject
|
|
39
|
-
CreateActivityNotificationTables.new.migrate(:down)
|
|
40
|
-
CreateActivityNotificationTables.new.migrate(:up)
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
context 'with CreateCustomNotifications as name argument' do
|
|
47
|
-
before do
|
|
48
|
-
run_generator %w(CreateCustomNotifications --tables notifications)
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
describe 'CreateCustomNotifications migration file' do
|
|
52
|
-
subject { file(Dir["tmp/db/migrate/*_create_custom_notifications.rb"].first.gsub!('tmp/', '')) }
|
|
53
|
-
it { is_expected.to exist }
|
|
54
|
-
it { is_expected.to contain(/class CreateCustomNotifications < ActiveRecord::Migration\[\d\.\d\]/) }
|
|
55
|
-
|
|
56
|
-
if ActivityNotification.config.orm == :active_record
|
|
57
|
-
it 'can be executed to migrate scheme' do
|
|
58
|
-
require subject
|
|
59
|
-
CreateActivityNotificationTables.new.migrate(:down)
|
|
60
|
-
CreateActivityNotificationTables.new.migrate(:up)
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
end
|
|
@@ -1,96 +0,0 @@
|
|
|
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
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
require 'generators/activity_notification/views_generator'
|
|
2
|
-
|
|
3
|
-
describe ActivityNotification::Generators::ViewsGenerator, type: :generator do
|
|
4
|
-
|
|
5
|
-
# setup_default_destination
|
|
6
|
-
destination File.expand_path("../../../tmp", __FILE__)
|
|
7
|
-
before { prepare_destination }
|
|
8
|
-
|
|
9
|
-
it 'runs generating views tasks' do
|
|
10
|
-
gen = generator
|
|
11
|
-
expect(gen).to receive :copy_views
|
|
12
|
-
gen.invoke_all
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
describe 'the generated files' do
|
|
16
|
-
context 'without target argument' do
|
|
17
|
-
context 'with target views as default' do
|
|
18
|
-
before do
|
|
19
|
-
run_generator
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
describe 'the notification views' do
|
|
23
|
-
describe 'default/_default.html.erb' do
|
|
24
|
-
subject { file('app/views/activity_notification/notifications/default/_default.html.erb') }
|
|
25
|
-
it { is_expected.to exist }
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
describe 'default/_index.html.erb' do
|
|
29
|
-
subject { file('app/views/activity_notification/notifications/default/_index.html.erb') }
|
|
30
|
-
it { is_expected.to exist }
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
describe 'default/destroy.js.erb' do
|
|
34
|
-
subject { file('app/views/activity_notification/notifications/default/destroy.js.erb') }
|
|
35
|
-
it { is_expected.to exist }
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
describe 'default/index.html.erb' do
|
|
39
|
-
subject { file('app/views/activity_notification/notifications/default/index.html.erb') }
|
|
40
|
-
it { is_expected.to exist }
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
describe 'default/open_all.js.erb' do
|
|
44
|
-
subject { file('app/views/activity_notification/notifications/default/open_all.js.erb') }
|
|
45
|
-
it { is_expected.to exist }
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
describe 'default/open.js.erb' do
|
|
49
|
-
subject { file('app/views/activity_notification/notifications/default/open.js.erb') }
|
|
50
|
-
it { is_expected.to exist }
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
describe 'default/show.html.erb' do
|
|
54
|
-
subject { file('app/views/activity_notification/notifications/default/show.html.erb') }
|
|
55
|
-
it { is_expected.to exist }
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
|
|
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
|
-
|
|
70
|
-
describe 'default/default.html.erb' do
|
|
71
|
-
subject { file('app/views/activity_notification/mailer/default/default.html.erb') }
|
|
72
|
-
it { is_expected.to exist }
|
|
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
|
|
141
|
-
end
|
|
142
|
-
end
|
|
143
|
-
|
|
144
|
-
context 'with a views option as notifications' do
|
|
145
|
-
before do
|
|
146
|
-
run_generator %w(--views notifications)
|
|
147
|
-
end
|
|
148
|
-
|
|
149
|
-
describe 'the notification views' do
|
|
150
|
-
describe 'default/index.html.erb' do
|
|
151
|
-
subject { file('app/views/activity_notification/notifications/default/index.html.erb') }
|
|
152
|
-
it { is_expected.to exist }
|
|
153
|
-
end
|
|
154
|
-
end
|
|
155
|
-
|
|
156
|
-
describe 'the mailer views' do
|
|
157
|
-
describe 'default/default.html.erb' do
|
|
158
|
-
subject { file('app/views/activity_notification/mailer/default/default.html.erb') }
|
|
159
|
-
it { is_expected.not_to exist }
|
|
160
|
-
end
|
|
161
|
-
end
|
|
162
|
-
end
|
|
163
|
-
end
|
|
164
|
-
|
|
165
|
-
context 'with users as target' do
|
|
166
|
-
context 'with target views as default' do
|
|
167
|
-
before do
|
|
168
|
-
run_generator %w(users)
|
|
169
|
-
end
|
|
170
|
-
|
|
171
|
-
describe 'the notification views' do
|
|
172
|
-
describe 'users/index.html.erb' do
|
|
173
|
-
subject { file('app/views/activity_notification/notifications/users/index.html.erb') }
|
|
174
|
-
it { is_expected.to exist }
|
|
175
|
-
end
|
|
176
|
-
end
|
|
177
|
-
|
|
178
|
-
describe 'the mailer views' do
|
|
179
|
-
describe 'users/default.html.erb' do
|
|
180
|
-
subject { file('app/views/activity_notification/mailer/users/default.html.erb') }
|
|
181
|
-
it { is_expected.to exist }
|
|
182
|
-
end
|
|
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
|
|
191
|
-
end
|
|
192
|
-
end
|
|
193
|
-
|
|
194
|
-
end
|
|
195
|
-
end
|