FIX: Actually error when topic timer time is in the past (#11434)

This commit is contained in:
Mark VanLandingham
2020-12-08 11:13:45 -06:00
committed by GitHub
parent b824af02d4
commit 9f786306bd
4 changed files with 21 additions and 6 deletions

View File

@ -2932,6 +2932,19 @@ RSpec.describe TopicsController do
end
end
context 'when time is in the past' do
it 'returns an error' do
freeze_time
sign_in(admin)
post "/t/#{topic.id}/timer.json", params: {
time: Time.current - 1.day,
status_type: TopicTimer.types[1]
}
expect(response.status).to eq(400)
end
end
context 'when logged in as an admin' do
before do
freeze_time