- # Restore configuration settings changed during tests
- $application_config.each do |k,v|
- if k.match /^[^.]*$/
- Rails.configuration.send (k + '='), v
- end
+ restore_configuration
+ end
+
+ teardown do
+ # Confirm that any changed configuration doesn't include non-symbol keys
+ $arvados_config.keys.each do |conf_name|
+ conf = Rails.configuration.send(conf_name)
+ confirm_keys_as_symbols(conf, conf_name) if conf.respond_to?('keys')
+ end
+ end
+
+ def assert_equal(expect, *args)
+ if expect.nil?
+ assert_nil(*args)
+ else
+ super
+ end
+ end
+
+ def assert_not_allowed
+ # Provide a block that calls a Rails boolean "true or false" success value,
+ # like model.save or model.destroy. This method will test that it either
+ # returns false, or raises a Permission Denied exception.
+ begin
+ refute(yield)
+ rescue ArvadosModel::PermissionDeniedError
+ end
+ end
+
+ def add_permission_link from_who, to_what, perm_type
+ act_as_system_user do
+ Link.create!(tail_uuid: from_who.uuid,
+ head_uuid: to_what.uuid,
+ link_class: 'permission',
+ name: perm_type)