From 939cd374e7831d10b8e3c8b65dd9a2380e8f2393 Mon Sep 17 00:00:00 2001 From: DJ Mountney Date: Wed, 10 Aug 2016 16:53:52 -0700 Subject: In order to use chomp! on the input later, we need to dup the ARGV input string for keys Also updated the gitlab_key tests to freeze the ARGV variables. --- lib/gitlab_keys.rb | 3 ++- spec/gitlab_keys_spec.rb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/gitlab_keys.rb b/lib/gitlab_keys.rb index eb359f8..0eb04eb 100644 --- a/lib/gitlab_keys.rb +++ b/lib/gitlab_keys.rb @@ -22,7 +22,8 @@ class GitlabKeys def initialize @command = ARGV.shift @key_id = ARGV.shift - @key = ARGV.shift + key = ARGV.shift + @key = key.dup if key @auth_file = GitlabConfig.new.auth_file end diff --git a/spec/gitlab_keys_spec.rb b/spec/gitlab_keys_spec.rb index d944278..67f9f40 100644 --- a/spec/gitlab_keys_spec.rb +++ b/spec/gitlab_keys_spec.rb @@ -284,7 +284,7 @@ describe GitlabKeys do def argv(*args) args.each_with_index do |arg, i| - ARGV[i] = arg + ARGV[i] = arg.freeze end end -- cgit v1.2.1