mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
166ce95f65
- Added include for the same in ActiveSupport::Test. - Removed occurrences of silence_stream being used elsewhere. - Reordered activesupport testcase requires alphabetically. - Removed require of silence stream from test_case - Moved quietly method to stream helper - Moved capture output to stream helper module and setup requires for the same elsewhere
48 lines
1.3 KiB
Ruby
48 lines
1.3 KiB
Ruby
require 'abstract_unit'
|
|
require 'active_support/core_ext/module/remove_method'
|
|
require 'active_support/testing/stream'
|
|
require 'rails/generators'
|
|
require 'rails/generators/test_case'
|
|
|
|
module Rails
|
|
class << self
|
|
remove_possible_method :root
|
|
def root
|
|
@root ||= Pathname.new(File.expand_path('../../fixtures', __FILE__))
|
|
end
|
|
end
|
|
end
|
|
Rails.application.config.root = Rails.root
|
|
Rails.application.config.generators.templates = [File.join(Rails.root, "lib", "templates")]
|
|
|
|
# Call configure to load the settings from
|
|
# Rails.application.config.generators to Rails::Generators
|
|
Rails.application.load_generators
|
|
|
|
require 'active_record'
|
|
require 'action_dispatch'
|
|
require 'action_view'
|
|
|
|
module GeneratorsTestHelper
|
|
include ActiveSupport::Testing::Stream
|
|
|
|
def self.included(base)
|
|
base.class_eval do
|
|
destination File.join(Rails.root, "tmp")
|
|
setup :prepare_destination
|
|
|
|
begin
|
|
base.tests Rails::Generators.const_get(base.name.sub(/Test$/, ''))
|
|
rescue
|
|
end
|
|
end
|
|
end
|
|
|
|
def copy_routes
|
|
routes = File.expand_path("../../../lib/rails/generators/rails/app/templates/config/routes.rb", __FILE__)
|
|
destination = File.join(destination_root, "config")
|
|
FileUtils.mkdir_p(destination)
|
|
FileUtils.cp routes, destination
|
|
end
|
|
|
|
end
|