Merge branch 'master' into 3901-component-rendering-errors
[arvados.git] / apps / workbench / test / test_helper.rb
index 3b6dc036a64cda6a041b8b5bfb1a8ae0c3a5c23f..efb520a34c7964042f05f6ab2ab27bea5607319d 100644 (file)
@@ -152,6 +152,32 @@ class ApiServerForTests
   end
 end
 
+class ActionController::TestCase
+  setup do
+    @counter = 0
+  end
+
+  def check_counter 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
+
+  [:get, :post, :put, :patch, :delete].each do |method|
+    define_method method do |action, *args|
+      check_counter action
+      super action, *args
+    end
+  end
+end
+
 if ENV["RAILS_ENV"].eql? 'test'
   ApiServerForTests.run
 end