class TestCase
Ruby on Rails 6.1.7.10
Since v3.0.20This 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
Includes
Methods (inherited)
From ActiveSupport::TestCase
(5)
- self. parallelize
- self. parallelize_setup
- self. parallelize_teardown
- self. test_order
- self. test_order=
From Rails::Generators::Testing::Assertions
(11)
From Rails::Generators::Testing::Behaviour
(3)
From ActiveSupport::Concern
(3)
- # class_methods
- # included
- # prepended
From ActiveSupport::Testing::Assertions
(6)
From ActiveSupport::Testing::Declarative
(1)
- # test
From ActiveSupport::Testing::FileFixtures
(1)
From ActiveSupport::Testing::TimeHelpers
(6)
- # after_teardown
- # freeze_time
- # travel
- # travel_back
- # travel_to
- # unfreeze_time