diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-11 18:06:27 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-11 18:06:27 +0000 |
commit | ff67e3ed08355fb2d6f6e69d4ed06cd09052e573 (patch) | |
tree | 97ac29ddd32b612343b34bbdd6b8d57526b3d308 /spec/finders | |
parent | 7071f9bf3e131a7a668922ee450da529f1866b6f (diff) | |
download | gitlab-ce-ff67e3ed08355fb2d6f6e69d4ed06cd09052e573.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/finders')
-rw-r--r-- | spec/finders/abuse_reports_finder_spec.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/finders/abuse_reports_finder_spec.rb b/spec/finders/abuse_reports_finder_spec.rb new file mode 100644 index 00000000000..c84a645ca08 --- /dev/null +++ b/spec/finders/abuse_reports_finder_spec.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe AbuseReportsFinder, '#execute' do + let(:params) { {} } + let!(:user1) { create(:user) } + let!(:user2) { create(:user) } + let!(:abuse_report_1) { create(:abuse_report, user: user1) } + let!(:abuse_report_2) { create(:abuse_report, user: user2) } + + subject { described_class.new(params).execute } + + context 'empty params' do + it 'returns all abuse reports' do + expect(subject).to match_array([abuse_report_1, abuse_report_2]) + end + end + + context 'params[:user_id] is present' do + let(:params) { { user_id: user2 } } + + it 'returns abuse reports for the specified user' do + expect(subject).to match_array([abuse_report_2]) + end + end +end |