2023-03-04 16:43:47 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'rails_helper'
|
|
|
|
|
2024-09-04 07:12:25 +02:00
|
|
|
RSpec.describe PreviewCardProvider do
|
2024-09-03 17:37:45 +02:00
|
|
|
include_examples 'Reviewable'
|
|
|
|
|
2023-03-04 16:43:47 +01:00
|
|
|
describe 'scopes' do
|
|
|
|
let(:trendable_and_reviewed) { Fabricate(:preview_card_provider, trendable: true, reviewed_at: 5.days.ago) }
|
|
|
|
let(:not_trendable_and_not_reviewed) { Fabricate(:preview_card_provider, trendable: false, reviewed_at: nil) }
|
|
|
|
|
|
|
|
describe 'trendable' do
|
|
|
|
it 'returns the relevant records' do
|
|
|
|
results = described_class.trendable
|
|
|
|
|
|
|
|
expect(results).to eq([trendable_and_reviewed])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'not_trendable' do
|
|
|
|
it 'returns the relevant records' do
|
|
|
|
results = described_class.not_trendable
|
|
|
|
|
|
|
|
expect(results).to eq([not_trendable_and_not_reviewed])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|