Skip to content

Commit e42e509

Browse files
authored
refactor(gcs): random_bucket_hash to take variable arguments. (#14176)
* refactor(gcs): random_bucket_hash to take variable arguments. * refactor(gcs): addressing review comment.
1 parent 6bfc78e commit e42e509

30 files changed

Lines changed: 102 additions & 95 deletions

google-cloud-storage/test/google/cloud/storage/bucket_acl_test.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
describe Google::Cloud::Storage::Bucket, :acl, :mock_storage do
1818
let(:bucket_name) { "found-bucket" }
19-
let(:bucket_hash) { random_bucket_hash bucket_name }
19+
let(:bucket_hash) { random_bucket_hash name: bucket_name }
2020
let(:bucket_json) { bucket_hash.to_json }
2121
let(:bucket_gapi) { Google::Apis::StorageV1::Bucket.from_json bucket_json }
2222
let(:bucket) { Google::Cloud::Storage::Bucket.from_gapi bucket_gapi, storage.service }
@@ -258,7 +258,7 @@
258258
mock = Minitest::Mock.new
259259
mock.expect :get_bucket, bucket_gapi, get_bucket_args(bucket_name, user_project: "test")
260260
mock.expect :patch_bucket,
261-
Google::Apis::StorageV1::Bucket.from_json(random_bucket_hash(bucket_name).to_json),
261+
Google::Apis::StorageV1::Bucket.from_json(random_bucket_hash(name: bucket_name).to_json),
262262
patch_bucket_args(bucket_name, predefined_acl: "authenticatedRead", user_project: "test")
263263

264264
storage.service.mocked_service = mock
@@ -422,7 +422,7 @@
422422
def predefined_acl_update acl_role
423423
mock = Minitest::Mock.new
424424
mock.expect :patch_bucket,
425-
Google::Apis::StorageV1::Bucket.from_json(random_bucket_hash(bucket.name).to_json),
425+
Google::Apis::StorageV1::Bucket.from_json(random_bucket_hash(name: bucket.name).to_json),
426426
patch_bucket_args(bucket_name, predefined_acl: acl_role)
427427

428428
storage.service.mocked_service = mock

google-cloud-storage/test/google/cloud/storage/bucket_compose_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
require "helper"
1616

1717
describe Google::Cloud::Storage::Bucket, :compose, :mock_storage do
18-
let(:bucket_gapi) { Google::Apis::StorageV1::Bucket.from_json random_bucket_hash("bucket").to_json }
18+
let(:bucket_gapi) { Google::Apis::StorageV1::Bucket.from_json random_bucket_hash(name: "bucket").to_json }
1919
let(:bucket) { Google::Cloud::Storage::Bucket.from_gapi bucket_gapi, storage.service }
2020
let(:bucket_user_project) { Google::Cloud::Storage::Bucket.from_gapi bucket_gapi, storage.service, user_project: true }
2121

google-cloud-storage/test/google/cloud/storage/bucket_default_acl_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
describe Google::Cloud::Storage::Bucket, :default_acl, :mock_storage do
1818
let(:bucket_name) { "found-bucket" }
19-
let(:bucket_hash) { random_bucket_hash bucket_name }
19+
let(:bucket_hash) { random_bucket_hash name: bucket_name }
2020
let(:bucket_json) { bucket_hash.to_json }
2121
let(:bucket_gapi) { Google::Apis::StorageV1::Bucket.from_json bucket_json }
2222
let(:bucket) { Google::Cloud::Storage::Bucket.from_gapi bucket_gapi, storage.service }
@@ -364,7 +364,7 @@
364364
def predefined_default_acl_update acl_role
365365
mock = Minitest::Mock.new
366366
mock.expect :patch_bucket,
367-
Google::Apis::StorageV1::Bucket.from_json(random_bucket_hash(bucket.name).to_json),
367+
Google::Apis::StorageV1::Bucket.from_json(random_bucket_hash(name: bucket.name).to_json),
368368
patch_bucket_args(bucket_name, Google::Apis::StorageV1::Bucket.new(default_object_acl: []), predefined_default_object_acl: acl_role)
369369

370370
storage.service.mocked_service = mock

google-cloud-storage/test/google/cloud/storage/bucket_encryption_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
describe Google::Cloud::Storage::Bucket, :encryption, :mock_storage do
1818
let(:bucket_name) { "new-bucket-#{Time.now.to_i}" }
19-
let(:bucket_hash) { random_bucket_hash bucket_name }
19+
let(:bucket_hash) { random_bucket_hash name: bucket_name }
2020
let(:bucket_json) { bucket_hash.to_json }
2121
let(:bucket_gapi) { Google::Apis::StorageV1::Bucket.from_json bucket_json }
2222
let(:bucket) { Google::Cloud::Storage::Bucket.from_gapi bucket_gapi, storage.service }

google-cloud-storage/test/google/cloud/storage/bucket_iam_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
describe Google::Cloud::Storage::Bucket, :iam, :mock_storage do
1818
let(:bucket_name) { "found-bucket" }
19-
let(:bucket_hash) { random_bucket_hash bucket_name }
19+
let(:bucket_hash) { random_bucket_hash name: bucket_name }
2020
let(:bucket_json) { bucket_hash.to_json }
2121
let(:bucket_gapi) { Google::Apis::StorageV1::Bucket.from_json bucket_json }
2222
let(:bucket) { Google::Cloud::Storage::Bucket.from_gapi bucket_gapi, storage.service }

google-cloud-storage/test/google/cloud/storage/bucket_lock_retention_policy_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
is_locked: true) }
2828
let(:bucket_retention_policy_hash) { JSON.parse bucket_retention_policy_gapi.to_json }
2929

