mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
warn user if options are given before application name [#3435 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
This commit is contained in:
committed by
José Valim
parent
d793d30776
commit
e9a9ef094e
@@ -55,6 +55,7 @@ module Rails::Generators
|
||||
:desc => "Show this help message and quit"
|
||||
|
||||
def initialize(*args)
|
||||
raise Error, "Options should be given after the application name. For details run: rails --help" if args[0].blank?
|
||||
super
|
||||
if !options[:skip_activerecord] && !DATABASES.include?(options[:database])
|
||||
raise Error, "Invalid value for --database option. Supported for preconfiguration are: #{DATABASES.join(", ")}."
|
||||
|
||||
@@ -58,6 +58,11 @@ class AppGeneratorTest < Rails::Generators::TestCase
|
||||
assert_no_file "public/stylesheets/application.css"
|
||||
end
|
||||
|
||||
def test_options_before_application_name_raises_an_error
|
||||
content = capture(:stderr){ run_generator(["--skip-activerecord", destination_root]) }
|
||||
assert_equal "Options should be given after the application name. For details run: rails --help\n", content
|
||||
end
|
||||
|
||||
def test_name_collision_raises_an_error
|
||||
content = capture(:stderr){ run_generator [File.join(destination_root, "generate")] }
|
||||
assert_equal "Invalid application name generate. Please give a name which does not match one of the reserved rails words.\n", content
|
||||
|
||||
Reference in New Issue
Block a user