Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-02-20 12:08:30 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-02-20 12:08:30 +0300
commitbd28d0fa02dc73794e013159512900f8d10fa10b (patch)
tree57ca25e2ecb1f6d379f9738ccc140fa1c624e6c3 /spec/models
parent24e54a8f10e88aafa48c8a7dc548576939e6612b (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/abuse_report_spec.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/models/abuse_report_spec.rb b/spec/models/abuse_report_spec.rb
index 7995cc36383..87a0a2a492c 100644
--- a/spec/models/abuse_report_spec.rb
+++ b/spec/models/abuse_report_spec.rb
@@ -70,6 +70,34 @@ RSpec.describe AbuseReport, feature_category: :insider_threat do
}
end
+ describe 'scopes' do
+ let!(:reporter) { create(:user, username: 'reporter') }
+ let!(:report1) { create(:abuse_report) }
+ let!(:report2) { create(:abuse_report, :closed, reporter: reporter, category: 'phishing') }
+
+ describe '.open' do
+ subject(:results) { described_class.open }
+
+ it 'returns reports without resolved_at value' do
+ expect(subject).to match_array([report, report1])
+ end
+ end
+
+ describe '.closed' do
+ subject(:results) { described_class.closed }
+
+ it 'returns reports with resolved_at value' do
+ expect(subject).to match_array([report2])
+ end
+ end
+
+ describe '.by_category' do
+ it 'returns abuse reports with the specified category' do
+ expect(described_class.by_category('phishing')).to match_array([report2])
+ end
+ end
+ end
+
describe 'before_validation' do
context 'when links to spam contains empty strings' do
let(:report) { create(:abuse_report, links_to_spam: ['', 'https://gitlab.com']) }