diff --git a/README.md b/README.md index 00c3f845b..940739881 100644 --- a/README.md +++ b/README.md @@ -129,7 +129,7 @@ Media operations -- uploads & downloads -- can not be included in batch with oth However, some APIs support batch uploads. To upload multiple files in a batch, use the `batch_upload` method instead. Batch uploads should only be used when uploading multiple small files. For large files, upload files individually to -take advantage of the libraries built-in reusmable upload support. +take advantage of the libraries built-in resumable upload support. ### Hashes diff --git a/lib/google/api_client/client_secrets.rb b/lib/google/api_client/client_secrets.rb index a9cc24138..fcf2bf8c4 100644 --- a/lib/google/api_client/client_secrets.rb +++ b/lib/google/api_client/client_secrets.rb @@ -46,7 +46,6 @@ module Google # } # } class ClientSecrets - ## # Reads client configuration from a file # @@ -77,7 +76,7 @@ module Google end ## - # Intialize OAuth client settings. + # Initialize OAuth client settings. # # @param [Hash] options # Parsed client secrets files diff --git a/spec/fixtures/files/child/.gitignore b/spec/fixtures/files/child/.gitignore new file mode 100644 index 000000000..e69de29bb diff --git a/spec/fixtures/files/invalid.json b/spec/fixtures/files/invalid.json new file mode 100644 index 000000000..abe07b443 --- /dev/null +++ b/spec/fixtures/files/invalid.json @@ -0,0 +1 @@ +{"invalid"} diff --git a/spec/google/api_client/client_secrets_spec.rb b/spec/google/api_client/client_secrets_spec.rb index ead9bf7e9..822a1ff9f 100644 --- a/spec/google/api_client/client_secrets_spec.rb +++ b/spec/google/api_client/client_secrets_spec.rb @@ -50,4 +50,26 @@ RSpec.describe Google::APIClient::ClientSecrets do end end -end \ No newline at end of file + + context 'with no existing JSON file' do + it 'should raise exception' do + file = File.join(FIXTURES_PATH, 'files', 'no_file.json') + expect { Google::APIClient::ClientSecrets.load(file) }.to raise_exception(Errno::ENOENT) + end + end + + context 'with invalid JSON file' do + it 'should raise exception' do + file = File.join(FIXTURES_PATH, 'files', 'invalid.json') + expect { Google::APIClient::ClientSecrets.load(file) }.to raise_exception(MultiJson::ParseError) + end + end + + context 'with folder name, which have json file in parents' do + it 'should load the correct client id' do + folder = File.join(FIXTURES_PATH, 'files', 'child') + secrets = Google::APIClient::ClientSecrets.load(folder) + expect(secrets.client_id).to be == '898243283568.apps.googleusercontent.com' + end + end +end