class TestCase
Ruby on Rails 5.2.8.1
Since v3.0.20This 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.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 (2)
- self. test_order
- self. test_order=
From Rails::Generators::Testing::Assertions (11)
From ActiveRecord::TestFixtures (4)
From ActiveSupport::Concern (3)
From ActiveSupport::Testing::Assertions (6)
From ActiveSupport::Testing::Declarative (1)
- # test
From ActiveSupport::Testing::FileFixtures (1)
From ActiveSupport::Testing::TimeHelpers (5)
- # after_teardown
- # freeze_time
- # travel
- # travel_back
- # travel_to