From 85aabe832eb3eec10a29054ef5575618686eef33 Mon Sep 17 00:00:00 2001 From: Azul Date: Fri, 4 Apr 2014 11:48:24 +0200 Subject: 5382 - prevent crash when destroying tokens An expired token was removed (probably by automatic cleanup) while processing it. So the webapp crashed due to a couch 404. We're preventing that by rescueing from a 404 on Token.delete by default. --- users/test/unit/token_test.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'users/test') diff --git a/users/test/unit/token_test.rb b/users/test/unit/token_test.rb index 6c9f209..a3c6cf6 100644 --- a/users/test/unit/token_test.rb +++ b/users/test/unit/token_test.rb @@ -78,6 +78,12 @@ class ClientCertificateTest < ActiveSupport::TestCase end - + test "Token.destroy_all_expired does not interfere with expired.authenticate" do + expired = FactoryGirl.create :token, last_seen_at: 2.hours.ago + with_config auth: {token_expires_after: 60} do + Token.destroy_all_expired + end + assert_nil expired.authenticate + end end -- cgit v1.2.3