Permalink
Browse files

Ensure application names are not singularized.

  • Loading branch information...
1 parent 8fe66f1 commit ccc9f0b7de02158a42e5f654cf00ed8b40e79781 @josevalim josevalim committed Jan 7, 2010
@@ -194,7 +194,7 @@ def app_name
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
@@ -55,16 +55,21 @@ def test_invalid_database_option_raises_an_error
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/

0 comments on commit ccc9f0b

Please sign in to comment.