2018-09-25 13:33:48 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-09-24 23:09:30 -04:00
|
|
|
RSpec.describe QA::Resource::Repository::Push do
|
2018-09-25 13:33:48 -04:00
|
|
|
describe '.files=' do
|
|
|
|
let(:files) do
|
|
|
|
[
|
|
|
|
{
|
|
|
|
name: 'file.txt',
|
|
|
|
content: 'foo'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'raises an error if files is not an array' do
|
|
|
|
expect { subject.files = '' }.to raise_error(ArgumentError)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'raises an error if files is an empty array' do
|
|
|
|
expect { subject.files = [] }.to raise_error(ArgumentError)
|
|
|
|
end
|
|
|
|
|
2019-08-14 04:22:15 -04:00
|
|
|
it 'raises an error if files is not an array of hashes with :name and :content keys' do
|
|
|
|
expect { subject.files = [{ foo: 'foo' }] }.to raise_error(ArgumentError)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not raise if files is an array of hashes with :name and :content keys' do
|
2018-09-25 13:33:48 -04:00
|
|
|
expect { subject.files = files }.not_to raise_error
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|