ee24ea3a45de3c63bb0dde672488b1e6dcde246d
[feedcatcher.git] / vendor / rails / railties / lib / test_help.rb
1 # Make double-sure the RAILS_ENV is set to test,
2 # so fixtures are loaded to the right database
3 silence_warnings { RAILS_ENV = "test" }
4
5 require 'test/unit'
6 require 'action_controller/test_case'
7 require 'action_view/test_case'
8 require 'action_controller/integration'
9 require 'action_mailer/test_case' if defined?(ActionMailer)
10
11 if defined?(ActiveRecord)
12 require 'active_record/test_case'
13 require 'active_record/fixtures'
14
15 class ActiveSupport::TestCase
16 include ActiveRecord::TestFixtures
17 self.fixture_path = "#{RAILS_ROOT}/test/fixtures/"
18 self.use_instantiated_fixtures = false
19 self.use_transactional_fixtures = true
20 end
21
22 ActionController::IntegrationTest.fixture_path = ActiveSupport::TestCase.fixture_path
23
24 def create_fixtures(*table_names, &block)
25 Fixtures.create_fixtures(ActiveSupport::TestCase.fixture_path, table_names, {}, &block)
26 end
27 end
28
29 begin
30 require_library_or_gem 'ruby-debug'
31 Debugger.start
32 Debugger.settings[:autoeval] = true if Debugger.respond_to?(:settings)
33 rescue LoadError
34 # ruby-debug wasn't available so neither can the debugging be
35 end