diff options
Diffstat (limited to 'railties/test/generators/app_generator_test.rb')
-rw-r--r-- | railties/test/generators/app_generator_test.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index c41f257e15..1e1c7cfb04 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -4,6 +4,16 @@ require 'generators/rails/app/app_generator' class AppGeneratorTest < GeneratorsTestCase + def setup + super + Rails::Generators::AppGenerator.instance_variable_set('@desc', nil) + end + + def teardown + super + Rails::Generators::AppGenerator.instance_variable_set('@desc', nil) + end + def test_application_skeleton_is_created run_generator @@ -120,6 +130,20 @@ class AppGeneratorTest < GeneratorsTestCase assert_match /It works!/, silence(:stdout){ generator.invoke(:all) } end + def test_usage_read_from_file + File.expects(:read).returns("USAGE FROM FILE") + assert_equal "USAGE FROM FILE", Rails::Generators::AppGenerator.desc + end + + def test_default_usage + File.expects(:exist?).returns(false) + assert_match /Create rails files for app generator/, Rails::Generators::AppGenerator.desc + end + + def test_default_namespace + assert_match "rails:generators:app", Rails::Generators::AppGenerator.namespace + end + protected def run_generator(args=[]) |