Make the tests pass when config.threadsafe! is enabled (#12097).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10910 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2012-12-02 18:07:35 +00:00
parent f474d1ff81
commit e821020394
4 changed files with 14 additions and 1 deletions

View File

@ -312,7 +312,7 @@ RedmineApp::Application.routes.draw do
resources :auth_sources do resources :auth_sources do
member do member do
get 'test_connection' get 'test_connection', :as => 'try_connection'
end end
end end

View File

@ -492,3 +492,14 @@ end
# Simple module to "namespace" all of the API tests # Simple module to "namespace" all of the API tests
module ApiTest module ApiTest
end end
# URL helpers do not work with config.threadsafe!
# https://github.com/rspec/rspec-rails/issues/476#issuecomment-4705454
ActionView::TestCase::TestController.instance_eval do
helper Rails.application.routes.url_helpers
end
ActionView::TestCase::TestController.class_eval do
def _routes
Rails.application.routes
end
end

View File

@ -21,6 +21,7 @@ require File.expand_path('../../../test_helper', __FILE__)
class ApplicationHelperTest < ActionView::TestCase class ApplicationHelperTest < ActionView::TestCase
include ERB::Util include ERB::Util
include Rails.application.routes.url_helpers
fixtures :projects, :roles, :enabled_modules, :users, fixtures :projects, :roles, :enabled_modules, :users,
:repositories, :changesets, :repositories, :changesets,

View File

@ -34,6 +34,7 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
include ProjectsHelper include ProjectsHelper
include IssuesHelper include IssuesHelper
include ERB::Util include ERB::Util
include Rails.application.routes.url_helpers
def setup def setup
setup_with_controller setup_with_controller