Class: Rails::Generators::TestCase
- Inherits:
-
ActiveSupport::TestCase
- Object
- ActiveSupport::TestCase
- Rails::Generators::TestCase
- Includes:
- FileUtils, Rails::Generators::Testing::Assertions, Rails::Generators::Testing::Behaviour, Rails::Generators::Testing::SetupAndTeardown
- Defined in:
- lib/rails/generators/test_case.rb
Overview
This class provides a TestCase for testing generators. To setup, you need just to configure the destination and set which generator is being tested:
class AppGeneratorTest < Rails::Generators::TestCase
tests AppGenerator
destination File.("../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.("../tmp", __dir__)
setup :prepare_destination
end
Method Summary
Methods included from Rails::Generators::Testing::Assertions
#assert_class_method, #assert_field_default_value, #assert_field_type, #assert_file, #assert_instance_method, #assert_migration, #assert_no_file, #assert_no_migration