preview_card_provider_spec.rb 785 B

12345678910111213141516171819202122232425262728
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe PreviewCardProvider do
  4. include_examples 'Reviewable'
  5. describe 'scopes' do
  6. let(:trendable_and_reviewed) { Fabricate(:preview_card_provider, trendable: true, reviewed_at: 5.days.ago) }
  7. let(:not_trendable_and_not_reviewed) { Fabricate(:preview_card_provider, trendable: false, reviewed_at: nil) }
  8. describe 'trendable' do
  9. it 'returns the relevant records' do
  10. results = described_class.trendable
  11. expect(results).to eq([trendable_and_reviewed])
  12. end
  13. end
  14. describe 'not_trendable' do
  15. it 'returns the relevant records' do
  16. results = described_class.not_trendable
  17. expect(results).to eq([not_trendable_and_not_reviewed])
  18. end
  19. end
  20. end
  21. end