2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-06 10:50:21 +08:00

Fix specs.

This commit is contained in:
Guo Xiang Tan 2017-07-24 15:56:08 +09:00
parent 25448b70e4
commit fa09a02201
4 changed files with 8 additions and 14 deletions

View file

@ -301,13 +301,11 @@ describe PostCreator do
it "updates topic's auto close date when it's based on last post" do it "updates topic's auto close date when it's based on last post" do
Timecop.freeze do Timecop.freeze do
topic = Fabricate(:topic, topic = Fabricate(:topic_timer,
topic_timers: [Fabricate(:topic_timer,
based_on_last_post: true, based_on_last_post: true,
execute_at: Time.zone.now - 12.hours, execute_at: Time.zone.now - 12.hours,
created_at: Time.zone.now - 24.hours created_at: Time.zone.now - 24.hours
)] ).topic
)
Fabricate(:post, topic: topic) Fabricate(:post, topic: topic)

View file

@ -60,7 +60,7 @@ RSpec.describe "Managing a topic's status update", type: :request do
end end
it 'should be able to delete a topic status update' do it 'should be able to delete a topic status update' do
topic.update!(topic_timers: [Fabricate(:topic_timer)]) Fabricate(:topic_timer, topic: topic)
post "/t/#{topic.id}/timer.json", post "/t/#{topic.id}/timer.json",
time: nil, time: nil,

View file

@ -60,9 +60,7 @@ describe Jobs::ToggleTopicClosed do
describe 'when user is not authorized to close topics' do describe 'when user is not authorized to close topics' do
let(:topic) do let(:topic) do
Fabricate(:topic, Fabricate(:topic_timer, execute_at: 2.hours.from_now).topic
topic_timers: [Fabricate(:topic_timer, execute_at: 2.hours.from_now)]
)
end end
it 'should not do anything' do it 'should not do anything' do

View file

@ -1155,9 +1155,7 @@ describe Topic do
let(:topic) { Fabricate.build(:topic) } let(:topic) { Fabricate.build(:topic) }
let(:closing_topic) do let(:closing_topic) do
Fabricate(:topic, Fabricate(:topic_timer, execute_at: 5.hours.from_now).topic
topic_timers: [Fabricate(:topic_timer, execute_at: 5.hours.from_now)]
)
end end
let(:admin) { Fabricate(:admin) } let(:admin) { Fabricate(:admin) }