appeal_spec.rb 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. describe Appeal do
  4. describe 'scopes' do
  5. describe 'approved' do
  6. let(:approved_appeal) { Fabricate(:appeal, approved_at: 10.days.ago) }
  7. let(:not_approved_appeal) { Fabricate(:appeal, approved_at: nil) }
  8. it 'finds the correct records' do
  9. results = described_class.approved
  10. expect(results).to eq([approved_appeal])
  11. end
  12. end
  13. describe 'rejected' do
  14. let(:rejected_appeal) { Fabricate(:appeal, rejected_at: 10.days.ago) }
  15. let(:not_rejected_appeal) { Fabricate(:appeal, rejected_at: nil) }
  16. it 'finds the correct records' do
  17. results = described_class.rejected
  18. expect(results).to eq([rejected_appeal])
  19. end
  20. end
  21. describe 'pending' do
  22. let(:approved_appeal) { Fabricate(:appeal, approved_at: 10.days.ago) }
  23. let(:rejected_appeal) { Fabricate(:appeal, rejected_at: 10.days.ago) }
  24. let(:pending_appeal) { Fabricate(:appeal, rejected_at: nil, approved_at: nil) }
  25. it 'finds the correct records' do
  26. results = described_class.pending
  27. expect(results).to eq([pending_appeal])
  28. end
  29. end
  30. end
  31. end