提交 c4bbce96 编写于 作者: Y yuuji.yaginuma

Simplify parse arguments in `ConsoleTest`

If need a parse result of arguments, can obtain it by creating
an instance of the command.
上级 14283115
......@@ -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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册