4651: Accept "false" as false for a boolean param. Reject bogus strings.
[arvados.git] / services / api / test / functional / application_controller_test.rb
index 4144d0a922eb43ade4373cc2d64c54bd044a6504..9aad981cafd035d58bb250317d49ef019f9abd8b 100644 (file)
@@ -46,4 +46,15 @@ class ApplicationControllerTest < ActionController::TestCase
     assert_response 422
     check_error_token
   end
+
+  ['foo', '', 'FALSE', 'TRUE', nil, [true], {a:true}, '"true"'].each do |bogus|
+    test "bogus boolean parameter #{bogus.inspect} returns error" do
+      authorize_with :active
+      post :create, {
+        specimen: {},
+        ensure_unique_name: bogus
+      }
+      assert_response 422
+    end
+  end
 end