Merge pull request #273 from rusikf/patch-5
add more detail specs for client_secrets.rb + fix docs
This commit is contained in:
commit
669aaf01a4
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
{"invalid"}
|
|
@ -50,4 +50,26 @@ RSpec.describe Google::APIClient::ClientSecrets do
|
|||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue