mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Simplify parse arguments in ConsoleTest
If need a parse result of arguments, can obtain it by creating an instance of the command.
This commit is contained in:
parent
142831159c
commit
c4bbce9697
1 changed files with 3 additions and 16 deletions
|
@ -172,21 +172,8 @@ class Rails::ConsoleTest < ActiveSupport::TestCase
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue