debian-mirror-gitlab/spec/serializers/admin/abuse_report_entity_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

41 lines
959 B
Ruby
Raw Permalink Normal View History

2023-05-27 22:25:52 +05:30
# frozen_string_literal: true
require "spec_helper"
RSpec.describe Admin::AbuseReportEntity, feature_category: :insider_threat do
2023-06-20 00:43:36 +05:30
include Gitlab::Routing
let(:abuse_report) { build_stubbed(:abuse_report) }
2023-05-27 22:25:52 +05:30
let(:entity) do
described_class.new(abuse_report)
end
describe '#as_json' do
subject(:entity_hash) { entity.as_json }
it 'exposes correct attributes' do
expect(entity_hash.keys).to include(
:category,
2023-06-20 00:43:36 +05:30
:created_at,
2023-05-27 22:25:52 +05:30
:updated_at,
:reported_user,
2023-06-20 00:43:36 +05:30
:reporter,
2023-07-09 08:55:56 +05:30
:report_path
2023-05-27 22:25:52 +05:30
)
end
it 'correctly exposes `reported user`' do
2023-07-09 08:55:56 +05:30
expect(entity_hash[:reported_user].keys).to match_array([:name])
2023-05-27 22:25:52 +05:30
end
it 'correctly exposes `reporter`' do
expect(entity_hash[:reporter].keys).to match_array([:name])
end
2023-06-20 00:43:36 +05:30
2023-07-09 08:55:56 +05:30
it 'correctly exposes :report_path' do
expect(entity_hash[:report_path]).to eq admin_abuse_report_path(abuse_report)
2023-06-20 00:43:36 +05:30
end
2023-05-27 22:25:52 +05:30
end
end