Sha256: 0b0ab8852d554889b443241d717e47e63eb1960cc8c75f882f193cbf45b9efce

Contents?: true

Size: 1 KB

Versions: 4

Compression:

Stored size: 1 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],
                                               'email,offline_access,repo', 'http://example.org/auth/github/callback')
  end

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

    uri.scheme.should eql('https')
    uri.host.should eql('github.com')

    params = uri.query_values
    params['type'].should eql('web_server')
    params['scope'].should eql('email,offline_access,repo')
    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

4 entries across 4 versions & 1 rubygems

Version Path
warden-github-0.1.1 spec/proxy_spec.rb
warden-github-0.1.0 spec/proxy_spec.rb
warden-github-0.0.9 spec/proxy_spec.rb
warden-github-0.0.8 spec/proxy_spec.rb