Sha256: b530b08e4b46c699e01acbbc21fdeea3ec60c6f0ac208bf1b6ecf7b4bb804283

Contents?: true

Size: 1.12 KB

Versions: 17

Compression:

Stored size: 1.12 KB

Contents

require File.dirname(__FILE__) + '/spec_helper'

describe "Warden::Github::Oauth::Proxy" do
  before(:all) do
    sha = Digest::SHA1.hexdigest(Time.now.to_s)
    @proxy =  Warden::Github::Oauth::Proxy.new(sha[0..19], sha[0..39],
                                               'user,public_repo,repo,gist',
                                               'http://example.org',
                                               'http://example.org/auth/github/callback')
  end

  it "returns an authorize url" do
    uri = Addressable::URI.parse(@proxy.authorize_url)

    uri.scheme.should eql('http')
    uri.host.should eql('example.org')

    params = uri.query_values
    params['response_type'].should eql('code')
    params['scope'].should eql('user,public_repo,repo,gist')
    params['client_id'].should match(/\w{20}/)
    params['redirect_uri'].should eql('http://example.org/auth/github/callback')
  end

  it "has a client object" do
    @proxy.client.should_not be_nil
  end

  it "returns access tokens" do
    pending "this hits the network" do
      lambda { @proxy.access_token_for(/\w{20}/.gen) }.should_not raise_error
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
warden-github-0.12.1 spec/proxy_spec.rb
warden-github-0.12.0 spec/proxy_spec.rb
warden-github-0.11.0 spec/proxy_spec.rb
warden-github-0.10.2 spec/proxy_spec.rb
warden-github-0.10.1 spec/proxy_spec.rb
warden-github-0.10.0 spec/proxy_spec.rb
warden-github-0.9.1 spec/proxy_spec.rb
warden-github-0.9.0 spec/proxy_spec.rb
warden-github-0.8.2 spec/proxy_spec.rb
warden-github-0.8.1 spec/proxy_spec.rb
warden-github-0.8.0 spec/proxy_spec.rb
warden-github-0.7.0 spec/proxy_spec.rb
warden-github-0.6.1 spec/proxy_spec.rb
warden-github-0.6.0 spec/proxy_spec.rb
warden-github-0.5.1 spec/proxy_spec.rb
warden-github-0.5.0 spec/proxy_spec.rb
warden-github-0.4.4 spec/proxy_spec.rb