1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/railties/test/command/application_test.rb
Alex Ghiculescu 34ff6a0a4a Display a help message if rails new is called without a path
Fixes https://github.com/rails/rails/issues/42196

Now, `rails new` will display the same error message that `rails` and `rails help new` does.

To test:

- Pull this branch
- Uninstall your local rails copy using `gem uninstall rails`
- Move into the root directory where you pulled down the rails code, then install: `rake install`
- In another directory run `rails new`
2021-05-14 10:21:26 -05:00

19 lines
671 B
Ruby

# frozen_string_literal: true
require "abstract_unit"
require "rails/command"
class Rails::Command::ApplicationTest < ActiveSupport::TestCase
test "rails new without path prints help" do
output = capture(:stdout) do
Rails::Command.invoke(:application, %w[new])
end
# Doesn't include the default thor error message:
assert_not output.start_with?("No value provided for required arguments")
# Includes contents of ~/railties/lib/rails/generators/rails/app/USAGE:
assert output.include?("The 'rails new' command creates a new Rails application with a default
directory structure and configuration at the path you specify.")
end
end