class TestCase
Ruby on Rails 7.2.3
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 (20)
- # assert_no_match
- # assert_not_empty
- # assert_not_equal
- # assert_not_in_delta
- # assert_not_in_epsilon
- # assert_not_includes
- # assert_not_instance_of
- # assert_not_kind_of
- # assert_not_nil
- # assert_not_operator
- # assert_not_predicate
- # assert_not_respond_to
- # assert_not_same
- self. fixture_paths
- self. fixture_paths=
- self. parallelize
- self. parallelize_setup
- self. parallelize_teardown
- self. test_order
- self. test_order=
From Rails::Generators::Testing::Assertions (12)
From Rails::Generators::Testing::Behavior (3)
From ActiveSupport::Concern (3)
- # class_methods
- # included
- # prepended
From ActiveSupport::Testing::Assertions (8)
From ActiveSupport::Testing::Declarative (1)
- # test
From ActiveSupport::Testing::Deprecation (3)
From ActiveSupport::Testing::FileFixtures (1)
From ActiveSupport::Testing::TimeHelpers (6)
- # after_teardown
- # freeze_time
- # travel
- # travel_back
- # travel_to
- # unfreeze_time