Sha256: b3cb41dfb1100211d418408750baa966e078f7bb52ee73d4bda4ebead92cf23d

Contents?: true

Size: 1.17 KB

Versions: 4

Compression:

Stored size: 1.17 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe Github::Client::Search::Legacy, '#issues' do
  let(:keyword)      { 'api' }
  let(:request_path) {"/legacy/issues/search/#{owner}/#{repo}/#{state}/#{keyword}"}
  let(:owner)        { 'peter-murach' }
  let(:repo)         { 'github' }
  let(:state)        { 'closed' }

  before do
    stub_get(request_path).
      to_return(body: body, status: status,
        headers: {content_type: "application/json; charset=utf-8"})
  end

  context "resource found" do
    let(:body)   { fixture('search/issues_legacy.json') }
    let(:status) { 200 }

    it { expect { subject.issues }.to raise_error(ArgumentError) }

    it "should get the resources" do
      subject.issues owner, repo, state, keyword
      a_get(request_path).should have_been_made
    end

    it "should get the resource through params hash" do
      subject.issues owner: owner, repo: repo, state: state, keyword: keyword
      a_get(request_path).should have_been_made
    end

    it "should get repository information" do
      issues = subject.issues owner: owner, repo: repo, state: state, keyword: keyword
      issues.issues.first.user.should == 'ckarbass'
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
github_api-0.12.3 spec/github/client/search/legacy/issues_spec.rb
github_api-0.12.2 spec/github/client/search/legacy/issues_spec.rb
github_api-0.12.1 spec/github/client/search/legacy/issues_spec.rb
github_api-0.12.0 spec/github/client/search/legacy/issues_spec.rb