Add clear_credentials method to ProjectImportData
This backports changes made in https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/9134.
This commit is contained in:
parent
1a5de8955a
commit
27ba546ec8
2 changed files with 15 additions and 0 deletions
|
@ -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
|
||||||
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
|
||||||
|
|
Loading…
Reference in a new issue