diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-30 00:08:53 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-30 00:08:53 +0300 |
commit | 31664a1a5ac22e8c56a471d3afab26e661efcc0e (patch) | |
tree | a300c578ef9877df4fdbe28774b509172d474ae0 /spec/serializers | |
parent | 511cd681d4ab0d4263df538b1800058edc07230e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/serializers')
-rw-r--r-- | spec/serializers/admin/abuse_report_entity_spec.rb | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/spec/serializers/admin/abuse_report_entity_spec.rb b/spec/serializers/admin/abuse_report_entity_spec.rb index 7972dbde4e9..760c12d3cf9 100644 --- a/spec/serializers/admin/abuse_report_entity_spec.rb +++ b/spec/serializers/admin/abuse_report_entity_spec.rb @@ -11,12 +11,19 @@ RSpec.describe Admin::AbuseReportEntity, feature_category: :insider_threat do described_class.new(abuse_report) end + before do + allow_next_instance_of(described_class) do |instance| + allow(instance).to receive(:markdown_field).with(abuse_report, :message).and_return(abuse_report.message) + end + end + describe '#as_json' do subject(:entity_hash) { entity.as_json } it 'exposes correct attributes' do expect(entity_hash.keys).to include( :category, + :created_at, :updated_at, :reported_user, :reporter, @@ -25,12 +32,13 @@ RSpec.describe Admin::AbuseReportEntity, feature_category: :insider_threat do :user_blocked, :block_user_path, :remove_report_path, - :remove_user_and_report_path + :remove_user_and_report_path, + :message ) end it 'correctly exposes `reported user`' do - expect(entity_hash[:reported_user].keys).to match_array([:name]) + expect(entity_hash[:reported_user].keys).to match_array([:name, :created_at]) end it 'correctly exposes `reporter`' do @@ -76,5 +84,9 @@ RSpec.describe Admin::AbuseReportEntity, feature_category: :insider_threat do it 'correctly exposes :remove_user_and_report_path' do expect(entity_hash[:remove_user_and_report_path]).to eq admin_abuse_report_path(abuse_report, remove_user: true) end + + it 'correctly exposes :message' do + expect(entity_hash[:message]).to eq(abuse_report.message) + end end end |