diff --git a/test/controllers/posts/lock_test.rb b/test/controllers/posts/lock_test.rb index 95a30470b1ce526b0803a3c767aa4269a9c6e5a7..cfb7b2ddc0b71518fb698ac74960de5af281df3f 100644 --- a/test/controllers/posts/lock_test.rb +++ b/test/controllers/posts/lock_test.rb @@ -79,4 +79,15 @@ class PostsControllerTest < ActionController::TestCase end assert_equal 'success', JSON.parse(response.body)['status'] end + + test 'Locks on posts expire' do + sign_in users(:moderator) + post :lock, params: { id: posts(:question_one).id, length: 1, format: :json } + assert_response 200 + + # Change the locked_until to have already passed + assigns(:post).update(locked_until: 1.second.ago) + + assert_not assigns(:post).locked? + end end