aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authoryuuji.yaginuma <yuuji.yaginuma@gmail.com>2017-10-08 13:09:30 +0900
committeryuuji.yaginuma <yuuji.yaginuma@gmail.com>2017-10-08 13:12:49 +0900
commitc4bbce969779179457218558be7554b4ee4b3230 (patch)
tree8c9a5ae41b87291cd25606b293fe08add6cb5470 /railties
parent142831159c0d72c7bf2e23a35bfdbdccd8b5a931 (diff)
downloadrails-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')
-rw-r--r--railties/test/commands/console_test.rb19
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