class TestCase
Ruby on Rails 3.1.12
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 (defined here)
- # assert_class_method
- # assert_directory
- # assert_field_default_value
- # assert_field_type
- # assert_file
- # assert_instance_method
- # assert_method
- # assert_migration
- # assert_no_directory
- # assert_no_file
- # assert_no_migration
- # create_generated_attribute
- # generator
- # prepare_destination
- # run_generator
- self. arguments
- self. destination
- self. tests
Methods (inherited)
From ActiveSupport::TestCase
(1)
- self. for_tag
From ActiveRecord::TestFixtures
(3)
From ActiveSupport::Testing::Assertions
(4)
From ActiveSupport::Testing::Pending
(1)
- # pending
From ActiveSupport::Callbacks
(1)
From ActiveSupport::Concern
(3)
- # append_features
- # included
- self. extended
From ActiveSupport::Testing::SetupAndTeardown::ForClassicTestUnit
(1)
- # run
From ActiveSupport::Testing::SetupAndTeardown::ForMiniTest
(1)
- # run
From ActiveSupport::DescendantsTracker
(6)
- # descendants
- # direct_descendants
- # inherited
- self. clear
- self. descendants
- self. direct_descendants