Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify parse arguments in ConsoleTest #30832

Merged
merged 1 commit into from
Oct 9, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 3 additions & 16 deletions railties/test/commands/console_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -172,21 +172,8 @@ def load_console
end

def parse_arguments(args)
Rails::Command::ConsoleCommand.class_eval do
alias_method :old_perform, :perform
define_method(:perform) do
extract_environment_option_from_argument

options
end
end

Rails::Command.invoke(:console, args)
ensure
Rails::Command::ConsoleCommand.class_eval do
undef_method :perform
alias_method :perform, :old_perform
undef_method :old_perform
end
command = Rails::Command::ConsoleCommand.new([], args)
command.send(:extract_environment_option_from_argument)
command.options
end
end