2015-10-11 05:41:23 -04:00
|
|
|
require 'rails_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
|
|
|
|
|
2014-02-26 20:15:41 -05:00
|
|
|
it "works" do
|
2013-03-28 13:02:59 -04:00
|
|
|
|
2014-02-26 20:15:41 -05:00
|
|
|
# does not blow up, no mocks, everything is called
|
|
|
|
Jobs::PeriodicalUpdates.new.execute(nil)
|
2013-03-28 13:02:59 -04:00
|
|
|
end
|
|
|
|
|
2018-12-09 11:36:04 -05:00
|
|
|
it "can rebake old posts when automatically_download_gravatars is false" do
|
|
|
|
SiteSetting.automatically_download_gravatars = false
|
|
|
|
post = create_post
|
|
|
|
post.update_columns(baked_at: Time.new(2000, 1, 1), baked_version: -1)
|
|
|
|
described_class.new.execute({})
|
|
|
|
|
|
|
|
post.reload
|
|
|
|
expect(post.baked_at).to be > 1.day.ago
|
|
|
|
|
|
|
|
baked = post.baked_at
|
|
|
|
described_class.new.execute({})
|
|
|
|
post.reload
|
|
|
|
expect(post.baked_at).to eq(baked)
|
|
|
|
end
|
2013-03-28 13:02:59 -04:00
|
|
|
end
|