spec/unit/publishers/s3_publisher_spec.rb in omnibus-4.0.0 vs spec/unit/publishers/s3_publisher_spec.rb in omnibus-4.1.0
- old
+ new
@@ -28,15 +28,16 @@
)
end
let(:packages) { [package] }
- let(:client) { double('UberS3', store: nil) }
+ let(:client) { double('Aws::S3::Resource') }
before do
allow(package).to receive(:metadata).and_return(metadata)
allow(subject).to receive(:client).and_return(client)
+ allow(subject).to receive(:store_object)
end
subject { described_class.new(path) }
describe '#publish' do
@@ -46,71 +47,54 @@
expect(package).to receive(:validate!).once
subject.publish
end
it 'uploads the metadata' do
- expect(client).to receive(:store).with(
+ expect(subject).to receive(:store_object).with(
'ubuntu/14.04/x86_64/chef.deb/chef.deb.metadata.json',
package.metadata.to_json,
- access: :private,
+ nil,
+ 'private',
).once
subject.publish
end
it 'uploads the package' do
- expect(client).to receive(:store).with(
+ expect(subject).to receive(:store_object).with(
'ubuntu/14.04/x86_64/chef.deb/chef.deb',
package.content,
- access: :private,
- content_md5: package.metadata[:md5],
+ package.metadata[:md5],
+ 'private'
).once
subject.publish
end
context 'when the upload is set to public' do
subject { described_class.new(path, acl: 'public') }
it 'sets the access control to public_read' do
- expect(client).to receive(:store).with(
+ expect(subject).to receive(:store_object).with(
'ubuntu/14.04/x86_64/chef.deb/chef.deb.metadata.json',
package.metadata.to_json,
- access: :public_read,
+ nil,
+ 'public-read',
).once
subject.publish
end
end
context 'when the upload is set to a nonsensical value' do
subject { described_class.new(path, acl: 'baconbits') }
it 'sets the access control to private' do
- expect(client).to receive(:store).with(
+ expect(subject).to receive(:store_object).with(
'ubuntu/14.04/x86_64/chef.deb/chef.deb.metadata.json',
package.metadata.to_json,
- access: :private,
- ).once
-
- subject.publish
- end
- end
-
- context 'when an alternate platform and platform version are provided' do
- subject do
- described_class.new(path,
- platform: 'debian',
- platform_version: '7',
- )
- end
-
- it 'overrides the platform and platform version used for publishing' do
- expect(client).to receive(:store).with(
- 'debian/7/x86_64/chef.deb/chef.deb',
- package.content,
- access: :private,
- content_md5: package.metadata[:md5],
+ nil,
+ 'private',
).once
subject.publish
end
end