Skip to content

Instantly share code, notes, and snippets.

@single-stop-rj
Last active October 1, 2021 16:09
Show Gist options
  • Save single-stop-rj/e32c5214e19748402957a5c70a4f839e to your computer and use it in GitHub Desktop.
Save single-stop-rj/e32c5214e19748402957a5c70a4f839e to your computer and use it in GitHub Desktop.
# ... l
let(:s3_resource) { instance_double(Aws::S3::Resource, bucket: bucket) }
let(:bucket) { instance_double(Aws::S3::Bucket) }
let(:object) { instance_double(Aws::S3::Object, etag: 'sample_etag', key: file_key, size: 1_234) }
before(:each) do
ENV['S3_BUCKET'] = test_bucket_name
allow(Aws::S3::Resource).to receive(:new).and_return(s3_resource)
allow(s3_resource).to receive(:bucket).with(test_bucket_name).and_return(bucket)
allow(bucket).to receive(:object).with(file_key).and_return(object)
allow(object).to receive(:delete).and_return(true)
end
it { is_expected.to be true }
# ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment