Fix app/services' ruby 2.7 kwargs warnings (#13177)
This commit is contained in:
parent
da56f980e1
commit
009c14653a
60 changed files with 127 additions and 125 deletions
|
|
@ -10,8 +10,8 @@ module Articles
|
|||
@editor_version2 = @user&.editor_version == "v2"
|
||||
end
|
||||
|
||||
def self.call(*args)
|
||||
new(*args).call
|
||||
def self.call(...)
|
||||
new(...).call
|
||||
end
|
||||
|
||||
# the Builder returns a pair of [article, needs_authorization?]
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ module Articles
|
|||
@event_dispatcher = event_dispatcher
|
||||
end
|
||||
|
||||
def self.call(*args)
|
||||
new(*args).call
|
||||
def self.call(...)
|
||||
new(...).call
|
||||
end
|
||||
|
||||
def call
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ module Articles
|
|||
@event_dispatcher = event_dispatcher
|
||||
end
|
||||
|
||||
def self.call(*args)
|
||||
new(*args).call
|
||||
def self.call(...)
|
||||
new(...).call
|
||||
end
|
||||
|
||||
def call
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ module Authentication
|
|||
@cta_variant = cta_variant
|
||||
end
|
||||
|
||||
def self.call(*args)
|
||||
new(*args).call
|
||||
def self.call(...)
|
||||
new(...).call
|
||||
end
|
||||
|
||||
def call
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ module Broadcasts
|
|||
@notification_enqueued = false
|
||||
end
|
||||
|
||||
def self.call(*args)
|
||||
new(*args).call
|
||||
def self.call(...)
|
||||
new(...).call
|
||||
end
|
||||
|
||||
def call
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ module ChatChannels
|
|||
@membership_role = membership_role
|
||||
end
|
||||
|
||||
def self.call(*args)
|
||||
new(*args).call
|
||||
def self.call(...)
|
||||
new(...).call
|
||||
end
|
||||
|
||||
def call
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ module ChatChannels
|
|||
@contrived_name = contrived_name
|
||||
end
|
||||
|
||||
def self.call(*args)
|
||||
new(*args).call
|
||||
def self.call(...)
|
||||
new(...).call
|
||||
end
|
||||
|
||||
def call
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ module ChatChannels
|
|||
@chat_channel = chat_channel
|
||||
end
|
||||
|
||||
def self.call(*args)
|
||||
new(*args).call
|
||||
def self.call(...)
|
||||
new(...).call
|
||||
end
|
||||
|
||||
def call
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ module ChatChannels
|
|||
@params = params
|
||||
end
|
||||
|
||||
def self.call(*args)
|
||||
new(*args).call
|
||||
def self.call(...)
|
||||
new(...).call
|
||||
end
|
||||
|
||||
def call
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ module Credits
|
|||
@cost = cost
|
||||
end
|
||||
|
||||
def self.call(*args)
|
||||
new(*args).call
|
||||
def self.call(...)
|
||||
new(...).call
|
||||
end
|
||||
|
||||
def call
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ module Credits
|
|||
@user = user
|
||||
end
|
||||
|
||||
def self.call(*args)
|
||||
new(*args).call
|
||||
def self.call(...)
|
||||
new(...).call
|
||||
end
|
||||
|
||||
def call
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ module Exporter
|
|||
|
||||
# export content with filenames
|
||||
EXPORTERS.each do |exporter|
|
||||
files = exporter.new(user).export(config.fetch(exporter.name.demodulize.downcase.to_sym, {}))
|
||||
files = exporter.new(user).export(**config.fetch(exporter.name.demodulize.downcase.to_sym, {}))
|
||||
files.each do |name, content|
|
||||
exports[name] = content
|
||||
end
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ module Images
|
|||
end
|
||||
|
||||
def optimize_image(path)
|
||||
Images::Optimizer.call("#{URL.url}/social_previews#{path}", OPTIMIZER_OPTIONS)
|
||||
Images::Optimizer.call("#{URL.url}/social_previews#{path}", **OPTIMIZER_OPTIONS)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ class MediumArticleRetrievalService
|
|||
@url = url
|
||||
end
|
||||
|
||||
def self.call(*args)
|
||||
new(*args).call
|
||||
def self.call(...)
|
||||
new(...).call
|
||||
end
|
||||
|
||||
def call
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ module Mentions
|
|||
@notifiable = notifiable
|
||||
end
|
||||
|
||||
def self.call(*args)
|
||||
new(*args).call
|
||||
def self.call(...)
|
||||
new(...).call
|
||||
end
|
||||
|
||||
def call
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ module Notifications
|
|||
@next_milestone = next_milestone
|
||||
end
|
||||
|
||||
def self.call(*args)
|
||||
new(*args).call
|
||||
def self.call(...)
|
||||
new(...).call
|
||||
end
|
||||
|
||||
def call
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ module Notifications
|
|||
@notifiable = notifiable
|
||||
end
|
||||
|
||||
def self.call(*args)
|
||||
new(*args).call
|
||||
def self.call(...)
|
||||
new(...).call
|
||||
end
|
||||
|
||||
delegate :user_data, :comment_data, to: Notifications
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ module Notifications
|
|||
|
||||
delegate :user_data, to: Notifications
|
||||
|
||||
def self.call(*args)
|
||||
new(*args).call
|
||||
def self.call(...)
|
||||
new(...).call
|
||||
end
|
||||
|
||||
def call
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ module Notifications
|
|||
|
||||
delegate :user_data, :comment_data, to: Notifications
|
||||
|
||||
def self.call(*args)
|
||||
new(*args).call
|
||||
def self.call(...)
|
||||
new(...).call
|
||||
end
|
||||
|
||||
def call
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ module Notifications
|
|||
validates :followable_type, inclusion: { in: %w[User Organization] }
|
||||
validates :follower_id, numericality: { only_integer: true }
|
||||
|
||||
def initialize(*args, **kwargs)
|
||||
def initialize(attributes)
|
||||
super
|
||||
raise DataError unless valid?
|
||||
end
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ module Notifications
|
|||
|
||||
delegate :user_data, to: Notifications
|
||||
|
||||
def self.call(*args)
|
||||
new(*args).call
|
||||
def self.call(...)
|
||||
new(...).call
|
||||
end
|
||||
|
||||
def call
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ module Notifications
|
|||
@mention = mention
|
||||
end
|
||||
|
||||
def self.call(*args)
|
||||
new(*args).call
|
||||
def self.call(...)
|
||||
new(...).call
|
||||
end
|
||||
|
||||
def call
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ module Notifications
|
|||
|
||||
delegate :user_data, :article_data, :organization_data, to: Notifications
|
||||
|
||||
def self.call(*args)
|
||||
new(*args).call
|
||||
def self.call(...)
|
||||
new(...).call
|
||||
end
|
||||
|
||||
def call
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ module Notifications
|
|||
validates :reactable_type, inclusion: { in: %w[Article Comment] }
|
||||
validates :reactable_user_id, numericality: { only_integer: true }
|
||||
|
||||
def initialize(*args, **kwargs)
|
||||
def initialize(attributes)
|
||||
super
|
||||
raise DataError unless valid?
|
||||
end
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ module Notifications
|
|||
|
||||
delegate :user_data, to: Notifications
|
||||
|
||||
def self.call(*args)
|
||||
new(*args).call
|
||||
def self.call(...)
|
||||
new(...).call
|
||||
end
|
||||
|
||||
# @return [OpenStruct, #action, #notification_id]
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ module Notifications
|
|||
@notifiable_collection = notifiable_type.constantize.where(id: notifiable_ids)
|
||||
end
|
||||
|
||||
def self.call(*args)
|
||||
new(*args).call
|
||||
def self.call(...)
|
||||
new(...).call
|
||||
end
|
||||
|
||||
def call
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ module Notifications
|
|||
@action = action
|
||||
end
|
||||
|
||||
def self.call(*args)
|
||||
new(*args).call
|
||||
def self.call(...)
|
||||
new(...).call
|
||||
end
|
||||
|
||||
def call
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ module Notifications
|
|||
@tag_adjustment = tag_adjustment
|
||||
end
|
||||
|
||||
def self.call(*args)
|
||||
new(*args).call
|
||||
def self.call(...)
|
||||
new(...).call
|
||||
end
|
||||
|
||||
def call
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ module Notifications
|
|||
@action = action
|
||||
end
|
||||
|
||||
def self.call(*args)
|
||||
new(*args).call
|
||||
def self.call(...)
|
||||
new(...).call
|
||||
end
|
||||
|
||||
def call
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ module Notifications
|
|||
|
||||
delegate :user_data, to: Notifications
|
||||
|
||||
def self.call(*args)
|
||||
new(*args).call
|
||||
def self.call(...)
|
||||
new(...).call
|
||||
end
|
||||
|
||||
def call
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ module Podcasts
|
|||
@item = item.is_a?(EpisodeRssItem) ? item : EpisodeRssItem.new(item)
|
||||
end
|
||||
|
||||
def self.call(*args)
|
||||
new(*args).call
|
||||
def self.call(...)
|
||||
new(...).call
|
||||
end
|
||||
|
||||
def call
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ module Podcasts
|
|||
@enclosure_url = enclosure_url.to_s
|
||||
end
|
||||
|
||||
def self.call(*args)
|
||||
new(*args).call
|
||||
def self.call(...)
|
||||
new(...).call
|
||||
end
|
||||
|
||||
def call
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ module Podcasts
|
|||
@enclosure_url = enclosure_url
|
||||
end
|
||||
|
||||
def self.call(*args)
|
||||
new(*args).call
|
||||
def self.call(...)
|
||||
new(...).call
|
||||
end
|
||||
|
||||
def call
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ module Slack
|
|||
@icon_emoji = icon_emoji
|
||||
end
|
||||
|
||||
def self.call(*args)
|
||||
new(*args).call
|
||||
def self.call(...)
|
||||
new(...).call
|
||||
end
|
||||
|
||||
def call
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ module Slack
|
|||
@article = article
|
||||
end
|
||||
|
||||
def self.call(*args)
|
||||
new(*args).call
|
||||
def self.call(...)
|
||||
new(...).call
|
||||
end
|
||||
|
||||
def call
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ module Slack
|
|||
@user = comment.user
|
||||
end
|
||||
|
||||
def self.call(*args)
|
||||
new(*args).call
|
||||
def self.call(...)
|
||||
new(...).call
|
||||
end
|
||||
|
||||
def call
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ module Slack
|
|||
@message = message
|
||||
end
|
||||
|
||||
def self.call(*args)
|
||||
new(*args).call
|
||||
def self.call(...)
|
||||
new(...).call
|
||||
end
|
||||
|
||||
def call
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ module Slack
|
|||
@message = message
|
||||
end
|
||||
|
||||
def self.call(*args)
|
||||
new(*args).call
|
||||
def self.call(...)
|
||||
new(...).call
|
||||
end
|
||||
|
||||
def call
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ module Slack
|
|||
@user = user
|
||||
end
|
||||
|
||||
def self.call(*args)
|
||||
new(*args).call
|
||||
def self.call(...)
|
||||
new(...).call
|
||||
end
|
||||
|
||||
def call
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ module Slack
|
|||
@reaction = reaction
|
||||
end
|
||||
|
||||
def self.call(*args)
|
||||
new(*args).call
|
||||
def self.call(...)
|
||||
new(...).call
|
||||
end
|
||||
|
||||
def call
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ module Slack
|
|||
@tag = tag
|
||||
end
|
||||
|
||||
def self.call(*args)
|
||||
new(*args).call
|
||||
def self.call(...)
|
||||
new(...).call
|
||||
end
|
||||
|
||||
def call
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ module UserSubscriptions
|
|||
|
||||
Response = Struct.new(:success, :data, :error, keyword_init: true)
|
||||
|
||||
def self.call(*args)
|
||||
new(*args).call
|
||||
def self.call(...)
|
||||
new(...).call
|
||||
end
|
||||
|
||||
def initialize(user, user_subscription_params)
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ module UserSubscriptions
|
|||
class IsSubscribedCacheChecker
|
||||
attr_accessor :user, :source_type, :source_id
|
||||
|
||||
def self.call(*args)
|
||||
new(*args).call
|
||||
def self.call(...)
|
||||
new(...).call
|
||||
end
|
||||
|
||||
def initialize(user, params)
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ module Users
|
|||
Rails.cache.delete("user-destroy-token-#{user.id}")
|
||||
end
|
||||
|
||||
def self.call(*args)
|
||||
new(*args).call
|
||||
def self.call(...)
|
||||
new(...).call
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ module Users
|
|||
class RemoveRole
|
||||
Response = Struct.new(:success, :error_message, keyword_init: true)
|
||||
|
||||
def self.call(*args)
|
||||
new(*args).call
|
||||
def self.call(...)
|
||||
new(...).call
|
||||
end
|
||||
|
||||
def initialize(user:, role:, resource_type:, admin:)
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ module Webhook
|
|||
@record = record
|
||||
end
|
||||
|
||||
def self.call(*args)
|
||||
new(*args).call
|
||||
def self.call(...)
|
||||
new(...).call
|
||||
end
|
||||
|
||||
def call
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ if [ "$KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC" = "" ]; then
|
|||
KNAPSACK_PRO_ENDPOINT=https://api-disabled-for-fork.knapsackpro.com \
|
||||
KNAPSACK_PRO_MAX_REQUEST_RETRIES=0 \
|
||||
KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC=disabled-for-fork \
|
||||
RUBYOPT="-W:deprecated"\
|
||||
bundle exec rake knapsack_pro:rspec # use Regular Mode here always
|
||||
else
|
||||
bundle exec rake knapsack_pro:queue:rspec
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@ RSpec.describe Articles::Suggest, type: :service do
|
|||
expect(described_class.call(article).size).to eq(4)
|
||||
end
|
||||
|
||||
it "returns proper number of articles with post without tags" do
|
||||
it "returns proper number of articles with post without tags", :flaky do
|
||||
# Flaky because sometime it returns 3 instead of 4
|
||||
create_list(:article, 5, tags: [], with_tags: false, featured: true)
|
||||
article = create(:article, featured: true, tag_list: "")
|
||||
expect(described_class.call(article).size).to eq(4)
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ RSpec.describe PushNotifications::Send, type: :service do
|
|||
before { allow(FeatureFlag).to receive(:enabled?).with(:mobile_notifications).and_return(false) }
|
||||
|
||||
it "does nothing if the feature flag is disabled" do
|
||||
expect { described_class.call(params) }
|
||||
expect { described_class.call(**params) }
|
||||
.not_to change { Rpush::Client::Redis::Notification.all.count }
|
||||
end
|
||||
end
|
||||
|
|
@ -37,7 +37,7 @@ RSpec.describe PushNotifications::Send, type: :service do
|
|||
|
||||
it "does nothing", :aggregate_failures do
|
||||
expect(user.devices.count).to eq(0)
|
||||
expect { described_class.call(params) }
|
||||
expect { described_class.call(**params) }
|
||||
.not_to change { Rpush::Client::Redis::Notification.all.count }
|
||||
end
|
||||
end
|
||||
|
|
@ -51,7 +51,7 @@ RSpec.describe PushNotifications::Send, type: :service do
|
|||
end
|
||||
|
||||
it "creates a notification and enqueues it" do
|
||||
expect { described_class.call(params) }
|
||||
expect { described_class.call(**params) }
|
||||
.to change { Rpush::Client::Redis::Notification.all.count }.by(1)
|
||||
.and change(PushNotifications::DeliverWorker.jobs, :size).by(1)
|
||||
end
|
||||
|
|
@ -59,7 +59,7 @@ RSpec.describe PushNotifications::Send, type: :service do
|
|||
it "creates a single notification for each of the user's devices when they have multiple" do
|
||||
create(:device, user: user)
|
||||
|
||||
expect { described_class.call(params) }
|
||||
expect { described_class.call(**params) }
|
||||
.to change { Rpush::Client::Redis::Notification.all.count }.by(2)
|
||||
.and change(PushNotifications::DeliverWorker.jobs, :size).by(1)
|
||||
end
|
||||
|
|
@ -75,7 +75,7 @@ RSpec.describe PushNotifications::Send, type: :service do
|
|||
end
|
||||
|
||||
it "creates a notification and enqueues it" do
|
||||
expect { described_class.call(many_targets_params) }
|
||||
expect { described_class.call(**many_targets_params) }
|
||||
.to change { Rpush::Client::Redis::Notification.all.count }.by(2)
|
||||
.and change { PushNotifications::DeliverWorker.jobs.size }.by(1)
|
||||
end
|
||||
|
|
@ -83,7 +83,7 @@ RSpec.describe PushNotifications::Send, type: :service do
|
|||
it "creates a single notification for each of the user's devices when they have multiple" do
|
||||
create(:device, user: user)
|
||||
|
||||
expect { described_class.call(many_targets_params) }
|
||||
expect { described_class.call(**many_targets_params) }
|
||||
.to change { Rpush::Client::Redis::Notification.all.count }.by(3)
|
||||
.and change { PushNotifications::DeliverWorker.jobs.size }.by(1)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ RSpec.describe Slack::Announcer, type: :service do
|
|||
username: "",
|
||||
icon_emoji: ":o:"
|
||||
}
|
||||
expect(described_class.call(params)).to be_nil
|
||||
expect(described_class.call(**params)).to be_nil
|
||||
expect(SlackClient).not_to have_received(:ping)
|
||||
end
|
||||
|
||||
|
|
@ -25,7 +25,7 @@ RSpec.describe Slack::Announcer, type: :service do
|
|||
icon_emoji: ":o:"
|
||||
}
|
||||
|
||||
described_class.call(params)
|
||||
described_class.call(**params)
|
||||
|
||||
expect(SlackClient).to have_received(:ping)
|
||||
.with(message, params.reject { |k| k == :message })
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ RSpec.describe Slack::Messengers::ArticleFetchedFeed, type: :service do
|
|||
|
||||
it "contains the correct info", :aggregate_failures do
|
||||
sidekiq_assert_enqueued_jobs(1, only: Slack::Messengers::Worker) do
|
||||
described_class.call(default_params)
|
||||
described_class.call(**default_params)
|
||||
end
|
||||
|
||||
job = sidekiq_enqueued_jobs(worker: Slack::Messengers::Worker).last
|
||||
|
|
@ -32,7 +32,7 @@ RSpec.describe Slack::Messengers::ArticleFetchedFeed, type: :service do
|
|||
|
||||
it "messages the proper channel with the proper username and emoji", :aggregate_failures do
|
||||
sidekiq_assert_enqueued_jobs(1, only: Slack::Messengers::Worker) do
|
||||
described_class.call(default_params)
|
||||
described_class.call(**default_params)
|
||||
end
|
||||
|
||||
job = sidekiq_enqueued_jobs(worker: Slack::Messengers::Worker).last
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ RSpec.describe Slack::Messengers::ArticlePublished, type: :service do
|
|||
|
||||
it "contains the correct info", :aggregate_failures do
|
||||
sidekiq_assert_enqueued_jobs(1, only: Slack::Messengers::Worker) do
|
||||
described_class.call(default_params)
|
||||
described_class.call(**default_params)
|
||||
end
|
||||
|
||||
job = sidekiq_enqueued_jobs(worker: Slack::Messengers::Worker).last
|
||||
|
|
@ -46,7 +46,7 @@ RSpec.describe Slack::Messengers::ArticlePublished, type: :service do
|
|||
allow(SiteConfig).to receive(:article_published_slack_channel).and_return(channel)
|
||||
|
||||
sidekiq_assert_enqueued_jobs(1, only: Slack::Messengers::Worker) do
|
||||
described_class.call(default_params)
|
||||
described_class.call(**default_params)
|
||||
end
|
||||
|
||||
job = sidekiq_enqueued_jobs(worker: Slack::Messengers::Worker).last
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ RSpec.describe Slack::Messengers::CommentUserWarned, type: :service do
|
|||
|
||||
it "contains the correct info", :aggregate_failures do
|
||||
sidekiq_assert_enqueued_jobs(1, only: Slack::Messengers::Worker) do
|
||||
described_class.call(default_params)
|
||||
described_class.call(**default_params)
|
||||
end
|
||||
|
||||
job = sidekiq_enqueued_jobs(worker: Slack::Messengers::Worker).last
|
||||
|
|
@ -37,7 +37,7 @@ RSpec.describe Slack::Messengers::CommentUserWarned, type: :service do
|
|||
|
||||
it "messages the proper channel with the proper username and emoji", :aggregate_failures do
|
||||
sidekiq_assert_enqueued_jobs(1, only: Slack::Messengers::Worker) do
|
||||
described_class.call(default_params)
|
||||
described_class.call(**default_params)
|
||||
end
|
||||
|
||||
job = sidekiq_enqueued_jobs(worker: Slack::Messengers::Worker).last
|
||||
|
|
|
|||
|
|
@ -18,13 +18,13 @@ RSpec.describe Slack::Messengers::Feedback, type: :service do
|
|||
|
||||
it "supports an anonymous report" do
|
||||
sidekiq_assert_enqueued_jobs(1, only: Slack::Messengers::Worker) do
|
||||
described_class.call(default_params)
|
||||
described_class.call(**default_params)
|
||||
end
|
||||
end
|
||||
|
||||
it "contains user's details", :aggregate_failures do
|
||||
sidekiq_assert_enqueued_jobs(1, only: Slack::Messengers::Worker) do
|
||||
described_class.call(default_params.merge(user: user))
|
||||
described_class.call(**default_params.merge(user: user))
|
||||
end
|
||||
|
||||
message = get_argument_from_last_job("message")
|
||||
|
|
@ -36,7 +36,7 @@ RSpec.describe Slack::Messengers::Feedback, type: :service do
|
|||
|
||||
it "contains report information", :aggregate_failures do
|
||||
sidekiq_assert_enqueued_jobs(1, only: Slack::Messengers::Worker) do
|
||||
described_class.call(default_params.merge(user: user))
|
||||
described_class.call(**default_params.merge(user: user))
|
||||
end
|
||||
|
||||
message = get_argument_from_last_job("message")
|
||||
|
|
@ -53,7 +53,7 @@ RSpec.describe Slack::Messengers::Feedback, type: :service do
|
|||
|
||||
it "messages the proper channel with the proper username" do
|
||||
sidekiq_assert_enqueued_jobs(1, only: Slack::Messengers::Worker) do
|
||||
described_class.call(default_params)
|
||||
described_class.call(**default_params)
|
||||
end
|
||||
|
||||
channel = get_argument_from_last_job("channel")
|
||||
|
|
@ -65,7 +65,7 @@ RSpec.describe Slack::Messengers::Feedback, type: :service do
|
|||
|
||||
it "uses the cry emoji for abuse reports" do
|
||||
sidekiq_assert_enqueued_jobs(1, only: Slack::Messengers::Worker) do
|
||||
described_class.call(default_params.merge(type: "abuse-reports"))
|
||||
described_class.call(**default_params.merge(type: "abuse-reports"))
|
||||
end
|
||||
|
||||
icon_emoji = get_argument_from_last_job("icon_emoji")
|
||||
|
|
@ -74,7 +74,7 @@ RSpec.describe Slack::Messengers::Feedback, type: :service do
|
|||
|
||||
it "uses the robot face emoji for other reports" do
|
||||
sidekiq_assert_enqueued_jobs(1, only: Slack::Messengers::Worker) do
|
||||
described_class.call(default_params.merge(type: "other"))
|
||||
described_class.call(**default_params.merge(type: "other"))
|
||||
end
|
||||
|
||||
icon_emoji = get_argument_from_last_job("icon_emoji")
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ RSpec.describe Slack::Messengers::Note, type: :service do
|
|||
|
||||
it "contains the correct info", :aggregate_failures do
|
||||
sidekiq_assert_enqueued_jobs(1, only: Slack::Messengers::Worker) do
|
||||
described_class.call(default_params)
|
||||
described_class.call(**default_params)
|
||||
end
|
||||
|
||||
job = sidekiq_enqueued_jobs(worker: Slack::Messengers::Worker).last
|
||||
|
|
@ -32,7 +32,7 @@ RSpec.describe Slack::Messengers::Note, type: :service do
|
|||
|
||||
it "messages the proper channel with the proper username and emoji", :aggregate_failures do
|
||||
sidekiq_assert_enqueued_jobs(1, only: Slack::Messengers::Worker) do
|
||||
described_class.call(default_params)
|
||||
described_class.call(**default_params)
|
||||
end
|
||||
|
||||
job = sidekiq_enqueued_jobs(worker: Slack::Messengers::Worker).last
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ RSpec.describe Slack::Messengers::PotentialSpammer, type: :service do
|
|||
|
||||
it "contains the correct info", :aggregate_failures do
|
||||
sidekiq_assert_enqueued_jobs(1, only: Slack::Messengers::Worker) do
|
||||
described_class.call(default_params)
|
||||
described_class.call(**default_params)
|
||||
end
|
||||
|
||||
job = sidekiq_enqueued_jobs(worker: Slack::Messengers::Worker).last
|
||||
|
|
@ -18,7 +18,7 @@ RSpec.describe Slack::Messengers::PotentialSpammer, type: :service do
|
|||
|
||||
it "messages the proper channel with the proper username and emoji", :aggregate_failures do
|
||||
sidekiq_assert_enqueued_jobs(1, only: Slack::Messengers::Worker) do
|
||||
described_class.call(default_params)
|
||||
described_class.call(**default_params)
|
||||
end
|
||||
|
||||
job = sidekiq_enqueued_jobs(worker: Slack::Messengers::Worker).last
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ RSpec.describe Slack::Messengers::ReactionVomit, type: :service do
|
|||
|
||||
it "contains the correct info", :aggregate_failures do
|
||||
sidekiq_assert_enqueued_jobs(1, only: Slack::Messengers::Worker) do
|
||||
described_class.call(default_params)
|
||||
described_class.call(**default_params)
|
||||
end
|
||||
|
||||
job = sidekiq_enqueued_jobs(worker: Slack::Messengers::Worker).last
|
||||
|
|
@ -29,7 +29,7 @@ RSpec.describe Slack::Messengers::ReactionVomit, type: :service do
|
|||
|
||||
it "messages the proper channel with the proper username and emoji", :aggregate_failures do
|
||||
sidekiq_assert_enqueued_jobs(1, only: Slack::Messengers::Worker) do
|
||||
described_class.call(default_params)
|
||||
described_class.call(**default_params)
|
||||
end
|
||||
|
||||
job = sidekiq_enqueued_jobs(worker: Slack::Messengers::Worker).last
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ RSpec.describe Slack::Messengers::Sponsorship, type: :service do
|
|||
|
||||
it "contains the correct info for a regular sponsorship", :aggregate_failures do
|
||||
sidekiq_assert_enqueued_jobs(1, only: Slack::Messengers::Worker) do
|
||||
described_class.call(default_params)
|
||||
described_class.call(**default_params)
|
||||
end
|
||||
|
||||
message = get_argument_from_last_job("message")
|
||||
|
|
@ -32,7 +32,7 @@ RSpec.describe Slack::Messengers::Sponsorship, type: :service do
|
|||
|
||||
it "contains the correct info for a tag sponsorship", :aggregate_failures do
|
||||
sidekiq_assert_enqueued_jobs(1, only: Slack::Messengers::Worker) do
|
||||
described_class.call(default_params.merge(level: "tag", tag: tag))
|
||||
described_class.call(**default_params.merge(level: "tag", tag: tag))
|
||||
end
|
||||
|
||||
message = get_argument_from_last_job("message")
|
||||
|
|
@ -45,7 +45,7 @@ RSpec.describe Slack::Messengers::Sponsorship, type: :service do
|
|||
|
||||
it "messages the proper channel with the proper username and emoji", :aggregate_failures do
|
||||
sidekiq_assert_enqueued_jobs(1, only: Slack::Messengers::Worker) do
|
||||
described_class.call(default_params)
|
||||
described_class.call(**default_params)
|
||||
end
|
||||
|
||||
job = sidekiq_enqueued_jobs(worker: Slack::Messengers::Worker).last
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ RSpec.describe Users::Delete, type: :service do
|
|||
described_class.call(user)
|
||||
aggregate_failures "associations should exist" do
|
||||
kept_associations.each do |kept_association|
|
||||
expect { kept_association.reload }.not_to raise_error, kept_association
|
||||
expect { kept_association.reload }.not_to raise_error
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -163,7 +163,7 @@ RSpec.describe Users::Delete, type: :service do
|
|||
described_class.call(user)
|
||||
aggregate_failures "associations should not exist" do
|
||||
user_associations.each do |user_association|
|
||||
expect { user_association.reload }.to raise_error(ActiveRecord::RecordNotFound), user_association
|
||||
expect { user_association.reload }.to raise_error(ActiveRecord::RecordNotFound)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ RSpec.describe Users::RemoveRole, type: :service do
|
|||
role = super_admin.roles.first.name.to_sym
|
||||
resource_type = nil
|
||||
args = { user: super_admin, role: role, resource_type: resource_type, admin: current_user }
|
||||
role_removal = described_class.call(args)
|
||||
role_removal = described_class.call(**args)
|
||||
|
||||
expect(role_removal.success).to be false
|
||||
expect(role_removal.error_message).to eq "Super Admin roles cannot be removed."
|
||||
|
|
@ -21,7 +21,7 @@ RSpec.describe Users::RemoveRole, type: :service do
|
|||
role = current_user.roles.first
|
||||
resource_type = nil
|
||||
args = { user: current_user, role: role, resource_type: resource_type, admin: current_user }
|
||||
role_removal = described_class.call(args)
|
||||
role_removal = described_class.call(**args)
|
||||
|
||||
expect(role_removal.success).to be false
|
||||
expect(role_removal.error_message).to eq "Admins cannot remove roles from themselves."
|
||||
|
|
@ -33,7 +33,7 @@ RSpec.describe Users::RemoveRole, type: :service do
|
|||
role = user.roles.first
|
||||
resource_type = nil
|
||||
args = { user: user, role: role, resource_type: resource_type, admin: current_user }
|
||||
role_removal = described_class.call(args)
|
||||
role_removal = described_class.call(**args)
|
||||
|
||||
expect(role_removal.success).to be true
|
||||
expect(role_removal.error_message).to be_nil
|
||||
|
|
@ -45,7 +45,7 @@ RSpec.describe Users::RemoveRole, type: :service do
|
|||
role = user.roles.first
|
||||
resource_type = "Comment"
|
||||
args = { user: user, role: role, resource_type: resource_type, admin: current_user }
|
||||
role_removal = described_class.call(args)
|
||||
role_removal = described_class.call(**args)
|
||||
|
||||
expect(role_removal.success).to be true
|
||||
expect(role_removal.error_message).to be_nil
|
||||
|
|
@ -56,7 +56,7 @@ RSpec.describe Users::RemoveRole, type: :service do
|
|||
user = create(:user)
|
||||
allow(user).to receive(:remove_role).and_raise(StandardError)
|
||||
args = { user: user, role: nil, resource_type: nil, admin: current_user }
|
||||
role_removal = described_class.call(args)
|
||||
role_removal = described_class.call(**args)
|
||||
|
||||
expect(role_removal.success).to be false
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue