diff --git a/app/models/abuse_report.rb b/app/models/abuse_report.rb index 413d4bb34081310a4bc09417a48d0fe27d9f9141..3c5aa01d909a9543280f1e0b7c45b4a745d22219 100644 --- a/app/models/abuse_report.rb +++ b/app/models/abuse_report.rb @@ -27,10 +27,10 @@ class AbuseReport < MainClusterwide::ApplicationRecord has_many :admin_abuse_report_assignees, class_name: "Admin::AbuseReportAssignee" has_many :assignees, class_name: "User", through: :admin_abuse_report_assignees - has_many :abuse_events, class_name: 'Abuse::Event', inverse_of: :abuse_report + has_many :abuse_events, class_name: 'AntiAbuse::Event', inverse_of: :abuse_report has_many :notes, as: :noteable - has_many :user_mentions, class_name: 'Abuse::Reports::UserMention' + has_many :user_mentions, class_name: 'AntiAbuse::Reports::UserMention' validates :reporter, presence: true, on: :create validates :user, presence: true, on: :create diff --git a/app/models/abuse/event.rb b/app/models/anti_abuse/event.rb similarity index 97% rename from app/models/abuse/event.rb rename to app/models/anti_abuse/event.rb index 63a0e311a3db853211434c08602e1f5c048d447e..ee6c44d9dbdf6dafe54cddf597b1ce2174e840bb 100644 --- a/app/models/abuse/event.rb +++ b/app/models/anti_abuse/event.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Abuse +module AntiAbuse class Event < MainClusterwide::ApplicationRecord self.table_name = 'abuse_events' diff --git a/app/models/abuse/reports/user_mention.rb b/app/models/anti_abuse/reports/user_mention.rb similarity index 93% rename from app/models/abuse/reports/user_mention.rb rename to app/models/anti_abuse/reports/user_mention.rb index e8091089ede4f54d4a6f2780b2eb0934967249d4..74469377985d731f0f76889b6452a72a983f98c8 100644 --- a/app/models/abuse/reports/user_mention.rb +++ b/app/models/anti_abuse/reports/user_mention.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Abuse +module AntiAbuse module Reports class UserMention < UserMention self.table_name = 'abuse_report_user_mentions' diff --git a/app/models/abuse/trust_score.rb b/app/models/anti_abuse/trust_score.rb similarity index 78% rename from app/models/abuse/trust_score.rb rename to app/models/anti_abuse/trust_score.rb index 9908e2e7a04c102ac6323a3b9f6d31dbdc2d7ed9..351332a3942cd25e04e3cc9c6818bbd06fa4a3bb 100644 --- a/app/models/abuse/trust_score.rb +++ b/app/models/anti_abuse/trust_score.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Abuse +module AntiAbuse class TrustScore < MainClusterwide::ApplicationRecord self.table_name = 'abuse_trust_scores' @@ -21,11 +21,11 @@ class TrustScore < MainClusterwide::ApplicationRecord private def assign_correlation_id - self.correlation_id_value ||= (Labkit::Correlation::CorrelationId.current_id || '') + self.correlation_id_value ||= Labkit::Correlation::CorrelationId.current_id || '' end def remove_old_scores - Abuse::UserTrustScore.new(user).remove_old_scores(source) + AntiAbuse::UserTrustScore.new(user).remove_old_scores(source) end end end diff --git a/app/models/abuse/user_trust_score.rb b/app/models/anti_abuse/user_trust_score.rb similarity index 90% rename from app/models/abuse/user_trust_score.rb rename to app/models/anti_abuse/user_trust_score.rb index 3a935e230ae0cdec8aca3290907a9a956aa0b592..a2add9d4c9e346a21c63d89c76d7e003f199bd34 100644 --- a/app/models/abuse/user_trust_score.rb +++ b/app/models/anti_abuse/user_trust_score.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Abuse +module AntiAbuse class UserTrustScore MAX_EVENTS = 100 SPAMCHECK_HAM_THRESHOLD = 0.5 @@ -37,7 +37,7 @@ def remove_old_scores(source) count = trust_scores_for_source(source).count return unless count > MAX_EVENTS - Abuse::TrustScore.delete( + AntiAbuse::TrustScore.delete( trust_scores_for_source(source) .order_created_at_asc .limit(count - MAX_EVENTS) @@ -47,7 +47,7 @@ def remove_old_scores(source) private def user_scores - Abuse::TrustScore.where(user_id: @user.id) + AntiAbuse::TrustScore.where(user_id: @user.id) end end end diff --git a/app/models/user.rb b/app/models/user.rb index 2351c710ed8f7102cbc2ab68cdeeb1e1ad333298..cc9d84dd45d30f2f52e5ef9854a375128911dc79 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -246,9 +246,9 @@ def update_tracked_fields!(request) has_many :assigned_abuse_reports, class_name: "AbuseReport", through: :admin_abuse_report_assignees, source: :abuse_report has_many :reported_abuse_reports, dependent: :nullify, foreign_key: :reporter_id, class_name: "AbuseReport", inverse_of: :reporter # rubocop:disable Cop/ActiveRecordDependent has_many :resolved_abuse_reports, foreign_key: :resolved_by_id, class_name: "AbuseReport", inverse_of: :resolved_by - has_many :abuse_events, foreign_key: :user_id, class_name: 'Abuse::Event', inverse_of: :user + has_many :abuse_events, foreign_key: :user_id, class_name: 'AntiAbuse::Event', inverse_of: :user has_many :spam_logs, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent - has_many :abuse_trust_scores, class_name: 'Abuse::TrustScore', foreign_key: :user_id + has_many :abuse_trust_scores, class_name: 'AntiAbuse::TrustScore', foreign_key: :user_id has_many :builds, class_name: 'Ci::Build' has_many :pipelines, class_name: 'Ci::Pipeline' has_many :todos, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent @@ -2499,7 +2499,7 @@ def optional_namespace? end def block_or_ban - user_scores = Abuse::UserTrustScore.new(self) + user_scores = AntiAbuse::UserTrustScore.new(self) if user_scores.spammer? && account_age_in_days < 7 ban_and_report else diff --git a/app/workers/abuse/spam_abuse_events_worker.rb b/app/workers/abuse/spam_abuse_events_worker.rb index 7d86e994ae47d8e8614b42caeffa496a6ba75b7d..65c669abfdba8db955f13325369ccdb36c6a7d63 100644 --- a/app/workers/abuse/spam_abuse_events_worker.rb +++ b/app/workers/abuse/spam_abuse_events_worker.rb @@ -43,7 +43,7 @@ def report_user(params) # Associate the abuse report with an abuse event def create_abuse_event(abuse_report_id, params) - Abuse::Event.create!( + AntiAbuse::Event.create!( abuse_report_id: abuse_report_id, category: :spam, metadata: { noteable_type: params[:noteable_type], diff --git a/app/workers/abuse/trust_score_worker.rb b/app/workers/abuse/trust_score_worker.rb index 061042ffa8a3c4e4d75a4eb123ec8fe55f089f0c..05742cd21b5a898fe3df76a9a935b45cf6a7fdf4 100644 --- a/app/workers/abuse/trust_score_worker.rb +++ b/app/workers/abuse/trust_score_worker.rb @@ -17,7 +17,7 @@ def perform(user_id, source, score, correlation_id = '') return end - Abuse::TrustScore.create!(user: user, source: source, score: score.to_f, correlation_id_value: correlation_id) + AntiAbuse::TrustScore.create!(user: user, source: source, score: score.to_f, correlation_id_value: correlation_id) end end end diff --git a/db/docs/abuse_events.yml b/db/docs/abuse_events.yml index 7bc509133e2b68b05d615be8998177d601e2dc2d..52e54bce5e6e8840f52c8b0fd37abdbbdee0a78f 100644 --- a/db/docs/abuse_events.yml +++ b/db/docs/abuse_events.yml @@ -1,7 +1,7 @@ --- table_name: abuse_events classes: -- Abuse::Event +- AntiAbuse::Event feature_categories: - insider_threat description: Captures events of potential abuse diff --git a/db/docs/abuse_report_user_mentions.yml b/db/docs/abuse_report_user_mentions.yml index 6c0ceb61351bb92ee813d3894c44583fb87ffad9..153597e32b91c1860e124c93905f20636fdd296d 100644 --- a/db/docs/abuse_report_user_mentions.yml +++ b/db/docs/abuse_report_user_mentions.yml @@ -1,7 +1,7 @@ --- table_name: abuse_report_user_mentions classes: -- Abuse::Reports::UserMention +- AntiAbuse::Reports::UserMention feature_categories: - insider_threat description: User mentions in abuse report notes diff --git a/db/docs/abuse_trust_scores.yml b/db/docs/abuse_trust_scores.yml index 5b145d77a84ba0cafd9587bc5bc16cdf744209c8..d4e70ae993f811aaa83c1a9cc16bf2cd396b765b 100644 --- a/db/docs/abuse_trust_scores.yml +++ b/db/docs/abuse_trust_scores.yml @@ -1,7 +1,7 @@ --- table_name: abuse_trust_scores classes: -- Abuse::TrustScore +- AntiAbuse::TrustScore feature_categories: - instance_resiliency description: Aggregates per-user scores related to potential product abuse. diff --git a/doc/development/software_design.md b/doc/development/software_design.md index e9919ccf9c806d8918862a104c6769a9b08c080f..1e0b83f013599a8ed39a0a46ce074474973a622d 100644 --- a/doc/development/software_design.md +++ b/doc/development/software_design.md @@ -253,7 +253,7 @@ class User def spammer? # Warning sign: we use a constant that belongs to a specific bounded context! - spam_score > Abuse::TrustScore::SPAMCHECK_HAM_THRESHOLD + spam_score > AntiAbuse::TrustScore::SPAMCHECK_HAM_THRESHOLD end def telesign_score @@ -279,7 +279,7 @@ user.arkose_global_score ```ruby ## # GOOD: Define a thin class that represents a user trust score -class Abuse::UserTrustScore +class AntiAbuse::UserTrustScore def initialize(user) @user = user end @@ -289,7 +289,7 @@ class Abuse::UserTrustScore end def spammer? - spam > Abuse::TrustScore::SPAMCHECK_HAM_THRESHOLD + spam > AntiAbuse::TrustScore::SPAMCHECK_HAM_THRESHOLD end def telesign @@ -307,13 +307,13 @@ class Abuse::UserTrustScore private def scores - Abuse::TrustScore.for_user(@user) + AntiAbuse::TrustScore.for_user(@user) end end # Usage: user = User.find(1) -user_score = Abuse::UserTrustScore.new(user) +user_score = AntiAbuse::UserTrustScore.new(user) user_score.spam user_score.spammer? user_score.telesign diff --git a/ee/spec/services/arkose/record_user_data_service_spec.rb b/ee/spec/services/arkose/record_user_data_service_spec.rb index 67a12d96c8412b3139a45cd2cc3476d495eda038..a36a3475249645005bb8f8eecadeb248c6fc1a66 100644 --- a/ee/spec/services/arkose/record_user_data_service_spec.rb +++ b/ee/spec/services/arkose/record_user_data_service_spec.rb @@ -11,7 +11,7 @@ let(:response) { Arkose::VerifyResponse.new(arkose_verify_response) } let(:service) { described_class.new(response: response, user: user) } - let(:user_scores) { Abuse::UserTrustScore.new(user) } + let(:user_scores) { AntiAbuse::UserTrustScore.new(user) } describe '#execute' do it 'adds new custom attributes to the user' do diff --git a/ee/spec/services/phone_verification/users/send_verification_code_service_spec.rb b/ee/spec/services/phone_verification/users/send_verification_code_service_spec.rb index 7b654c8022af7a7912bbe742b5f749c37f35989c..288af676956228da9bfa1319dc408c385a1fb28e 100644 --- a/ee/spec/services/phone_verification/users/send_verification_code_service_spec.rb +++ b/ee/spec/services/phone_verification/users/send_verification_code_service_spec.rb @@ -510,7 +510,7 @@ end it 'does not store risk score in abuse trust scores' do - expect { service.execute }.not_to change { Abuse::TrustScore.count } + expect { service.execute }.not_to change { AntiAbuse::TrustScore.count } end end end diff --git a/ee/spec/workers/abuse/new_abuse_report_worker_spec.rb b/ee/spec/workers/abuse/new_abuse_report_worker_spec.rb index b8a3290545a4c187c8cabe419f5f2734b0196091..5324d160401b32c9df8b683494701807521b77d6 100644 --- a/ee/spec/workers/abuse/new_abuse_report_worker_spec.rb +++ b/ee/spec/workers/abuse/new_abuse_report_worker_spec.rb @@ -55,21 +55,15 @@ end context 'when the user is a member of a namespace with a paid plan trial subscription' do - let_it_be(:trial_group) { create(:group_with_plan, plan: :ultimate_plan, trial_ends_on: 1.day.from_now) } - - before do - trial_group.add_reporter(user) + let_it_be(:trial_group) do + create(:group_with_plan, plan: :ultimate_plan, trial_ends_on: 1.day.from_now, reporters: user) end it_behaves_like 'bans user' end context 'when the user is a member of a namespace with a paid plan subscription' do - let_it_be(:paid_group) { create(:group_with_plan, plan: :ultimate_plan) } - - before do - paid_group.add_reporter(user) - end + let_it_be(:paid_group) { create(:group_with_plan, plan: :ultimate_plan, reporters: user) } it_behaves_like 'does not ban user' end @@ -125,12 +119,7 @@ end context 'when user owns namespaces with more than five members' do - let_it_be(:group) { create(:group) } - - before do - group.add_owner(user) - 5.times { group.add_guest(create(:user)) } - end + let_it_be(:group) { create(:group, owners: user, guests: create_list(:user, 5)) } it_behaves_like 'does not ban user' end diff --git a/spec/factories/abuse/event.rb b/spec/factories/anti_abuse/event.rb similarity index 77% rename from spec/factories/abuse/event.rb rename to spec/factories/anti_abuse/event.rb index 4bd1b97410e4f2a4a2ad8403cc878986c732092b..37e6125d46e5bbc3da4dd2e0c367b9c90ad09c81 100644 --- a/spec/factories/abuse/event.rb +++ b/spec/factories/anti_abuse/event.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true FactoryBot.define do - factory :abuse_event, class: 'Abuse::Event' do + factory :abuse_event, class: 'AntiAbuse::Event' do user category { :spam } source { :spamcheck } diff --git a/spec/factories/abuse/trust_score.rb b/spec/factories/anti_abuse/trust_score.rb similarity index 70% rename from spec/factories/abuse/trust_score.rb rename to spec/factories/anti_abuse/trust_score.rb index a5ea7666945cfc4a2cca75f60804bb2e14f1f055..fb93d1134413b196fe68dad7815ac47a0959661d 100644 --- a/spec/factories/abuse/trust_score.rb +++ b/spec/factories/anti_abuse/trust_score.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true FactoryBot.define do - factory :abuse_trust_score, class: 'Abuse::TrustScore' do + factory :abuse_trust_score, class: 'AntiAbuse::TrustScore' do user score { 0.1 } source { :spamcheck } diff --git a/spec/models/abuse_report_spec.rb b/spec/models/abuse_report_spec.rb index 4eb3bd32bfe7a4b28df21c5727b566621b6fd0fc..6ba1843247a4cbaa28576b1827e3a2ca76f60d64 100644 --- a/spec/models/abuse_report_spec.rb +++ b/spec/models/abuse_report_spec.rb @@ -18,7 +18,7 @@ it { is_expected.to belong_to(:user).inverse_of(:abuse_reports) } it { is_expected.to have_many(:events).class_name('ResourceEvents::AbuseReportEvent').inverse_of(:abuse_report) } it { is_expected.to have_many(:notes) } - it { is_expected.to have_many(:user_mentions).class_name('Abuse::Reports::UserMention') } + it { is_expected.to have_many(:user_mentions).class_name('AntiAbuse::Reports::UserMention') } it { is_expected.to have_many(:admin_abuse_report_assignees).class_name('Admin::AbuseReportAssignee') } it { is_expected.to have_many(:assignees).class_name('User').through(:admin_abuse_report_assignees) } diff --git a/spec/models/abuse/event_spec.rb b/spec/models/anti_abuse/event_spec.rb similarity index 93% rename from spec/models/abuse/event_spec.rb rename to spec/models/anti_abuse/event_spec.rb index 02527bf80bf44868f3c7c570c3926aa06dfc63b8..c310308e62845d499b528d57a6bd7a77556f1635 100644 --- a/spec/models/abuse/event_spec.rb +++ b/spec/models/anti_abuse/event_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Abuse::Event, type: :model, feature_category: :insider_threat do +RSpec.describe AntiAbuse::Event, type: :model, feature_category: :insider_threat do let_it_be(:event) { create(:abuse_event) } let_it_be(:user, reload: true) { create(:admin) } diff --git a/spec/models/abuse/reports/user_mention_spec.rb b/spec/models/anti_abuse/reports/user_mention_spec.rb similarity index 75% rename from spec/models/abuse/reports/user_mention_spec.rb rename to spec/models/anti_abuse/reports/user_mention_spec.rb index c504813438288636203ea7c8e38df6f7c2425af8..d142fe647aaa1b2ab5d3758178a299d31bcfe914 100644 --- a/spec/models/abuse/reports/user_mention_spec.rb +++ b/spec/models/anti_abuse/reports/user_mention_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Abuse::Reports::UserMention, feature_category: :insider_threat do +RSpec.describe AntiAbuse::Reports::UserMention, feature_category: :insider_threat do describe 'associations' do it { is_expected.to belong_to(:abuse_report).optional(false) } it { is_expected.to belong_to(:note).optional(false) } diff --git a/spec/models/abuse/trust_score_spec.rb b/spec/models/anti_abuse/trust_score_spec.rb similarity index 80% rename from spec/models/abuse/trust_score_spec.rb rename to spec/models/anti_abuse/trust_score_spec.rb index 85fffcc167ba41f5af6d1ee50375e422b2518f05..90c3f90893987f0b68b985288e7484d1d9d3b779 100644 --- a/spec/models/abuse/trust_score_spec.rb +++ b/spec/models/anti_abuse/trust_score_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Abuse::TrustScore, feature_category: :instance_resiliency do +RSpec.describe AntiAbuse::TrustScore, feature_category: :instance_resiliency do let_it_be(:user) { create(:user) } let(:correlation_id) { nil } @@ -30,7 +30,7 @@ context 'if correlation ID is nil' do it 'adds the correlation id' do - expect(subject.correlation_id_value).to eq('123abc') + expect(abuse_trust_score.correlation_id_value).to eq('123abc') end end @@ -38,7 +38,7 @@ let(:correlation_id) { 'already-set' } it 'does not change the correlation id' do - expect(subject.correlation_id_value).to eq('already-set') + expect(abuse_trust_score.correlation_id_value).to eq('already-set') end end end diff --git a/spec/models/abuse/user_trust_score_spec.rb b/spec/models/anti_abuse/user_trust_score_spec.rb similarity index 94% rename from spec/models/abuse/user_trust_score_spec.rb rename to spec/models/anti_abuse/user_trust_score_spec.rb index 6b2cfa6a50413e907625dbbd72b2fed191d64874..25bfe9dedf8e2778b04e7338371995ccd0a27057 100644 --- a/spec/models/abuse/user_trust_score_spec.rb +++ b/spec/models/anti_abuse/user_trust_score_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Abuse::UserTrustScore, feature_category: :instance_resiliency do +RSpec.describe AntiAbuse::UserTrustScore, feature_category: :instance_resiliency do let_it_be(:user1) { create(:user) } let_it_be(:user2) { create(:user) } let(:user_1_scores) { described_class.new(user1) } @@ -114,7 +114,7 @@ describe '#remove_old_scores' do context 'if max events is exceeded' do before do - stub_const('Abuse::UserTrustScore::MAX_EVENTS', 2) + stub_const('AntiAbuse::UserTrustScore::MAX_EVENTS', 2) end it 'removes the oldest events' do @@ -123,7 +123,7 @@ create(:abuse_trust_score, user: user1) expect(user1.abuse_trust_scores.count).to eq(2) - expect(Abuse::TrustScore.find_by_id(first.id)).to eq(nil) + expect(AntiAbuse::TrustScore.find_by_id(first.id)).to eq(nil) end end end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index f8cfce9c722d03ede1bec0646bbde03965c547c9..8e4c3d1e513f648df0995a10e106b79d51ea4429 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -184,7 +184,7 @@ it { is_expected.to have_many(:abuse_reports).dependent(:nullify).inverse_of(:user) } it { is_expected.to have_many(:reported_abuse_reports).dependent(:nullify).class_name('AbuseReport').inverse_of(:reporter) } it { is_expected.to have_many(:resolved_abuse_reports).class_name('AbuseReport').inverse_of(:resolved_by) } - it { is_expected.to have_many(:abuse_events).class_name('Abuse::Event').inverse_of(:user) } + it { is_expected.to have_many(:abuse_events).class_name('AntiAbuse::Event').inverse_of(:user) } it { is_expected.to have_many(:custom_attributes).class_name('UserCustomAttribute') } it { is_expected.to have_many(:releases).dependent(:nullify) } it { is_expected.to have_many(:reviews).inverse_of(:author) } @@ -204,7 +204,7 @@ it { is_expected.to have_many(:achievements).through(:user_achievements).class_name('Achievements::Achievement').inverse_of(:users) } it { is_expected.to have_many(:namespace_commit_emails).class_name('Users::NamespaceCommitEmail') } it { is_expected.to have_many(:audit_events).with_foreign_key(:author_id).inverse_of(:user) } - it { is_expected.to have_many(:abuse_trust_scores).class_name('Abuse::TrustScore') } + it { is_expected.to have_many(:abuse_trust_scores).class_name('AntiAbuse::TrustScore') } it { is_expected.to have_many(:issue_assignment_events).class_name('ResourceEvents::IssueAssignmentEvent') } it { is_expected.to have_many(:merge_request_assignment_events).class_name('ResourceEvents::MergeRequestAssignmentEvent') } it { is_expected.to have_many(:admin_abuse_report_assignees).class_name('Admin::AbuseReportAssignee') } @@ -6607,8 +6607,8 @@ def add_user(access) context 'when the user is a spammer' do before do - user_scores = Abuse::UserTrustScore.new(user) - allow(Abuse::UserTrustScore).to receive(:new).and_return(user_scores) + user_scores = AntiAbuse::UserTrustScore.new(user) + allow(AntiAbuse::UserTrustScore).to receive(:new).and_return(user_scores) allow(user_scores).to receive(:spammer?).and_return(true) end diff --git a/spec/workers/abuse/spam_abuse_events_worker_spec.rb b/spec/workers/abuse/spam_abuse_events_worker_spec.rb index 9198636e114a77a3203e5fb6304947dd0a75853c..a08a66e8765ebb8082ca3b16ab894ebf12373364 100644 --- a/spec/workers/abuse/spam_abuse_events_worker_spec.rb +++ b/spec/workers/abuse/spam_abuse_events_worker_spec.rb @@ -20,8 +20,8 @@ shared_examples 'creates an abuse event with the correct data' do it do - expect { worker.perform(params) }.to change { Abuse::Event.count }.from(0).to(1) - expect(Abuse::Event.last.attributes).to include({ + expect { worker.perform(params) }.to change { AntiAbuse::Event.count }.from(0).to(1) + expect(AntiAbuse::Event.last.attributes).to include({ abuse_report_id: report_id, category: "spam", metadata: params.except(:user_id), diff --git a/spec/workers/abuse/trust_score_worker_spec.rb b/spec/workers/abuse/trust_score_worker_spec.rb index adc582ada944a3d409842789189faf2618f664a8..6e657854667efc85ea81443d45f0e3102b0590a9 100644 --- a/spec/workers/abuse/trust_score_worker_spec.rb +++ b/spec/workers/abuse/trust_score_worker_spec.rb @@ -26,7 +26,7 @@ end it 'does not attempt to create the trust score' do - expect(Abuse::TrustScore).not_to receive(:create!) + expect(AntiAbuse::TrustScore).not_to receive(:create!) perform end @@ -34,8 +34,8 @@ context "when the user exists" do it 'creates an abuse trust score with the correct data' do - expect { perform }.to change { Abuse::TrustScore.count }.from(0).to(1) - expect(Abuse::TrustScore.last.attributes).to include({ + expect { perform }.to change { AntiAbuse::TrustScore.count }.from(0).to(1) + expect(AntiAbuse::TrustScore.last.attributes).to include({ user_id: user.id, source: "telesign", score: 0.85,