discourse/spec/models/top_topic_spec.rb

31 lines
488 B
Ruby
Raw Normal View History

2013-12-23 18:50:36 -05:00
require 'spec_helper'
describe TopTopic do
it { is_expected.to belong_to :topic }
2013-12-23 18:50:36 -05:00
context "refresh!" do
let!(:t1) { Fabricate(:topic) }
let!(:t2) { Fabricate(:topic) }
it "begins blank" do
expect(TopTopic.all).to be_blank
2013-12-23 18:50:36 -05:00
end
context "after calculating" do
before do
TopTopic.refresh!
end
it "should have top topics" do
expect(TopTopic.pluck(:topic_id)).to match_array([t1.id, t2.id])
2013-12-23 18:50:36 -05:00
end
end
end
end