add test case for topic status update based on last post

This commit is contained in:
Arpit Jalan 2017-04-03 22:33:11 +05:30
parent 3d64f33d40
commit 5ff29ce321
1 changed files with 7 additions and 0 deletions

View File

@ -1138,6 +1138,13 @@ describe Topic do
end
end
it 'can take a number of hours as a string and can handle based on last post' do
Timecop.freeze(now) do
topic.set_or_create_status_update(TopicStatusUpdate.types[:close], '18', {by_user: admin, based_on_last_post: true})
expect(topic.topic_status_updates.first.execute_at).to eq(18.hours.from_now)
end
end
it "can take a time later in the day" do
Timecop.freeze(now) do
topic.set_or_create_status_update(TopicStatusUpdate.types[:close], '13:00', {by_user: admin})