[ARVADOS] updated: e65d698ab39cb44cf12630498ac75b475bedec44

git at public.curoverse.com git at public.curoverse.com
Tue Nov 25 13:50:48 EST 2014


Summary of changes:
 services/api/app/controllers/database_controller.rb      |  2 +-
 services/api/test/functional/database_controller_test.rb | 13 ++++++++-----
 services/api/test/integration/remote_reset_test.rb       |  8 +++++++-
 3 files changed, 16 insertions(+), 7 deletions(-)

       via  e65d698ab39cb44cf12630498ac75b475bedec44 (commit)
      from  bc206979ee82a00374838fff3044dcaf33338f02 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit e65d698ab39cb44cf12630498ac75b475bedec44
Author: Tom Clegg <tom at curoverse.com>
Date:   Tue Nov 25 12:32:01 2014 -0500

    4533: Use Rails.env instead of ENV["RAILS_ENV"]. Add comment in test case.

diff --git a/services/api/app/controllers/database_controller.rb b/services/api/app/controllers/database_controller.rb
index 4a872eb..91d98e5 100644
--- a/services/api/app/controllers/database_controller.rb
+++ b/services/api/app/controllers/database_controller.rb
@@ -3,7 +3,7 @@ class DatabaseController < ApplicationController
   skip_before_filter :render_404_if_no_object
   before_filter :admin_required
   def reset
-    raise ArvadosModel::PermissionDeniedError unless ENV['RAILS_ENV'] == 'test'
+    raise ArvadosModel::PermissionDeniedError unless Rails.env == 'test'
 
     require 'active_record/fixtures'
 
diff --git a/services/api/test/functional/database_controller_test.rb b/services/api/test/functional/database_controller_test.rb
index 1953aa1..4aab950 100644
--- a/services/api/test/functional/database_controller_test.rb
+++ b/services/api/test/functional/database_controller_test.rb
@@ -17,11 +17,14 @@ class DatabaseControllerTest < ActionController::TestCase
 
   test "reset fails when not in test mode" do
     authorize_with :admin
-    env_was = ENV['RAILS_ENV']
-    ENV['RAILS_ENV'] = 'development'
-    post :reset
-    assert_response 403
-    ENV['RAILS_ENV'] = env_was
+    env_was = Rails.env
+    begin
+      Rails.env = 'development'
+      post :reset
+      assert_response 403
+    ensure
+      Rails.env = env_was
+    end
   end
 
   test "reset fails when not configured" do
diff --git a/services/api/test/integration/remote_reset_test.rb b/services/api/test/integration/remote_reset_test.rb
index 81f341a..9cd9d0f 100644
--- a/services/api/test/integration/remote_reset_test.rb
+++ b/services/api/test/integration/remote_reset_test.rb
@@ -17,8 +17,14 @@ class RemoteResetTest < ActionDispatch::IntegrationTest
     assert_response :success
     post '/arvados/v1/specimens', {specimen: '{}'}, active_auth
     assert_response :success
-
     new_uuid = json_response['uuid']
+
+    # Perhaps redundant: confirm the above changes are observable from
+    # here using get(). Otherwise, the assertions below would not be
+    # informative. (Aside from confirming that integration-testing
+    # features work, this confirms that /database/reset didn't somehow
+    # put the database into a "don't persist any changes" mode -- not
+    # that I can think of a way for that to happen.)
     get '/arvados/v1/specimens/'+new_uuid, {}, active_auth
     assert_response :success
     get '/arvados/v1/specimens/'+old_uuid, {}, active_auth

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list