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
Timecop.freeze do
topic = Fabricate(:topic,
topic_timers: [Fabricate(:topic_timer,
based_on_last_post: true,
execute_at: Time.zone.now - 12.hours,
created_at: Time.zone.now - 24.hours
)]
)
topic = Fabricate(:topic_timer,
based_on_last_post: true,
execute_at: Time.zone.now - 12.hours,
created_at: Time.zone.now - 24.hours
).topic
Fabricate(:post, topic: topic)

View File

@ -60,7 +60,7 @@ RSpec.describe "Managing a topic's status update", type: :request do
end
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",
time: nil,

View File

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

View File

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