diff --git a/spec/storage/fog_helper.rb b/spec/storage/fog_helper.rb index 530ca49ab..97934ab0f 100644 --- a/spec/storage/fog_helper.rb +++ b/spec/storage/fog_helper.rb @@ -542,6 +542,7 @@ def check_file expect(@fog_file.public_url).to include("https://#{expected_host}/foo.bar") end + end { nil => 's3-fips.amazonaws.com', @@ -550,7 +551,7 @@ def check_file 'eu-central-1' => 's3-fips.eu-central-1.amazonaws.com', # Carrierwave doesn't know which regions are FIPS-capable. 'us-gov-west-1' => 's3-fips.us-gov-west-1.amazonaws.com' }.each do |region, expected_host| - it "should use a #{expected_host} hostname when using path style and FIPS mode for access #{region} region" do + it "should use a #{expected_host} hostname when using path style and FIPS endpoint for access #{region} region" do allow(@uploader).to receive(:fog_use_ssl_for_aws).and_return(true) allow(@uploader).to receive(:fog_directory).and_return('foo.bar') allow(@uploader).to_receive(:fog_aws_fips).and_return(true) @@ -577,6 +578,22 @@ def check_file expect(@fog_file.public_url).to include("https://#{expected_host}/") end end + + { + nil => 'foobar.s3-fips.amazonaws.com', + 'us-east-1' => 'foobar.s3-fips.amazonaws.com', + 'us-east-2' => 'foobar.s3-fips.us-east-2.amazonaws.com', + 'eu-central-1' => 'foobar.s3-fips.eu-central-1.amazonaws.com' # Carrierwave doesn't know which regions are FIPS-capable + }.each do |region, expected_host| + it "should use a #{expected_host} hostname when using path style and FIPS endpoint for access #{region} region" do + allow(@uploader).to receive(:fog_use_ssl_for_aws).and_return(true) + allow(@uploader).to receive(:fog_directory).and_return('foobar') + allow(@uploader).to_receive(:fog_aws_fips).and_return(true) + allow(@uploader).to receive(:fog_credentials).and_return(@uploader.fog_credentials.merge(region: region)) + + expect(@fog_file.public_url).to include("https://#{expected_host}/") + end + end end it "should use https as a default protocol" do