add tests for constants in storage_spec (#276)
This commit is contained in:
parent
dadb8e4275
commit
b1942bdc3e
|
@ -3,16 +3,23 @@ require 'spec_helper'
|
||||||
require 'google/api_client/auth/storage'
|
require 'google/api_client/auth/storage'
|
||||||
|
|
||||||
describe Google::APIClient::Storage do
|
describe Google::APIClient::Storage do
|
||||||
let(:root_path) { File.expand_path(File.join(__FILE__, '..', '..', '..')) }
|
let(:root_path) { ROOT_DIR }
|
||||||
let(:json_file) { File.expand_path(File.join(root_path, 'fixtures', 'files', 'auth_stored_credentials.json')) }
|
let(:json_file) { File.expand_path(File.join(FIXTURES_DIR, 'files', 'auth_stored_credentials.json')) }
|
||||||
|
|
||||||
let(:store) { double }
|
let(:store) { double }
|
||||||
let(:client_stub) { double }
|
let(:client_stub) { double }
|
||||||
subject { Google::APIClient::Storage.new(store) }
|
subject { Google::APIClient::Storage.new(store) }
|
||||||
|
|
||||||
|
describe 'constants' do
|
||||||
|
it "should have valid authorization and token_credential_uri" do
|
||||||
|
expect(Google::APIClient::Storage::AUTHORIZATION_URI).to eq "https://accounts.google.com/o/oauth2/auth"
|
||||||
|
expect(Google::APIClient::Storage::TOKEN_CREDENTIAL_URI).to eq "https://accounts.google.com/o/oauth2/token"
|
||||||
|
end
|
||||||
|
end
|
||||||
describe 'authorize' do
|
describe 'authorize' do
|
||||||
it 'should authorize' do
|
it 'should authorize' do
|
||||||
expect(subject).to respond_to(:authorization)
|
expect(subject).to respond_to(:authorization)
|
||||||
|
expect(subject.authorization).to be_nil
|
||||||
expect(subject.store).to be == store
|
expect(subject.store).to be == store
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -69,6 +76,7 @@ describe Google::APIClient::Storage do
|
||||||
subject.write_credentials()
|
subject.write_credentials()
|
||||||
}.not_to raise_error
|
}.not_to raise_error
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should not call store to write credentials' do
|
it 'should not call store to write credentials' do
|
||||||
expect(subject).not_to receive(:credentials_hash)
|
expect(subject).not_to receive(:credentials_hash)
|
||||||
expect(subject.store).not_to receive(:write_credentials)
|
expect(subject.store).not_to receive(:write_credentials)
|
||||||
|
@ -76,7 +84,7 @@ describe Google::APIClient::Storage do
|
||||||
subject.write_credentials('something')
|
subject.write_credentials('something')
|
||||||
}.not_to raise_error
|
}.not_to raise_error
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'refresh_authorization' do
|
describe 'refresh_authorization' do
|
||||||
|
|
Loading…
Reference in New Issue