2013-03-29 01:02:59 +08:00
|
|
|
require 'spec_helper'
|
2013-10-01 15:04:02 +08:00
|
|
|
require_dependency 'jobs/scheduled/periodical_updates'
|
2013-03-29 01:02:59 +08: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-04 11:28:49 +08:00
|
|
|
UserStat.expects(:update_view_counts).once
|
2013-03-29 01:02:59 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
it "calculates scores" do
|
|
|
|
calculator = mock()
|
|
|
|
ScoreCalculator.expects(:new).once.returns(calculator)
|
|
|
|
calculator.expects(:calculate)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|