Commit 27ba546e authored by Stan Hu's avatar Stan Hu

Add clear_credentials method to ProjectImportData

This backports changes made in
https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/9134.
parent 1a5de895
......@@ -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
......@@ -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
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