mirror of
https://github.com/discourse/discourse.git
synced 2024-12-04 18:13:41 +08:00
d1d9a4f128
Previously if you wanted to have jobs execute in test mode, you'd have to do `SiteSetting.queue_jobs = false`, because the opposite of queue is to execute. I found this very confusing, so I created a test helper called `run_jobs_synchronously!` which is much more clear about what it does.
30 lines
784 B
Ruby
30 lines
784 B
Ruby
require 'rails_helper'
|
|
|
|
describe Post do
|
|
|
|
before do
|
|
run_jobs_synchronously!
|
|
end
|
|
|
|
describe '#local_dates' do
|
|
it "should have correct custom fields" do
|
|
post = Fabricate(:post, raw: <<~SQL)
|
|
[date=2018-09-17 time=01:39:00 format="LLL" timezone="Europe/Paris" timezones="Europe/Paris|America/Los_Angeles"]
|
|
SQL
|
|
CookedPostProcessor.new(post).post_process
|
|
|
|
expect(post.local_dates.count).to eq(1)
|
|
expect(post.local_dates[0]["date"]).to eq("2018-09-17")
|
|
expect(post.local_dates[0]["time"]).to eq("01:39:00")
|
|
expect(post.local_dates[0]["timezone"]).to eq("Europe/Paris")
|
|
|
|
post.raw = "Text removed"
|
|
post.save
|
|
CookedPostProcessor.new(post).post_process
|
|
|
|
expect(post.local_dates).to eq([])
|
|
end
|
|
end
|
|
|
|
end
|