class TestCase
Ruby on Rails 4.2.9
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", File.dirname(__FILE__))
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", File.dirname(__FILE__))
setup :prepare_destination
end
Inherits from
Includes
Methods (inherited)
From ActiveSupport::TestCase
(3)
- # assert_nothing_raised
- self. test_order
- self. test_order=
From Rails::Generators::Testing::Assertions
(11)
From Rails::Generators::Testing::Behaviour
(4)
From ActiveRecord::TestFixtures
(6)
From ActiveSupport::Concern
(3)
From ActiveSupport::Testing::Assertions
(3)
From ActiveSupport::Testing::Declarative
(1)
- # test
From ActiveSupport::Testing::TimeHelpers
(3)
- # travel
- # travel_back
- # travel_to
From ActiveSupport::Callbacks
(1)
From ActiveSupport::DescendantsTracker
(7)
- # descendants
- # direct_descendants
- # inherited
- self. clear
- self. descendants
- self. direct_descendants
- self. store_inherited