5105: Treat not-logged-in AJAX requests as errors, instead of redirecting to login...
[arvados.git] / apps / workbench / test / test_helper.rb
index 335fcd0ee51b76fd04077cfbcbfc0bb39d381ced..c2ff207ab0255955b850d6b358d568c23253dcea 100644 (file)
@@ -32,8 +32,13 @@ class ActiveSupport::TestCase
   # in integration tests -- they do not yet inherit this setting
   fixtures :all
   def use_token token_name
+    was = Thread.current[:arvados_api_token]
     auth = api_fixture('api_client_authorizations')[token_name.to_s]
     Thread.current[:arvados_api_token] = auth['api_token']
+    if block_given?
+      yield
+      Thread.current[:arvados_api_token] = was
+    end
   end
 
   setup do