Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion google-apis-core/lib/google/api_client/client_secrets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def initialize(options={})
# @return [String]
# JSON
def to_json
return Json.dump(to_hash)
return JSON.dump(to_hash)
end

def to_hash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@
FIXTURES_PATH = File.expand_path('../../../fixtures', __FILE__)

RSpec.describe Google::APIClient::ClientSecrets do
describe '#to_json' do
let(:secrets) { described_class.new('installed' => { 'client_id' => 'example-client' }) }

it 'serializes the client secrets hash' do
expect(JSON.parse(secrets.to_json)).to eq(secrets.to_hash)
end
end

describe '::new' do
let(:filename) { File.join(FIXTURES_PATH, 'files', 'client_secrets.json') }
let(:data) { File.open(filename, 'r') { |file| JSON.load(file.read) } }
Expand Down
Loading