Sha256: 1b72a0f74a629e9cbc9ee8a902e771089202ac0ddcdba8245ff6362f431c5e66

Contents?: true

Size: 949 Bytes

Versions: 4

Compression:

Stored size: 949 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Github::Search::Legacy, '#users' do
  let(:keyword)      { 'api' }
  let(:request_path) { "/legacy/user/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/users_legacy.json') }
    let(:status) { 200 }

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

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

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

    it "should get repository information" do
      users = subject.users keyword: keyword
      users.users.first.username.should == 'techno'
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
github_api-0.11.3 spec/github/search/legacy/users_spec.rb
github_api-0.11.2 spec/github/search/legacy/users_spec.rb
github_api-0.11.1 spec/github/search/legacy/users_spec.rb
github_api-0.11.0 spec/github/search/legacy/users_spec.rb