Rubocop fixes (#11862)

This commit is contained in:
Anna Buianova 2020-12-11 17:36:42 +03:00 committed by GitHub
parent f8a8e0320b
commit f4c88341ce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 7 additions and 8 deletions

View file

@ -103,10 +103,9 @@ class Tag < ActsAsTaggableOn::Tag
def calculate_hotness_score
self.hotness_score = Article.tagged_with(name)
.where("articles.featured_number > ?", 7.days.ago.to_i)
.map do |article|
.sum do |article|
(article.comments_count * 14) + article.score + rand(6) + ((taggings_count + 1) / 2)
end
.sum
end
def bust_cache

View file

@ -24,7 +24,7 @@ module Audit
# end
def notify(listener, &block)
return unless block_given?
return unless block
ActiveSupport::Notifications.instrument(instrument_name(listener), Audit::Event::Payload.new(&block))
end

View file

@ -17,9 +17,8 @@ module DataUpdateScripts
n = index + 300 # + 300 gives the server time to boot up
BustCachePathWorker.set(queue: :high_priority).perform_in(n.seconds, "#{article.path}?i=i")
end
relation.offset(1500).limit(3000).each_with_index do |article, index|
relation.offset(1500).limit(3000).each_with_index do |article, index|
n = (index * 3) + 450
BustCachePathWorker.set(queue: :medium_priority).perform_in(n.seconds, "#{article.path}?i=i")
end

View file

@ -6,9 +6,9 @@ require Rails.root.join(
describe DataUpdateScripts::SetOnboardingProfileFieldsForExistingForems do
before do
ProfileField.destroy_all
create(:user)
end
let!(:user) { create(:user) }
let!(:profile_field1) { create(:profile_field, label: "summary") }
let!(:profile_field2) { create(:profile_field, label: "random") }
let(:profile_field3) { create(:profile_field, label: "location") }

View file

@ -324,7 +324,8 @@ RSpec.describe "Reactions", type: :request do
it "converts field test" do
post "/reactions", params: article_params
expect(Users::RecordFieldTestEventWorker).to have_received(:perform_async).with(user.id, :follow_implicit_points,
expect(Users::RecordFieldTestEventWorker).to have_received(:perform_async).with(user.id,
:follow_implicit_points,
"user_creates_reaction")
end
end

View file

@ -17,7 +17,7 @@ RSpec.describe Authentication::Providers, type: :service do
end
it "loads the correct provider class" do
allow(SiteConfig).to receive(:authentication_providers).and_return(Authentication::Providers.available)
allow(SiteConfig).to receive(:authentication_providers).and_return(described_class.available)
is_subclass_of = (
described_class.get!(:twitter) < Authentication::Providers::Provider