mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-24 08:09:13 -05:00
35 lines
592 B
Ruby
35 lines
592 B
Ruby
|
require 'spec_helper'
|
||
|
|
||
|
describe HotTopic do
|
||
|
|
||
|
it { should belong_to :topic }
|
||
|
it { should belong_to :category }
|
||
|
|
||
|
|
||
|
context "refresh!" do
|
||
|
|
||
|
let!(:t1) { Fabricate(:topic) }
|
||
|
let!(:t2) { Fabricate(:topic) }
|
||
|
|
||
|
it "begins blank" do
|
||
|
HotTopic.all.should be_blank
|
||
|
end
|
||
|
|
||
|
context "after calculating" do
|
||
|
|
||
|
before do
|
||
|
# Calculate the scores before we calculate hot
|
||
|
ScoreCalculator.new.calculate
|
||
|
HotTopic.refresh!
|
||
|
end
|
||
|
|
||
|
it "should have hot topics" do
|
||
|
HotTopic.pluck(:topic_id).should =~ [t1.id, t2.id]
|
||
|
end
|
||
|
|
||
|
end
|
||
|
|
||
|
end
|
||
|
|
||
|
end
|