appeal_serializer_spec.rb 762 B

123456789101112131415161718192021222324252627
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe REST::AppealSerializer do
  4. subject { serialized_record_json(record, described_class) }
  5. describe 'state' do
  6. context 'when appeal is approved' do
  7. let(:record) { Fabricate.build :appeal, approved_at: 2.days.ago }
  8. it { is_expected.to include('state' => 'approved') }
  9. end
  10. context 'when appeal is rejected' do
  11. let(:record) { Fabricate.build :appeal, rejected_at: 2.days.ago }
  12. it { is_expected.to include('state' => 'rejected') }
  13. end
  14. context 'when appeal is not approved or rejected' do
  15. let(:record) { Fabricate.build :appeal, approved_at: nil, rejected_at: nil }
  16. it { is_expected.to include('state' => 'pending') }
  17. end
  18. end
  19. end