diff options
author | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2017-10-08 13:09:30 +0900 |
---|---|---|
committer | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2017-10-08 13:12:49 +0900 |
commit | c4bbce969779179457218558be7554b4ee4b3230 (patch) | |
tree | 8c9a5ae41b87291cd25606b293fe08add6cb5470 /railties/test/commands | |
parent | 142831159c0d72c7bf2e23a35bfdbdccd8b5a931 (diff) | |
download | rails-c4bbce969779179457218558be7554b4ee4b3230.tar.gz rails-c4bbce969779179457218558be7554b4ee4b3230.tar.bz2 rails-c4bbce969779179457218558be7554b4ee4b3230.zip |
Simplify parse arguments in `ConsoleTest`
If need a parse result of arguments, can obtain it by creating
an instance of the command.
Diffstat (limited to 'railties/test/commands')
-rw-r--r-- | railties/test/commands/console_test.rb | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/railties/test/commands/console_test.rb b/railties/test/commands/console_test.rb index 7eb26c355c..45ab8d87ff 100644 --- a/railties/test/commands/console_test.rb +++ b/railties/test/commands/console_test.rb @@ -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 |