@@ -17,13 +17,13 @@ class ActiveStorage::S3DirectUploadsControllerTest < ActionDispatch::Integration
17
17
test "creating new direct upload" do
18
18
checksum = OpenSSL ::Digest ::MD5 . base64digest ( "Hello" )
19
19
metadata = {
20
- "foo" : "bar" ,
21
- "my_key_1" : "my_value_1" ,
22
- "my_key_2" : "my_value_2" ,
23
- "platform" : "my_platform" ,
24
- "library_ID" : "12345" ,
25
- "custom" : {
26
- "my_key_3" : "my_value_3"
20
+ "foo" => "bar" ,
21
+ "my_key_1" => "my_value_1" ,
22
+ "my_key_2" => "my_value_2" ,
23
+ "platform" => "my_platform" ,
24
+ "library_ID" => "12345" ,
25
+ "custom" => {
26
+ "my_key_3" => "my_value_3"
27
27
}
28
28
}
29
29
@@ -35,7 +35,7 @@ class ActiveStorage::S3DirectUploadsControllerTest < ActionDispatch::Integration
35
35
assert_equal "hello.txt" , details [ "filename" ]
36
36
assert_equal 6 , details [ "byte_size" ]
37
37
assert_equal checksum , details [ "checksum" ]
38
- assert_equal metadata , details [ "metadata" ] . deep_transform_keys ( & :to_sym )
38
+ assert_equal metadata , details [ "metadata" ]
39
39
assert_equal "text/plain" , details [ "content_type" ]
40
40
assert_match SERVICE_CONFIGURATIONS [ :s3 ] [ :bucket ] , details [ "direct_upload" ] [ "url" ]
41
41
assert_match ( /s3(-[-a-z0-9]+)?\. (\S +)?amazonaws\. com/ , details [ "direct_upload" ] [ "url" ] )
@@ -63,25 +63,25 @@ class ActiveStorage::GCSDirectUploadsControllerTest < ActionDispatch::Integratio
63
63
test "creating new direct upload" do
64
64
checksum = OpenSSL ::Digest ::MD5 . base64digest ( "Hello" )
65
65
metadata = {
66
- "foo" : "bar" ,
67
- "my_key_1" : "my_value_1" ,
68
- "my_key_2" : "my_value_2" ,
69
- "platform" : "my_platform" ,
70
- "library_ID" : "12345" ,
71
- "custom" : {
72
- "my_key_3" : "my_value_3"
66
+ "foo" => "bar" ,
67
+ "my_key_1" => "my_value_1" ,
68
+ "my_key_2" => "my_value_2" ,
69
+ "platform" => "my_platform" ,
70
+ "library_ID" => "12345" ,
71
+ "custom" => {
72
+ "my_key_3" => "my_value_3"
73
73
}
74
74
}
75
75
76
76
post rails_direct_uploads_url , params : { blob : {
77
77
filename : "hello.txt" , byte_size : 6 , checksum : checksum , content_type : "text/plain" , metadata : metadata } }
78
78
79
- @ response. parsed_body . tap do |details |
79
+ response . parsed_body . tap do |details |
80
80
assert_equal ActiveStorage ::Blob . find ( details [ "id" ] ) , ActiveStorage ::Blob . find_signed! ( details [ "signed_id" ] )
81
81
assert_equal "hello.txt" , details [ "filename" ]
82
82
assert_equal 6 , details [ "byte_size" ]
83
83
assert_equal checksum , details [ "checksum" ]
84
- assert_equal metadata , details [ "metadata" ] . deep_transform_keys ( & :to_sym )
84
+ assert_equal metadata , details [ "metadata" ]
85
85
assert_equal "text/plain" , details [ "content_type" ]
86
86
assert_match %r{storage\. googleapis\. com/#{ @config [ :bucket ] } } , details [ "direct_upload" ] [ "url" ]
87
87
assert_equal ( { "Content-MD5" => checksum , "Content-Disposition" => "inline; filename=\" hello.txt\" ; filename*=UTF-8''hello.txt" , "x-goog-meta-my_key_3" => "my_value_3" } , details [ "direct_upload" ] [ "headers" ] )
@@ -108,22 +108,22 @@ class ActiveStorage::AzureStorageDirectUploadsControllerTest < ActionDispatch::I
108
108
test "creating new direct upload" do
109
109
checksum = OpenSSL ::Digest ::MD5 . base64digest ( "Hello" )
110
110
metadata = {
111
- "foo" : "bar" ,
112
- "my_key_1" : "my_value_1" ,
113
- "my_key_2" : "my_value_2" ,
114
- "platform" : "my_platform" ,
115
- "library_ID" : "12345"
111
+ "foo" => "bar" ,
112
+ "my_key_1" => "my_value_1" ,
113
+ "my_key_2" => "my_value_2" ,
114
+ "platform" => "my_platform" ,
115
+ "library_ID" => "12345"
116
116
}
117
117
118
118
post rails_direct_uploads_url , params : { blob : {
119
119
filename : "hello.txt" , byte_size : 6 , checksum : checksum , content_type : "text/plain" , metadata : metadata } }
120
120
121
- @ response. parsed_body . tap do |details |
121
+ response . parsed_body . tap do |details |
122
122
assert_equal ActiveStorage ::Blob . find ( details [ "id" ] ) , ActiveStorage ::Blob . find_signed! ( details [ "signed_id" ] )
123
123
assert_equal "hello.txt" , details [ "filename" ]
124
124
assert_equal 6 , details [ "byte_size" ]
125
125
assert_equal checksum , details [ "checksum" ]
126
- assert_equal metadata , details [ "metadata" ] . deep_transform_keys ( & :to_sym )
126
+ assert_equal metadata , details [ "metadata" ]
127
127
assert_equal "text/plain" , details [ "content_type" ]
128
128
assert_match %r{#{ @config [ :storage_account_name ] } \. blob\. core\. windows\. net/#{ @config [ :container ] } } , details [ "direct_upload" ] [ "url" ]
129
129
assert_equal ( { "Content-Type" => "text/plain" , "Content-MD5" => checksum , "x-ms-blob-content-disposition" => "inline; filename=\" hello.txt\" ; filename*=UTF-8''hello.txt" , "x-ms-blob-type" => "BlockBlob" } , details [ "direct_upload" ] [ "headers" ] )
@@ -148,7 +148,7 @@ class ActiveStorage::DiskDirectUploadsControllerTest < ActionDispatch::Integrati
148
148
post rails_direct_uploads_url , params : { blob : {
149
149
filename : "hello.txt" , byte_size : 6 , checksum : checksum , content_type : "text/plain" , metadata : metadata } }
150
150
151
- @ response. parsed_body . tap do |details |
151
+ response . parsed_body . tap do |details |
152
152
assert_equal ActiveStorage ::Blob . find ( details [ "id" ] ) , ActiveStorage ::Blob . find_signed! ( details [ "signed_id" ] )
153
153
assert_equal "hello.txt" , details [ "filename" ]
154
154
assert_equal 6 , details [ "byte_size" ]
@@ -163,19 +163,19 @@ class ActiveStorage::DiskDirectUploadsControllerTest < ActionDispatch::Integrati
163
163
test "creating new direct upload does not include root in json" do
164
164
checksum = OpenSSL ::Digest ::MD5 . base64digest ( "Hello" )
165
165
metadata = {
166
- "foo" : "bar" ,
167
- "my_key_1" : "my_value_1" ,
168
- "my_key_2" : "my_value_2" ,
169
- "platform" : "my_platform" ,
170
- "library_ID" : "12345"
166
+ "foo" => "bar" ,
167
+ "my_key_1" => "my_value_1" ,
168
+ "my_key_2" => "my_value_2" ,
169
+ "platform" => "my_platform" ,
170
+ "library_ID" => "12345"
171
171
}
172
172
173
173
set_include_root_in_json ( true ) do
174
174
post rails_direct_uploads_url , params : { blob : {
175
175
filename : "hello.txt" , byte_size : 6 , checksum : checksum , content_type : "text/plain" , metadata : metadata } }
176
176
end
177
177
178
- @ response. parsed_body . tap do |details |
178
+ response . parsed_body . tap do |details |
179
179
assert_nil details [ "blob" ]
180
180
assert_not_nil details [ "id" ]
181
181
end
0 commit comments