1
0

preview_card_provider_spec.rb 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. describe PreviewCardProvider do
  4. describe 'scopes' do
  5. let(:trendable_and_reviewed) { Fabricate(:preview_card_provider, trendable: true, reviewed_at: 5.days.ago) }
  6. let(:not_trendable_and_not_reviewed) { Fabricate(:preview_card_provider, trendable: false, reviewed_at: nil) }
  7. describe 'trendable' do
  8. it 'returns the relevant records' do
  9. results = described_class.trendable
  10. expect(results).to eq([trendable_and_reviewed])
  11. end
  12. end
  13. describe 'not_trendable' do
  14. it 'returns the relevant records' do
  15. results = described_class.not_trendable
  16. expect(results).to eq([not_trendable_and_not_reviewed])
  17. end
  18. end
  19. describe 'reviewed' do
  20. it 'returns the relevant records' do
  21. results = described_class.reviewed
  22. expect(results).to eq([trendable_and_reviewed])
  23. end
  24. end
  25. describe 'pending_review' do
  26. it 'returns the relevant records' do
  27. results = described_class.pending_review
  28. expect(results).to eq([not_trendable_and_not_reviewed])
  29. end
  30. end
  31. end
  32. end