30-
let(:bucket_hash) { random_bucket_hash bucket_name }
30+
let(:bucket_hash) { random_bucket_hash name: bucket_name }
3131
let(:bucket_gapi) { Google::Apis::StorageV1::Bucket.from_json bucket_hash.to_json }
3232
let(:bucket) { Google::Cloud::Storage::Bucket.from_gapi bucket_gapi, storage.service }
3333
let(:bucket_user_project) { Google::Cloud::Storage::Bucket.from_gapi bucket_gapi, storage.service, user_project: true }

google-cloud-storage/test/google/cloud/storage/bucket_notification_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
describe Google::Cloud::Storage::Bucket, :notification, :mock_storage do
1818
let(:bucket_name) { "found-bucket" }
19-
let(:bucket_hash) { random_bucket_hash bucket_name }
19+
let(:bucket_hash) { random_bucket_hash name: bucket_name }
2020
let(:bucket_json) { bucket_hash.to_json }
2121
let(:bucket_gapi) { Google::Apis::StorageV1::Bucket.from_json bucket_json }
2222
let(:bucket) { Google::Cloud::Storage::Bucket.from_gapi bucket_gapi, storage.service }

google-cloud-storage/test/google/cloud/storage/bucket_post_object_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
describe Google::Cloud::Storage::Bucket, :post_object, :mock_storage do
1818
let(:bucket_name) { "bucket" }
19-
let(:bucket_gapi) { Google::Apis::StorageV1::Bucket.from_json random_bucket_hash(bucket_name).to_json }
19+
let(:bucket_gapi) { Google::Apis::StorageV1::Bucket.from_json random_bucket_hash(name: bucket_name).to_json }
2020
let(:bucket) { Google::Cloud::Storage::Bucket.from_gapi bucket_gapi, storage.service }
2121

2222
let(:file_path) { "a/b/c/{my_file}.ext" }

google-cloud-storage/test/google/cloud/storage/bucket_public_access_prevention_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
describe Google::Cloud::Storage::Bucket, :public_access_prevention, :mock_storage do
1818
let(:bucket_name) { "new-bucket-#{Time.now.to_i}" }
19-
let(:bucket_hash) { random_bucket_hash bucket_name }
19+
let(:bucket_hash) { random_bucket_hash name: bucket_name }
2020
let(:bucket_gapi) { Google::Apis::StorageV1::Bucket.from_json bucket_hash.to_json }
2121
let(:bucket) { Google::Cloud::Storage::Bucket.from_gapi bucket_gapi, storage.service }
2222
let(:bucket_user_project) { Google::Cloud::Storage::Bucket.from_gapi bucket_gapi, storage.service, user_project: true }

google-cloud-storage/test/google/cloud/storage/bucket_signed_url_v2_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
describe Google::Cloud::Storage::Bucket, :signed_url, :mock_storage do
1919
let(:bucket_name) { "bucket" }
20-
let(:bucket_gapi) { Google::Apis::StorageV1::Bucket.from_json random_bucket_hash(bucket_name).to_json }
20+
let(:bucket_gapi) { Google::Apis::StorageV1::Bucket.from_json random_bucket_hash(name: bucket_name).to_json }
2121
let(:bucket) { Google::Cloud::Storage::Bucket.from_gapi bucket_gapi, storage.service }
2222

2323
let(:file_path) { "file.ext" }

0 commit comments

Comments
 (0)