summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2019-01-15 12:38:03 +0000
committerNick Thomas <nick@gitlab.com>2019-01-15 12:38:03 +0000
commit09d9b11513cfefcfc281f2f85526316fb368d8f2 (patch)
tree53add14142a93c1655a7063d5b697c4b5ce962a7
parent55a1c6b555eecb2f07b501f236f6ae5fcde9e63f (diff)
parent27ba546ec8dec5a64f030ec50aa53c447e1628d4 (diff)
downloadgitlab-ce-09d9b11513cfefcfc281f2f85526316fb368d8f2.tar.gz
Merge branch 'sh-fix-project-mirrors-mix-http-ssh-creds-ce' into 'master'
Add clear_credentials method to ProjectImportData See merge request gitlab-org/gitlab-ce!24373
-rw-r--r--app/models/project_import_data.rb4
-rw-r--r--spec/models/project_import_data_spec.rb11
2 files changed, 15 insertions, 0 deletions
diff --git a/app/models/project_import_data.rb b/app/models/project_import_data.rb
index 525725034a5..aa0c121fe99 100644
--- a/app/models/project_import_data.rb
+++ b/app/models/project_import_data.rb
@@ -30,4 +30,8 @@ class ProjectImportData < ActiveRecord::Base
def merge_credentials(hash)
self.credentials = credentials.to_h.merge(hash) unless hash.empty?
end
+
+ def clear_credentials
+ self.credentials = {}
+ end
end
diff --git a/spec/models/project_import_data_spec.rb b/spec/models/project_import_data_spec.rb
index e9910c0a5d1..fe47811f074 100644
--- a/spec/models/project_import_data_spec.rb
+++ b/spec/models/project_import_data_spec.rb
@@ -39,4 +39,15 @@ describe ProjectImportData do
expect(row.credentials).to eq({ 'number' => 10, 'foo' => 'bar' })
end
end
+
+ describe '#clear_credentials' do
+ it 'clears out the Hash' do
+ row = described_class.new
+
+ row.merge_credentials('number' => 10)
+ row.clear_credentials
+
+ expect(row.credentials).to eq({})
+ end
+ end
end