class Rails::Generators::TestCase
This class provides a TestCase
for testing generators. To set up, you need just to configure the destination and set which generator is being tested:
class AppGeneratorTest < Rails::Generators::TestCase
tests AppGenerator
destination File.expand_path("../tmp", __dir__)
end
If you want to ensure your destination root is clean before running each test, you can set a setup callback:
class AppGeneratorTest < Rails::Generators::TestCase
tests AppGenerator
destination File.expand_path("../tmp", __dir__)
setup :prepare_destination
end
Inherits From
-
class
ActiveSupport::
TestCase -
module
Rails::
Generators:: Testing:: Behavior -
module
Rails::
Generators:: Testing:: SetupAndTeardown -
module
Rails::
Generators:: Testing:: Assertions -
module
FileUtils