about summary refs log tree commit diff
path: root/spec/models/preview_card_provider_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/preview_card_provider_spec.rb')
-rw-r--r--spec/models/preview_card_provider_spec.rb42
1 files changed, 42 insertions, 0 deletions
diff --git a/spec/models/preview_card_provider_spec.rb b/spec/models/preview_card_provider_spec.rb
new file mode 100644
index 000000000..7425b9394
--- /dev/null
+++ b/spec/models/preview_card_provider_spec.rb
@@ -0,0 +1,42 @@
+# frozen_string_literal: true
+
+require 'rails_helper'
+
+describe PreviewCardProvider do
+  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
+
+    describe 'reviewed' do
+      it 'returns the relevant records' do
+        results = described_class.reviewed
+
+        expect(results).to eq([trendable_and_reviewed])
+      end
+    end
+
+    describe 'pending_review' do
+      it 'returns the relevant records' do
+        results = described_class.pending_review
+
+        expect(results).to eq([not_trendable_and_not_reviewed])
+      end
+    end
+  end
+end