Skip to content

Commit

Permalink
fix and add spec
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-domsch-sp committed Nov 26, 2024
1 parent 71b33d3 commit 6cd4991
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion spec/storage/fog_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit 6cd4991

Please sign in to comment.