Adjust context using allow method for Application Record spec

This commit is contained in:
François Turbelin
2025-12-12 14:45:01 +01:00
committed by Filipe
parent cab4b2fb28
commit 252943e9de

View File

@@ -10,21 +10,20 @@ RSpec.describe ApplicationRecord do
context "with a S3 bucket defined" do
before do
expect(ENV).to receive(:[]).with("S3_BUCKET").and_return("test-bucket")
expect(ENV).to receive(:[]).with("S3_ENDPOINT").and_return(nil)
allow(ENV).to receive(:[]).with("S3_BUCKET").and_return("test-bucket")
allow(ENV).to receive(:[]).with("S3_ENDPOINT").and_return(nil)
end
it { is_expected.to eq(:amazon_public) }
end
context "with a S3 bucket and endpoint defined" do
before do
expect(ENV).to receive(:[]).with("S3_BUCKET").and_return("test-bucket")
expect(ENV).to receive(:[]).with("S3_ENDPOINT")
.and_return("https://s3-compatible-alternative.com")
context "with a S3 endpoint defined" do
before do
allow(ENV).to receive(:[]).with("S3_ENDPOINT")
.and_return("https://s3-compatible-alternative.com")
end
it { is_expected.to eq(:s3_compatible_storage_public) }
end
it { is_expected.to eq(:s3_compatible_storage_public) }
end
end
end