diff options
author | José Valim <jose.valim@gmail.com> | 2009-06-25 15:45:15 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2009-06-25 15:45:15 +0200 |
commit | 0bb95968db3695467b63357aab66a9dddb62295c (patch) | |
tree | 408b2ff0c63ce874ca56a033915d47611925b358 /railties/test | |
parent | d5bdf31d892136d59302adb14328db0417c70d76 (diff) | |
download | rails-0bb95968db3695467b63357aab66a9dddb62295c.tar.gz rails-0bb95968db3695467b63357aab66a9dddb62295c.tar.bz2 rails-0bb95968db3695467b63357aab66a9dddb62295c.zip |
More code refactoring.
Diffstat (limited to 'railties/test')
-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=[]) |