Skip to content

Commit

Permalink
Merge 4b27063 into 76cd473
Browse files Browse the repository at this point in the history
  • Loading branch information
5long committed Mar 31, 2013
2 parents 76cd473 + 4b27063 commit ee61944
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
1 change: 0 additions & 1 deletion lib/github_api/api.rb
Expand Up @@ -41,7 +41,6 @@ class API
#
def initialize(options={}, &block)
setup(options)
client(options) if client_id? && client_secret?
yield_or_eval(&block) if block_given?
end

Expand Down
4 changes: 2 additions & 2 deletions lib/github_api/authorization.rb
Expand Up @@ -6,10 +6,10 @@ module Authorization
attr_accessor :scopes

# Setup OAuth2 instance
def client(options={})
def client
@client ||= ::OAuth2::Client.new(client_id, client_secret,
{
:site => options.fetch(:site) { Github.site },
:site => current_options.fetch(:site) { Github.site },
:authorize_url => 'login/oauth/authorize',
:token_url => 'login/oauth/access_token',
:ssl => { :verify => false }
Expand Down
9 changes: 5 additions & 4 deletions spec/github/authorization_spec.rb
Expand Up @@ -6,7 +6,8 @@
let(:client_id) { '234jl23j4l23j4l' }
let(:client_secret) { 'asasd79sdf9a7asfd7sfd97s' }
let(:code) { 'c9798sdf97df98ds'}
let(:options) { {} }
let(:site) { 'http://github-ent.example.com/' }
let(:options) { {:site => site} }

subject(:github) { Github.new options }

Expand All @@ -22,15 +23,15 @@
end

it "should assign site from the options hash" do
github.client.site.should == 'https://github.com'
github.client.site.should == site
end

it "should assign 'authorize_url" do
github.client.authorize_url.should == 'https://github.com/login/oauth/authorize'
github.client.authorize_url.should == "#{site}login/oauth/authorize"
end

it "should assign 'token_url" do
github.client.token_url.should == 'https://github.com/login/oauth/access_token'
github.client.token_url.should == "#{site}login/oauth/access_token"
end
end

Expand Down

0 comments on commit ee61944

Please sign in to comment.