2017-08-14 13:08:09 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2010-09-22 17:24:35 -04:00
|
|
|
# Make double-sure the RAILS_ENV is not set to production,
|
|
|
|
# so fixtures aren't loaded into that environment
|
2010-09-25 05:01:43 -04:00
|
|
|
abort("Abort testing: Your Rails environment is running in production mode!") if Rails.env.production?
|
2005-11-09 10:11:55 -05:00
|
|
|
|
2016-08-06 13:15:47 -04:00
|
|
|
require "active_support/test_case"
|
|
|
|
require "action_controller"
|
|
|
|
require "action_controller/test_case"
|
|
|
|
require "action_dispatch/testing/integration"
|
2017-10-21 09:08:33 -04:00
|
|
|
require "rails/generators/test_case"
|
2009-12-02 23:01:01 -05:00
|
|
|
|
2016-08-06 13:15:47 -04:00
|
|
|
require "active_support/testing/autorun"
|
2015-03-21 08:15:56 -04:00
|
|
|
|
2011-09-30 12:05:53 -04:00
|
|
|
if defined?(ActiveRecord::Base)
|
2017-04-30 17:58:42 -04:00
|
|
|
begin
|
|
|
|
ActiveRecord::Migration.maintain_test_schema!
|
|
|
|
rescue ActiveRecord::PendingMigrationError => e
|
|
|
|
puts e.to_s.strip
|
|
|
|
exit 1
|
|
|
|
end
|
2013-12-29 06:05:04 -05:00
|
|
|
|
2018-05-01 02:06:27 -04:00
|
|
|
ActiveSupport.on_load(:active_support_test_case) do
|
|
|
|
include ActiveRecord::TestDatabases
|
|
|
|
include ActiveRecord::TestFixtures
|
|
|
|
|
|
|
|
self.fixture_path = "#{Rails.root}/test/fixtures/"
|
|
|
|
self.file_fixture_path = fixture_path + "files"
|
2008-11-12 14:33:09 -05:00
|
|
|
end
|
2008-11-07 16:23:22 -05:00
|
|
|
|
2018-05-01 02:06:27 -04:00
|
|
|
ActiveSupport.on_load(:action_dispatch_integration_test) do
|
|
|
|
self.fixture_path = ActiveSupport::TestCase.fixture_path
|
|
|
|
end
|
2005-10-15 13:05:55 -04:00
|
|
|
end
|
2008-01-09 13:50:06 -05:00
|
|
|
|
2017-01-31 15:33:50 -05:00
|
|
|
# :enddoc:
|
|
|
|
|
2018-05-01 02:06:27 -04:00
|
|
|
ActiveSupport.on_load(:action_controller_test_case) do
|
2015-07-28 06:22:37 -04:00
|
|
|
def before_setup # :nodoc:
|
2010-03-30 15:18:08 -04:00
|
|
|
@routes = Rails.application.routes
|
2015-05-02 10:26:22 -04:00
|
|
|
super
|
2010-02-25 19:48:36 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-05-01 02:06:27 -04:00
|
|
|
ActiveSupport.on_load(:action_dispatch_integration_test) do
|
2015-07-28 06:22:37 -04:00
|
|
|
def before_setup # :nodoc:
|
2010-04-24 18:15:14 -04:00
|
|
|
@routes = Rails.application.routes
|
2015-05-02 10:26:22 -04:00
|
|
|
super
|
2010-04-24 18:15:14 -04:00
|
|
|
end
|
2010-02-25 20:51:56 -05:00
|
|
|
end
|