From 966f238da459fda40be8db48904dad7e4266a443 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Thu, 1 Jun 2017 18:17:27 +0000 Subject: Use Rails 5 syntax for integration tests. git-svn-id: http://svn.redmine.org/redmine/trunk@16586 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/test_helper.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/test_helper.rb') diff --git a/test/test_helper.rb b/test/test_helper.rb index 19a60c838..1d99ce906 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -343,6 +343,17 @@ module Redmine assert_equal login, User.find(session[:user_id]).login end + %w(get post patch put delete head).each do |http_method| + class_eval %Q" + def #{http_method}(path, parameters = nil, headers_or_env = nil) + if headers_or_env.nil? && parameters.is_a?(Hash) && (parameters.key?(:params) || parameters.key?(:headers)) + super path, parameters[:params], parameters[:headers] + else + super + end + end" + end + def credentials(user, password=nil) {'HTTP_AUTHORIZATION' => ActionController::HttpAuthentication::Basic.encode_credentials(user, password || user)} end -- cgit v1.2.3