Merge branch 'master' into 2761-diagnostic-suite
[arvados.git] / apps / workbench / test / test_helper.rb
index c1eed5cd7bf6b56412749c7e4a7170d643fd4075..7f23988837b8ced4d4343b16dc3a1993e68c211e 100644 (file)
@@ -1,4 +1,5 @@
-ENV["RAILS_ENV"] = "test"
+ENV["RAILS_ENV"] = "test" if !ENV["RAILS_ENV"]
+
 unless ENV["NO_COVERAGE_TEST"]
   begin
     require 'simplecov'
@@ -36,6 +37,7 @@ class ActiveSupport::TestCase
 
   def teardown
     Thread.current[:arvados_api_token] = nil
+    Thread.current[:reader_tokens] = nil
     super
   end
 end
@@ -69,6 +71,9 @@ class ActiveSupport::TestCase
       arvados_api_token: api_fixture('api_client_authorizations')[api_client_auth_name.to_s]['api_token']
     }
   end
+  def json_response
+    Oj.load(@response.body)
+  end
 end
 
 class ApiServerForTests
@@ -147,4 +152,6 @@ class ApiServerForTests
   end
 end
 
-ApiServerForTests.run
+if ENV["RAILS_ENV"].eql? 'test'
+  ApiServerForTests.run
+end