Skip to content

Commit 27ba546

Browse files
committed
Add clear_credentials method to ProjectImportData
This backports changes made in https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/9134.
1 parent 1a5de89 commit 27ba546

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

app/models/project_import_data.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,8 @@ def merge_data(hash)
3030
def merge_credentials(hash)
3131
self.credentials = credentials.to_h.merge(hash) unless hash.empty?
3232
end
33+
34+
def clear_credentials
35+
self.credentials = {}
36+
end
3337
end

spec/models/project_import_data_spec.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,15 @@
3939
expect(row.credentials).to eq({ 'number' => 10, 'foo' => 'bar' })
4040
end
4141
end
42+
43+
describe '#clear_credentials' do
44+
it 'clears out the Hash' do
45+
row = described_class.new
46+
47+
row.merge_credentials('number' => 10)
48+
row.clear_credentials
49+
50+
expect(row.credentials).to eq({})
51+
end
52+
end
4253
end

0 commit comments

Comments
 (0)