Sha256: 2396e6155cf147d12f971ffcb6254ba93b8032d2713449df83b7102c1c69a699

Contents?: true

Size: 1.02 KB

Versions: 11

Compression:

Stored size: 1.02 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe Github::API, '#request' do
  let(:token) { "2fdsfdo23fsdf3omkhen34n2jh" }
  let(:per_page) { 100 }
  let(:path)  { "/api/v3/repos/GitHub/issues-dev/issues" }

  let(:url_prefix) { "https://my-company/api/v3/repos/GitHub/issues-dev/issues?access_token=#{token}&page=2&per_page=#{per_page}" }

  let(:conn) { Faraday::Connection.new }

  before {
    conn.url_prefix = url_prefix
    stub_get(path, 'https://my-company').
      with(:query => {'access_token' => token, :page => 2, :per_page => per_page}).
      to_return(:body => "", :status => 200, :headers =>{})
  }

  subject { described_class.new() }

  it 'sets connection path correctly' do
    expect(conn.path_prefix).to eql(path)
  end

  it 'responds to get request' do
    expect(subject).to respond_to(:get_request)
  end

  it 'handles enterprise uri correctly' do
    subject.stub(:connection).and_return conn

    expect {
      subject.get_request(path)
    }.not_to raise_error(WebMock::NetConnectNotAllowedError)
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
github_api-0.10.2 spec/github/request/request_spec.rb
github_api-0.10.1 spec/github/request/request_spec.rb
github_api-0.10.0 spec/github/request/request_spec.rb
github_api-0.9.7 spec/github/request/request_spec.rb
github_api-0.9.6 spec/github/request/request_spec.rb
github_api-0.9.5 spec/github/request/request_spec.rb
github_api-0.9.4 spec/github/request/request_spec.rb
github_api-0.9.3 spec/github/request/request_spec.rb
github_api-0.9.2 spec/github/request/request_spec.rb
github_api-0.9.1 spec/github/request/request_spec.rb
github_api-0.9.0 spec/github/request/request_spec.rb