summaryrefslogtreecommitdiffstats
path: root/test/test_helper.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2014-11-30 15:16:43 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2014-11-30 15:16:43 +0000
commit8e84b1a48f49919806650baad353f3abd70ef1f4 (patch)
treeb57bda56d4f57ea75a3bd8523df706b6abc5705b /test/test_helper.rb
parentd22029083c486bb4d67bee26cf496f642491890c (diff)
downloadredmine-8e84b1a48f49919806650baad353f3abd70ef1f4.tar.gz
redmine-8e84b1a48f49919806650baad353f3abd70ef1f4.zip
Moved helpers for integration tests in a specific class.
git-svn-id: http://svn.redmine.org/redmine/trunk@13680 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/test_helper.rb')
-rw-r--r--test/test_helper.rb32
1 files changed, 17 insertions, 15 deletions
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 7ec75708e..4754aaf06 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -43,24 +43,10 @@ class ActiveSupport::TestCase
ESCAPED_CANT = 'can&#39;t'
ESCAPED_UCANT = 'Can&#39;t'
- def log_user(login, password)
- User.anonymous
- get "/login"
- assert_equal nil, session[:user_id]
- assert_response :success
- assert_template "account/login"
- post "/login", :username => login, :password => password
- assert_equal login, User.find(session[:user_id]).login
- end
-
def uploaded_test_file(name, mime)
fixture_file_upload("files/#{name}", mime, true)
end
- def credentials(user, password=nil)
- {'HTTP_AUTHORIZATION' => ActionController::HttpAuthentication::Basic.encode_credentials(user, password || user)}
- end
-
# Mock out a file
def self.mock_file
file = 'a_file.png'
@@ -248,11 +234,27 @@ module Redmine
end
end
+ class IntegrationTest < ActionDispatch::IntegrationTest
+ def log_user(login, password)
+ User.anonymous
+ get "/login"
+ assert_equal nil, session[:user_id]
+ assert_response :success
+ assert_template "account/login"
+ post "/login", :username => login, :password => password
+ assert_equal login, User.find(session[:user_id]).login
+ end
+
+ def credentials(user, password=nil)
+ {'HTTP_AUTHORIZATION' => ActionController::HttpAuthentication::Basic.encode_credentials(user, password || user)}
+ end
+ end
+
module ApiTest
API_FORMATS = %w(json xml).freeze
# Base class for API tests
- class Base < ActionDispatch::IntegrationTest
+ class Base < Redmine::IntegrationTest
def setup
Setting.rest_api_enabled = '1'
end