Sha256: a5cc27f8b21e2029ccbcaf7305e8a23fe5d80e120292a9b4d10b429f5ae1fc63

Contents?: true

Size: 894 Bytes

Versions: 4

Compression:

Stored size: 894 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Github::Client::Scopes, '#list' do
  let(:request_path) { "/user" }
  let(:body) { '[]' }
  let(:status) { 200 }
  let(:accepted_scopes) { "delete_repo, repo, public_repo, repo:status" }
  let(:scopes) { 'repo' }

  before {
    subject.oauth_token = OAUTH_TOKEN
    stub_get(request_path).
      with(:query => { :access_token => "#{OAUTH_TOKEN}"}).
      to_return(:body => body, :status => status,
        :headers => {:content_type => "application/json; charset=utf-8",
'x-accepted-oauth-scopes' => accepted_scopes, 'x-oauth-scopes' => 'repo'
      })
  }

  after { reset_authentication_for(subject) }

  it 'performs request' do
    subject.list
    a_get(request_path).with(:query => {:access_token => OAUTH_TOKEN}).
      should have_been_made
  end

  it 'queries oauth header' do
    subject.list.should == [scopes]
  end
end # list

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
github_api-0.12.3 spec/github/client/scopes/list_spec.rb
github_api-0.12.2 spec/github/client/scopes/list_spec.rb
github_api-0.12.1 spec/github/client/scopes/list_spec.rb
github_api-0.12.0 spec/github/client/scopes/list_spec.rb