[ARVADOS] created: 8e88f054ecbbcd8f92724dc69b85b88bd8569ab0
git at public.curoverse.com
git at public.curoverse.com
Wed Sep 24 11:33:21 EDT 2014
at 8e88f054ecbbcd8f92724dc69b85b88bd8569ab0 (commit)
commit 8e88f054ecbbcd8f92724dc69b85b88bd8569ab0
Author: Tom Clegg <tom at curoverse.com>
Date: Wed Sep 24 11:32:47 2014 -0400
3889: Clean up counter checks. For now, warn instead of failing.
diff --git a/services/api/test/test_helper.rb b/services/api/test/test_helper.rb
index 23bd901..1c3f159 100644
--- a/services/api/test/test_helper.rb
+++ b/services/api/test/test_helper.rb
@@ -81,45 +81,28 @@ class ActiveSupport::TestCase
end
class ActionController::TestCase
- def reset_counter
- $counter = 0
+ setup do
+ @counter = 0
end
def check_counter action
- $counter += 1
- if $counter > 1
- raise "Too many actions on a single instance of ActionController::TestCase #{action}"
+ @counter += 1
+ if @counter == 2
+ # TODO: when existing mistakes are fixed, start failing broken
+ # test cases like this:
+ #
+ # assert_equal 1, 2, "Multiple actions in functional test"
+ #
+ # Meanwhile, just warn (just once per test case):
+ $stderr.puts " [WARNING: Multiple actions in functional test]"
end
end
- alias original_run_callbacks run_callbacks
- def run_callbacks(kind, &block)
- reset_counter
- original_run_callbacks(kind, &block)
- end
-
- alias original_get get
- def get(action, *args)
- check_counter action
- original_get(action, *args)
- end
-
- alias original_post post
- def post(action, *args)
- check_counter action
- original_post(action, *args)
- end
-
- alias original_put put
- def put(action, *args)
- check_counter action
- original_put(action, *args)
- end
-
- alias original_delete delete
- def delete(action, *args)
- check_counter action
- original_delete(action, *args)
+ [:get, :post, :put, :delete].each do |method|
+ define_method method do |action, *args|
+ check_counter action
+ super action, *args
+ end
end
end
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list