aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/generators/generators_test_helper.rb
blob: fcd0989fd766495e5069d7008dd72e51c8ea42e9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# TODO: Fix this RAILS_ENV stuff
RAILS_ENV = 'test' unless defined?(RAILS_ENV)
require 'abstract_unit'

module Rails
  def self.root
    @root ||= File.expand_path(File.join(File.dirname(__FILE__), '..', 'fixtures'))
  end
end
Rails.application.config.root = Rails.root

require 'rails/generators'
require 'rails/generators/test_case'

require 'rubygems'
require 'active_record'
require 'action_dispatch'

class GeneratorsTestCase < Rails::Generators::TestCase
  destination File.join(Rails.root, "tmp")
  setup :prepare_destination

  def self.inherited(base)
    base.tests Rails::Generators.const_get(base.name.sub(/Test$/, ''))
  rescue
    # Do nothing.
  end
end