about summary refs log tree commit diff
path: root/spec/models
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2021-11-26 01:15:29 +0100
committerClaire <claire.github-309c@sitedethib.com>2021-11-26 01:15:29 +0100
commitafd71867bad4cc826656bd8931b25c8ea8317fff (patch)
treecaef1b579ad8ebdb48dc2ee8633ba9a1a7cdc587 /spec/models
parentb4f785c1f46693c4e42b035e6728f99aac1b85db (diff)
Revert "Fix trends admin page crashing"
This reverts commit 5f10e64330635bfd609ba5acdd78fa505c12f5b1.
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/trends/tags_spec.rb9
1 files changed, 2 insertions, 7 deletions
diff --git a/spec/models/trends/tags_spec.rb b/spec/models/trends/tags_spec.rb
index 23f8a7ba7..4f98c6aa4 100644
--- a/spec/models/trends/tags_spec.rb
+++ b/spec/models/trends/tags_spec.rb
@@ -1,15 +1,10 @@
 require 'rails_helper'
 
 RSpec.describe Trends::Tags do
-  subject { described_class.new }
+  subject { described_class.new(threshold: 5, review_threshold: 10) }
 
   let!(:at_time) { DateTime.new(2021, 11, 14, 10, 15, 0) }
 
-  before do
-    stub_const 'Trends::Tags::THRESHOLD', 5
-    stub_const 'Trends::Tags::REVIEW_THRESHOLD', 10
-  end
-
   describe '#add' do
     let(:tag) { Fabricate(:tag) }
 
@@ -64,7 +59,7 @@ RSpec.describe Trends::Tags do
       subject.refresh(yesterday + 12.hours)
       original_score = subject.score(tag3.id)
       expect(original_score).to eq 144.0
-      subject.refresh(yesterday + 12.hours + described_class::MAX_SCORE_HALFLIFE)
+      subject.refresh(yesterday + 12.hours + subject.options[:max_score_halflife])
       decayed_score = subject.score(tag3.id)
       expect(decayed_score).to be <= original_score / 2
     end