diff --git a/google-cloud-storage/samples/acceptance/files_test.rb b/google-cloud-storage/samples/acceptance/files_test.rb index aa8bf1f10f49..bbee97a951ce 100644 --- a/google-cloud-storage/samples/acceptance/files_test.rb +++ b/google-cloud-storage/samples/acceptance/files_test.rb @@ -337,10 +337,13 @@ def mock_cipher.random_key set_object_contexts bucket_name: bucket.name, file_name: remote_file_name, custom_context_key: custom_context_key2, custom_context_value: custom_context_value2 end it "fetches all object contexts" do - - assert_output "Custom Contexts for #{remote_file_name} are:\nKey: #{custom_context_key1}, Value: #{custom_context_value1}\nKey: #{custom_context_key2}, Value: #{custom_context_value2}\n" do + out, _err = capture_io do get_object_contexts bucket_name: bucket.name, file_name: remote_file_name end + + assert_includes out, "Custom Contexts for #{remote_file_name} are:\n" + assert_includes out, "Key: #{custom_context_key1}, Value: #{custom_context_value1}\n" + assert_includes out, "Key: #{custom_context_key2}, Value: #{custom_context_value2}\n" end end