Commit 09d9b115 authored by Nick Thomas's avatar Nick Thomas

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
parents 55a1c6b5 27ba546e
...@@ -30,4 +30,8 @@ class ProjectImportData < ActiveRecord::Base ...@@ -30,4 +30,8 @@ class ProjectImportData < ActiveRecord::Base
def merge_credentials(hash) def merge_credentials(hash)
self.credentials = credentials.to_h.merge(hash) unless hash.empty? self.credentials = credentials.to_h.merge(hash) unless hash.empty?
end end
def clear_credentials
self.credentials = {}
end
end end
...@@ -39,4 +39,15 @@ describe ProjectImportData do ...@@ -39,4 +39,15 @@ describe ProjectImportData do
expect(row.credentials).to eq({ 'number' => 10, 'foo' => 'bar' }) expect(row.credentials).to eq({ 'number' => 10, 'foo' => 'bar' })
end end
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 end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment