1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/railties/lib/rails/test_help.rb
Francesco Rodriguez df10279252 update test_help to config properly turn natural language option
Last versions of Turn don't monkey patch MiniTest to setup
the natural language option. Here is an
[example](https://github.com/TwP/turn/blob/master/try/test_autorun_minitest.rb#L3).

This patches the following behaviour:

    $ rake test:units
    `<top (required)>': undefined method `use_natural_language_case_names='
    for MiniTest::Unit:Class (NoMethodError)
2012-07-06 18:12:36 -05:00

43 lines
1.1 KiB
Ruby

# Make double-sure the RAILS_ENV is not set to production,
# so fixtures aren't loaded into that environment
abort("Abort testing: Your Rails environment is running in production mode!") if Rails.env.production?
require 'minitest/autorun'
require 'active_support/test_case'
require 'action_controller/test_case'
require 'action_dispatch/testing/integration'
# Enable turn if it is available
begin
require 'turn'
Turn.config do |c|
c.natural = true
end
rescue LoadError
end
if defined?(ActiveRecord::Base)
class ActiveSupport::TestCase
include ActiveRecord::TestFixtures
self.fixture_path = "#{Rails.root}/test/fixtures/"
end
ActionDispatch::IntegrationTest.fixture_path = ActiveSupport::TestCase.fixture_path
def create_fixtures(*table_names, &block)
Fixtures.create_fixtures(ActiveSupport::TestCase.fixture_path, table_names, {}, &block)
end
end
class ActionController::TestCase
setup do
@routes = Rails.application.routes
end
end
class ActionDispatch::IntegrationTest
setup do
@routes = Rails.application.routes
end
end