debian-mirror-gitlab/spec/models/project_import_data_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

54 lines
1.3 KiB
Ruby
Raw Normal View History

2019-02-15 15:39:39 +05:30
# frozen_string_literal: true
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe ProjectImportData do
2019-02-15 15:39:39 +05:30
describe '#merge_data' do
it 'writes the Hash to the attribute if it is nil' do
row = described_class.new
row.merge_data('number' => 10)
expect(row.data).to eq({ 'number' => 10 })
end
it 'merges the Hash into an existing Hash if one was present' do
row = described_class.new(data: { 'number' => 10 })
row.merge_data('foo' => 'bar')
expect(row.data).to eq({ 'number' => 10, 'foo' => 'bar' })
end
end
describe '#merge_credentials' do
it 'writes the Hash to the attribute if it is nil' do
row = described_class.new
row.merge_credentials('number' => 10)
expect(row.credentials).to eq({ 'number' => 10 })
end
it 'merges the Hash into an existing Hash if one was present' do
row = described_class.new
row.credentials = { 'number' => 10 }
row.merge_credentials('foo' => 'bar')
expect(row.credentials).to eq({ 'number' => 10, 'foo' => 'bar' })
end
end
2019-03-02 22:35:43 +05:30
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
2019-02-15 15:39:39 +05:30
end