aboutsummaryrefslogtreecommitdiffstats
path: root/test/service
diff options
context:
space:
mode:
authorDino Maric <dino.onex@gmail.com>2017-07-13 21:54:06 +0200
committerDavid Heinemeier Hansson <david@loudthinking.com>2017-07-13 21:54:06 +0200
commit14e6386b3ceb0ab1d13ddd1353722d56785f9007 (patch)
treeb0c9a925c8591215629ff65bf0ac3e9a0d68ac04 /test/service
parent50bec56254c72a0a11815a13f3469294af8c89e5 (diff)
downloadrails-14e6386b3ceb0ab1d13ddd1353722d56785f9007.tar.gz
rails-14e6386b3ceb0ab1d13ddd1353722d56785f9007.tar.bz2
rails-14e6386b3ceb0ab1d13ddd1353722d56785f9007.zip
Fix regular expression on s3 test URL generation test (#44)
So tests are passing if the bucket name is rails-active storage. But developers specify their own s3 tests configuration (in my case was activestorage-test) then this regex fails. Also the first part is dynamic and based on bucket name and region
Diffstat (limited to 'test/service')
-rw-r--r--test/service/s3_service_test.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/test/service/s3_service_test.rb b/test/service/s3_service_test.rb
index 167aa78a17..4875ac908b 100644
--- a/test/service/s3_service_test.rb
+++ b/test/service/s3_service_test.rb
@@ -16,7 +16,7 @@ if SERVICE_CONFIGURATIONS[:s3]
key = SecureRandom.base58(24)
data = "Something else entirely!"
direct_upload_url = @service.url_for_direct_upload(key, expires_in: 5.minutes, content_type: "text/plain", content_length: data.size)
-
+
url = URI.parse(direct_upload_url).to_s.split("?").first
query = CGI::parse(URI.parse(direct_upload_url).query).collect { |(k, v)| [ k, v.first ] }.to_h
@@ -30,16 +30,16 @@ if SERVICE_CONFIGURATIONS[:s3]
},
debug_output: STDOUT
)
-
+
assert_equal data, @service.download(key)
ensure
@service.delete key
end
end
-
+
test "signed URL generation" do
- assert_match /rails-activestorage\.s3\.amazonaws\.com.*response-content-disposition=inline.*avatar\.png/,
- @service.url(FIXTURE_KEY, expires_in: 5.minutes, disposition: :inline, filename: "avatar.png")
+ assert_match /.+s3.+amazonaws.com.*response-content-disposition=inline.*avatar\.png/,
+ @service.url(FIXTURE_KEY, expires_in: 5.minutes, disposition: :inline, filename: "avatar.png")
end
end
else