aboutsummaryrefslogtreecommitdiffstats
path: root/test/service/s3_service_test.rb
diff options
context:
space:
mode:
authorGeorge Claghorn <george@basecamp.com>2017-07-16 19:17:18 -0400
committerGeorge Claghorn <george@basecamp.com>2017-07-16 19:17:18 -0400
commit2f15938587a6a3fa1ce6745511aeb81d833e51c2 (patch)
treece53411873d722ac25923d8cb96a69b88208dd51 /test/service/s3_service_test.rb
parent2cd1b883c3514523939992fdde1d61b608e9c5db (diff)
downloadrails-2f15938587a6a3fa1ce6745511aeb81d833e51c2.tar.gz
rails-2f15938587a6a3fa1ce6745511aeb81d833e51c2.tar.bz2
rails-2f15938587a6a3fa1ce6745511aeb81d833e51c2.zip
Fix S3 direct upload test
Diffstat (limited to 'test/service/s3_service_test.rb')
-rw-r--r--test/service/s3_service_test.rb16
1 files changed, 3 insertions, 13 deletions
diff --git a/test/service/s3_service_test.rb b/test/service/s3_service_test.rb
index 4875ac908b..81eff2c02d 100644
--- a/test/service/s3_service_test.rb
+++ b/test/service/s3_service_test.rb
@@ -9,25 +9,15 @@ if SERVICE_CONFIGURATIONS[:s3]
include ActiveStorage::Service::SharedServiceTests
test "direct upload" do
- # FIXME: This test is failing because of a mismatched request signature, but it works in the browser.
- skip
-
begin
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
+ url = @service.url_for_direct_upload(key, expires_in: 5.minutes, content_type: "text/plain", content_length: data.size)
- HTTParty.post(
+ HTTParty.put(
url,
- query: query,
body: data,
- headers: {
- "Content-Type": "text/plain",
- "Origin": "http://localhost:3000"
- },
+ headers: { "Content-Type" => "text/plain" },
debug_output: STDOUT
)