aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-01-07 21:09:32 +0100
committerJosé Valim <jose.valim@gmail.com>2010-01-07 21:09:32 +0100
commitccc9f0b7de02158a42e5f654cf00ed8b40e79781 (patch)
treee15b6497e8c5afb6d36b052873f44b1859988c06 /railties
parent8fe66f1af01a744751344b83a9952e0cd91a1692 (diff)
downloadrails-ccc9f0b7de02158a42e5f654cf00ed8b40e79781.tar.gz
rails-ccc9f0b7de02158a42e5f654cf00ed8b40e79781.tar.bz2
rails-ccc9f0b7de02158a42e5f654cf00ed8b40e79781.zip
Ensure application names are not singularized.
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/rails/generators/rails/app/app_generator.rb2
-rw-r--r--railties/test/generators/app_generator_test.rb9
2 files changed, 8 insertions, 3 deletions
diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb
index 2f85a0504e..ba3eb67fe0 100644
--- a/railties/lib/rails/generators/rails/app/app_generator.rb
+++ b/railties/lib/rails/generators/rails/app/app_generator.rb
@@ -194,7 +194,7 @@ module Rails::Generators
end
def app_const_base
- @app_const_base ||= app_name.gsub(/\W/, '_').squeeze('_').classify
+ @app_const_base ||= app_name.gsub(/\W/, '_').squeeze('_').camelize
end
def app_const
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb
index 85081609de..3e3cd90bed 100644
--- a/railties/test/generators/app_generator_test.rb
+++ b/railties/test/generators/app_generator_test.rb
@@ -55,16 +55,21 @@ class AppGeneratorTest < GeneratorsTestCase
end
def test_invalid_application_name_raises_an_error
- content = capture(:stderr){ Rails::Generators::AppGenerator.start [File.join(destination_root, "43-things")] }
+ content = capture(:stderr){ run_generator [File.join(destination_root, "43-things")] }
assert_equal "Invalid application name 43-things. Please give a name which does not start with numbers.\n", content
end
def test_invalid_application_name_is_fixed
- silence(:stdout){ Rails::Generators::AppGenerator.start [File.join(destination_root, "things-43")] }
+ run_generator [File.join(destination_root, "things-43")]
assert_file "things-43/config/environment.rb", /Things43::Application\.initialize!/
assert_file "things-43/config/application.rb", /^module Things43$/
end
+ def test_application_names_are_not_singularized
+ run_generator [File.join(destination_root, "hats")]
+ assert_file "hats/config/environment.rb", /Hats::Application\.initialize!/
+ end
+
def test_config_database_is_added_by_default
run_generator
assert_file "config/database.yml", /sqlite3/