spec/unit/publishers/s3_publisher_spec.rb in omnibus-5.6.1 vs spec/unit/publishers/s3_publisher_spec.rb in omnibus-5.6.6

- old
+ new

@@ -98,9 +98,26 @@ subject.publish end end + context "when the custom s3_publish_pattern is set" do + before do + Config.s3_publish_pattern("custom_prefix/%{name}/%{version}/%{platform}/%{platform_version}") + end + + it "uploads the package to the provided path" do + expect(subject).to receive(:store_object).with( + "custom_prefix/chef/11.0.6/ubuntu/14.04/chef.deb.metadata.json", + FFI_Yajl::Encoder.encode(package.metadata.to_hash, pretty: true), + nil, + "private" + ).once + + subject.publish + end + end + context "when a block is given" do it "yields the package to the block" do block = ->(package) { package.do_something! } expect(package).to receive(:do_something!).once subject.publish(&block)