activity_notification 2.4.1 → 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 +4 -2
- data/app/jobs/activity_notification/cascading_notification_job.rb +123 -0
- data/docs/Functions.md +197 -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/version.rb +1 -1
- data/lib/generators/templates/activity_notification.rb +8 -0
- metadata +5 -441
- 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 -100
- data/.gitignore +0 -74
- data/.rspec +0 -3
- data/.rubocop.yml +0 -1157
- data/.yardopts +0 -6
- data/CHANGELOG.md +0 -452
- 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 -80
- 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,34 +0,0 @@
|
|
|
1
|
-
require 'activity_notification/optional_targets/action_cable_api_channel'
|
|
2
|
-
describe ActivityNotification::OptionalTarget::ActionCableApiChannel do
|
|
3
|
-
let(:test_instance) { ActivityNotification::OptionalTarget::ActionCableApiChannel.new(skip_initializing_target: true) }
|
|
4
|
-
|
|
5
|
-
describe "as public instance methods" do
|
|
6
|
-
describe "#to_optional_target_name" do
|
|
7
|
-
it "is return demodulized symbol class name" do
|
|
8
|
-
expect(test_instance.to_optional_target_name).to eq(:action_cable_api_channel)
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
describe "#initialize_target" do
|
|
13
|
-
it "does not raise NotImplementedError" do
|
|
14
|
-
test_instance.initialize_target
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
describe "#notify" do
|
|
19
|
-
it "does not raise NotImplementedError" do
|
|
20
|
-
test_instance.notify(create(:notification))
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
describe "as protected instance methods" do
|
|
26
|
-
describe "#render_notification_message" do
|
|
27
|
-
context "as default" do
|
|
28
|
-
it "renders notification message as formatted JSON" do
|
|
29
|
-
expect(test_instance.send(:render_notification_message, create(:notification)).with_indifferent_access[:notification].has_key?(:id)).to be_truthy
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
end
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
require 'activity_notification/optional_targets/action_cable_channel'
|
|
2
|
-
describe ActivityNotification::OptionalTarget::ActionCableChannel do
|
|
3
|
-
let(:test_instance) { ActivityNotification::OptionalTarget::ActionCableChannel.new(skip_initializing_target: true) }
|
|
4
|
-
|
|
5
|
-
describe "as public instance methods" do
|
|
6
|
-
describe "#to_optional_target_name" do
|
|
7
|
-
it "is return demodulized symbol class name" do
|
|
8
|
-
expect(test_instance.to_optional_target_name).to eq(:action_cable_channel)
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
describe "#initialize_target" do
|
|
13
|
-
it "does not raise NotImplementedError" do
|
|
14
|
-
test_instance.initialize_target
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
describe "#notify" do
|
|
19
|
-
it "does not raise NotImplementedError" do
|
|
20
|
-
test_instance.notify(create(:notification))
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
describe "as protected instance methods" do
|
|
26
|
-
describe "#render_notification_message" do
|
|
27
|
-
context "as default" do
|
|
28
|
-
it "renders notification message with default template" do
|
|
29
|
-
expect(test_instance.send(:render_notification_message, create(:notification))).to be_include("<div class='notification_list")
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
context "with unexisting template as fallback option" do
|
|
34
|
-
it "raise ActionView::MissingTemplate" do
|
|
35
|
-
expect { expect(test_instance.send(:render_notification_message, create(:notification), fallback: :hoge)) }
|
|
36
|
-
.to raise_error(ActionView::MissingTemplate)
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
require 'activity_notification/optional_targets/amazon_sns'
|
|
2
|
-
describe ActivityNotification::OptionalTarget::AmazonSNS do
|
|
3
|
-
let(:test_instance) { ActivityNotification::OptionalTarget::AmazonSNS.new(skip_initializing_target: true) }
|
|
4
|
-
|
|
5
|
-
describe "as public instance methods" do
|
|
6
|
-
describe "#to_optional_target_name" do
|
|
7
|
-
it "is return demodulized symbol class name" do
|
|
8
|
-
expect(test_instance.to_optional_target_name).to eq(:amazon_sns)
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
describe "#initialize_target" do
|
|
13
|
-
it "does not raise NotImplementedError" do
|
|
14
|
-
begin
|
|
15
|
-
test_instance.initialize_target
|
|
16
|
-
rescue Aws::Errors::MissingRegionError
|
|
17
|
-
# Rescue for CI without AWS client configuration
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
describe "#notify" do
|
|
23
|
-
it "does not raise NotImplementedError but NoMethodError" do
|
|
24
|
-
expect { test_instance.notify(create(:notification)) }
|
|
25
|
-
.to raise_error(NoMethodError)
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
describe "as protected instance methods" do
|
|
31
|
-
describe "#render_notification_message" do
|
|
32
|
-
context "as default" do
|
|
33
|
-
it "renders notification message with default template" do
|
|
34
|
-
expect(test_instance.send(:render_notification_message, create(:notification))).to be_include("Move to notified")
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
context "with unexisting template as fallback option" do
|
|
39
|
-
it "raise ActionView::MissingTemplate" do
|
|
40
|
-
expect { expect(test_instance.send(:render_notification_message, create(:notification), fallback: :hoge)) }
|
|
41
|
-
.to raise_error(ActionView::MissingTemplate)
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
end
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
describe ActivityNotification::OptionalTarget::Base do
|
|
2
|
-
let(:test_instance) {
|
|
3
|
-
ActivityNotification::OptionalTarget::Base.new(skip_initializing_target: true)
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
describe "as public instance methods" do
|
|
7
|
-
describe "#to_optional_target_name" do
|
|
8
|
-
it "is return demodulized symbol class name" do
|
|
9
|
-
expect(test_instance.to_optional_target_name).to eq(:base)
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
describe "#initialize_target" do
|
|
14
|
-
it "raises NotImplementedError" do
|
|
15
|
-
expect { test_instance.initialize_target }
|
|
16
|
-
.to raise_error(NotImplementedError, /You have to implement ActivityNotification::OptionalTarget::Base#initialize_target/)
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
describe "#notify" do
|
|
21
|
-
it "raises NotImplementedError" do
|
|
22
|
-
expect { test_instance.notify(create(:notification)) }
|
|
23
|
-
.to raise_error(NotImplementedError, /You have to implement ActivityNotification::OptionalTarget::Base#notify/)
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
describe "as protected instance methods" do
|
|
29
|
-
describe "#render_notification_message" do
|
|
30
|
-
context "as default" do
|
|
31
|
-
it "renders notification message with default template" do
|
|
32
|
-
expect(test_instance.send(:render_notification_message, create(:notification))).to be_include("Move to notified")
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
context "with unexisting template as fallback option" do
|
|
37
|
-
it "raise ActionView::MissingTemplate" do
|
|
38
|
-
expect { expect(test_instance.send(:render_notification_message, create(:notification), fallback: :hoge)) }
|
|
39
|
-
.to raise_error(ActionView::MissingTemplate)
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
end
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
require 'activity_notification/optional_targets/slack'
|
|
2
|
-
describe ActivityNotification::OptionalTarget::Slack do
|
|
3
|
-
let(:test_instance) { ActivityNotification::OptionalTarget::Slack.new(skip_initializing_target: true) }
|
|
4
|
-
|
|
5
|
-
describe "as public instance methods" do
|
|
6
|
-
describe "#to_optional_target_name" do
|
|
7
|
-
it "is return demodulized symbol class name" do
|
|
8
|
-
expect(test_instance.to_optional_target_name).to eq(:slack)
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
describe "#initialize_target" do
|
|
13
|
-
it "does not raise NotImplementedError but URI::InvalidURIError" do
|
|
14
|
-
expect { test_instance.initialize_target }
|
|
15
|
-
.to raise_error(URI::InvalidURIError)
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
describe "#notify" do
|
|
20
|
-
it "does not raise NotImplementedError but NoMethodError" do
|
|
21
|
-
expect { test_instance.notify(create(:notification)) }
|
|
22
|
-
.to raise_error(NoMethodError)
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
describe "as protected instance methods" do
|
|
28
|
-
describe "#render_notification_message" do
|
|
29
|
-
context "as default" do
|
|
30
|
-
it "renders notification message with slack default template" do
|
|
31
|
-
expect(test_instance.send(:render_notification_message, create(:notification))).to be_include("<!channel>")
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
context "with unexisting template as fallback option" do
|
|
36
|
-
it "raise ActionView::MissingTemplate" do
|
|
37
|
-
expect { expect(test_instance.send(:render_notification_message, create(:notification), fallback: :hoge)) }
|
|
38
|
-
.to raise_error(ActionView::MissingTemplate)
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
end
|
data/spec/orm/dynamoid_spec.rb
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
if ActivityNotification.config.orm == :dynamoid
|
|
2
|
-
describe Dynamoid::Criteria::None do
|
|
3
|
-
let(:none) { ActivityNotification::Notification.none }
|
|
4
|
-
|
|
5
|
-
it "is a Dynamoid::Criteria::None" do
|
|
6
|
-
expect(none).to be_a(Dynamoid::Criteria::None)
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
context "== operator" do
|
|
10
|
-
it "returns true against other None object" do
|
|
11
|
-
expect(none).to eq(ActivityNotification::Notification.none)
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
it "returns false against other objects" do
|
|
15
|
-
expect(none).not_to eq(1)
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
context "records" do
|
|
20
|
-
it "returns empty array" do
|
|
21
|
-
expect(none.records).to eq([])
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
context "all" do
|
|
26
|
-
it "returns empty array" do
|
|
27
|
-
expect(none.all).to eq([])
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
context "count" do
|
|
32
|
-
it "returns 0" do
|
|
33
|
-
expect(none.count).to eq(0)
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
context "delete_all" do
|
|
38
|
-
it "does nothing" do
|
|
39
|
-
expect(none.delete_all).to be_nil
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
context "empty?" do
|
|
44
|
-
it "returns true" do
|
|
45
|
-
expect(none.empty?).to be_truthy
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
describe Dynamoid::Criteria::Chain do
|
|
51
|
-
let(:chain) { ActivityNotification::Notification.scan_index_forward(true) }
|
|
52
|
-
|
|
53
|
-
before do
|
|
54
|
-
ActivityNotification::Notification.delete_all
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
it "is a Dynamoid::Criteria::None" do
|
|
58
|
-
expect(chain).to be_a(Dynamoid::Criteria::Chain)
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
context "none" do
|
|
62
|
-
it "returns Dynamoid::Criteria::None" do
|
|
63
|
-
expect(chain.none).to be_a(Dynamoid::Criteria::None)
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
context "limit" do
|
|
68
|
-
before do
|
|
69
|
-
create(:notification)
|
|
70
|
-
create(:notification)
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
it "returns limited records by record_limit" do
|
|
74
|
-
expect(chain.count).to eq(2)
|
|
75
|
-
expect(chain.limit(1).count).to eq(1)
|
|
76
|
-
end
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
context "exists?" do
|
|
80
|
-
it "returns false when the record does not exist" do
|
|
81
|
-
expect(chain.exists?).to be_falsy
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
it "returns true when the record exists" do
|
|
85
|
-
create(:notification)
|
|
86
|
-
expect(chain.exists?).to be_truthy
|
|
87
|
-
end
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
context "size" do
|
|
91
|
-
it "returns same value as count" do
|
|
92
|
-
expect(chain.count).to eq(0)
|
|
93
|
-
expect(chain.size).to eq(0)
|
|
94
|
-
create(:notification)
|
|
95
|
-
expect(chain.count).to eq(1)
|
|
96
|
-
expect(chain.size).to eq(1)
|
|
97
|
-
end
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
context "update_all" do
|
|
101
|
-
before do
|
|
102
|
-
create(:notification)
|
|
103
|
-
create(:notification)
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
it "updates all records" do
|
|
107
|
-
expect(ActivityNotification::Notification.where(key: "default.default").count).to eq(2)
|
|
108
|
-
expect(ActivityNotification::Notification.where(key: "updated.all").count).to eq(0)
|
|
109
|
-
chain.update_all(key: "updated.all")
|
|
110
|
-
expect(ActivityNotification::Notification.where(key: "default.default").count).to eq(0)
|
|
111
|
-
expect(ActivityNotification::Notification.where(key: "updated.all").count).to eq(2)
|
|
112
|
-
end
|
|
113
|
-
end
|
|
114
|
-
end
|
|
115
|
-
end
|
data/spec/rails_app/Rakefile
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
|
2
|
-
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
|
3
|
-
|
|
4
|
-
require File.expand_path('../config/application', __FILE__)
|
|
5
|
-
|
|
6
|
-
# Define dummy module for Webpacker Rake tasks
|
|
7
|
-
require 'devise_token_auth'
|
|
8
|
-
unless defined?(DeviseTokenAuth::Concerns::User)
|
|
9
|
-
module DeviseTokenAuth::Concerns
|
|
10
|
-
module User
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
Rails.application.load_tasks
|
|
File without changes
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// Action Cable provides the framework to deal with WebSockets in Rails.
|
|
2
|
-
// You can generate new channels where WebSocket features live using the `rails generate channel` command.
|
|
3
|
-
//
|
|
4
|
-
//= require action_cable
|
|
5
|
-
//= require_self
|
|
6
|
-
|
|
7
|
-
(function() {
|
|
8
|
-
this.App || (this.App = {});
|
|
9
|
-
|
|
10
|
-
App.cable = ActionCable.createConsumer();
|
|
11
|
-
|
|
12
|
-
}).call(this);
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
|
3
|
-
* listed below.
|
|
4
|
-
*
|
|
5
|
-
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
|
6
|
-
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
|
7
|
-
*
|
|
8
|
-
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
|
9
|
-
* compiled file so the styles you add here take precedence over styles defined in any styles
|
|
10
|
-
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
|
11
|
-
* file per style scope.
|
|
12
|
-
*
|
|
13
|
-
*= require_tree .
|
|
14
|
-
*= require_self
|
|
15
|
-
*/
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, abbr, address, cite, code, del, dfn, em, img, ins, kbd, q, samp, small, strong, sub, sup, var, b, i, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, figcaption, figure, footer, header, hgroup, menu, nav, section, summary, time, mark, audio, video {
|
|
2
|
-
margin: 0;
|
|
3
|
-
padding: 0;
|
|
4
|
-
border: 0;
|
|
5
|
-
outline: 0;
|
|
6
|
-
font-size: 100%;
|
|
7
|
-
vertical-align: baseline;
|
|
8
|
-
background: transparent;
|
|
9
|
-
list-style: none;
|
|
10
|
-
font-weight: normal;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
body {
|
|
14
|
-
line-height: 1;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {
|
|
18
|
-
display: block;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
nav, ul {
|
|
22
|
-
list-style: none;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
blockquote, q {
|
|
26
|
-
quotes: none;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
blockquote:before, blockquote:after, q:before, q:after {
|
|
30
|
-
content: '';
|
|
31
|
-
content: none;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
a {
|
|
35
|
-
margin: 0;
|
|
36
|
-
padding: 0;
|
|
37
|
-
font-size: 100%;
|
|
38
|
-
vertical-align: baseline;
|
|
39
|
-
background: transparent;
|
|
40
|
-
text-decoration: none;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
a:focus {
|
|
44
|
-
outline: none;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
ins {
|
|
48
|
-
background-color: #ff9;
|
|
49
|
-
color: #000;
|
|
50
|
-
text-decoration: none;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
mark {
|
|
54
|
-
background-color: #ff9;
|
|
55
|
-
color: #000;
|
|
56
|
-
font-style: italic;
|
|
57
|
-
font-weight: bold;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
del {
|
|
61
|
-
text-decoration: line-through;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
abbr[title], dfn[title] {
|
|
65
|
-
border-bottom: 1px dotted;
|
|
66
|
-
cursor: help;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
table {
|
|
70
|
-
border-collapse: collapse;
|
|
71
|
-
border-spacing: 0;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
hr {
|
|
75
|
-
display: block;
|
|
76
|
-
height: 0;
|
|
77
|
-
border: 0;
|
|
78
|
-
border-top: 1px solid #ddd;
|
|
79
|
-
margin: 1em 0;
|
|
80
|
-
padding: 0;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
input, select {
|
|
84
|
-
vertical-align: middle;
|
|
85
|
-
}
|