2013-03-28 13:02:59 -04:00
|
|
|
require 'spec_helper'
|
2013-10-01 03:04:02 -04:00
|
|
|
require_dependency 'jobs/scheduled/periodical_updates'
|
2013-03-28 13:02:59 -04:00
|
|
|
|
|
|
|
describe Jobs::PeriodicalUpdates do
|
|
|
|
|
|
|
|
after do
|
|
|
|
Jobs::PeriodicalUpdates.new.execute(nil)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "calculates avg post time" do
|
|
|
|
Post.expects(:calculate_avg_time).once
|
|
|
|
end
|
|
|
|
|
|
|
|
it "calculates avg topic time" do
|
|
|
|
Topic.expects(:calculate_avg_time).once
|
|
|
|
end
|
|
|
|
|
|
|
|
it "features topics" do
|
|
|
|
CategoryFeaturedTopic.expects(:feature_topics).once
|
|
|
|
end
|
|
|
|
|
|
|
|
it "updates view counts" do
|
2013-10-03 23:28:49 -04:00
|
|
|
UserStat.expects(:update_view_counts).once
|
2013-03-28 13:02:59 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it "calculates scores" do
|
|
|
|
calculator = mock()
|
|
|
|
ScoreCalculator.expects(:new).once.returns(calculator)
|
|
|
|
calculator.expects(:calculate)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "refreshes hot topics" do
|
|
|
|
HotTopic.expects(:refresh!).once
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|