Sha256: de5413ff323ae5bcb9b43ff88de5b41064a316ec3fa53e7bf6c4b427c66a9747

Contents?: true

Size: 972 Bytes

Versions: 4

Compression:

Stored size: 972 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Github::Client::Search::Legacy, '#repos' do
  let(:keyword)      { 'api' }
  let(:request_path) { "/legacy/repos/search/#{keyword}" }

  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/repos_legacy.json') }
    let(:status) { 200 }

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

    it "should get the resources" do
      subject.repos keyword
      a_get(request_path).should have_been_made
    end

    it "should get the resource through params hash" do
      subject.repos keyword: keyword
      a_get(request_path).should have_been_made
    end

    it "should get repository information" do
      repos = subject.repos keyword: keyword
      repos.repositories.first.username.should == 'mathiasbynens'
    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/repos_spec.rb
github_api-0.12.2 spec/github/client/search/legacy/repos_spec.rb
github_api-0.12.1 spec/github/client/search/legacy/repos_spec.rb
github_api-0.12.0 spec/github/client/search/legacy/repos_spec.rb