mirror of
https://github.com/wahyd4/ocelots.git
synced 2026-08-17 08:56:14 +10:00
23 lines
899 B
Ruby
23 lines
899 B
Ruby
require 'spec_helper'
|
|
|
|
describe Google::APIClient do
|
|
describe :build do
|
|
let(:authorization) { stub 'authorization' }
|
|
let(:client) { stub 'client', authorization: authorization }
|
|
before { Google::APIClient.should_receive(:new).and_return client }
|
|
|
|
it "builds google api client using environment variables" do
|
|
[
|
|
['client_id', 'GOOGLE_OAUTH_CLIENT_ID', 'client_id'],
|
|
['client_secret', 'GOOGLE_OAUTH_CLIENT_SECRET', 'client_secret'],
|
|
['redirect_uri', 'GOOGLE_OAUTH_REDIRECT', 'http://domain/redirect']
|
|
].each do |values|
|
|
m, variable, value = *values
|
|
ENV.should_receive(:[]).with(variable).and_return value
|
|
authorization.should_receive("#{m}=").with value
|
|
end
|
|
authorization.should_receive("scope=").with 'https://www.googleapis.com/auth/userinfo.email'
|
|
Google::APIClient.build
|
|
end
|
|
end
|
|
end |