Skip to content

Commit

Permalink
add more detail specs for client_secrets.rb + fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruslan Korolev committed Aug 19, 2015
1 parent 8daeb2c commit 19ead52
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 1 addition & 2 deletions lib/google/api_client/client_secrets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class APIClient
# }
# }
class ClientSecrets

##
# Reads client configuration from a file
#
Expand Down Expand Up @@ -77,7 +76,7 @@ def self.load(filename=nil)
end

##
# Intialize OAuth client settings.
# Initialize OAuth client settings.
#
# @param [Hash] options
# Parsed client secrets files
Expand Down
Empty file.
1 change: 1 addition & 0 deletions spec/fixtures/files/invalid.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"invalid"}
24 changes: 23 additions & 1 deletion spec/google/api_client/client_secrets_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,26 @@

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

0 comments on commit 19ead52

Please sign in to comment.