Sha256: a5e9835de4bcdb77e65ae9c5b101f5a435366cac339badfd92a5d7805d483243

Contents?: true

Size: 1.88 KB

Versions: 9

Compression:

Stored size: 1.88 KB

Contents

require 'helper'

describe Octokit::Client::Search do

  before do
    Octokit.reset!
    @client = oauth_client
  end

  describe ".search_code" do
    it "searches code", :vcr do
      results = @client.search_code 'code in:file extension:gemspec -repo:octokit/octokit.rb', \
        :sort  => 'indexed',
        :order => 'asc'

      assert_requested :get, github_url('/search/code?q=code%20in:file%20extension:gemspec%20-repo:octokit/octokit.rb&sort=indexed&order=asc')
      expect(results.total_count).to be_kind_of Fixnum
      expect(results.items).to be_kind_of Array
    end
  end # .search_code

  describe ".search_issues" do
    it "searches issues", :vcr do
      results = @client.search_issues 'http author:jasonrudolph', \
        :sort  => 'created',
        :order => 'desc'

      assert_requested :get, github_url('/search/issues?q=http%20author:jasonrudolph&sort=created&order=desc')
      expect(results.total_count).to be_kind_of Fixnum
      expect(results.items).to be_kind_of Array
    end
  end # .search_issues

  describe ".search_repositories" do
    it "searches repositories", :vcr do
      results = @client.search_repositories 'tetris language:assembly', \
        :sort  => 'stars',
        :order => 'desc'

      assert_requested :get, github_url('/search/repositories?q=tetris%20language:assembly&sort=stars&order=desc')
      expect(results.total_count).to be_kind_of Fixnum
      expect(results.items).to be_kind_of Array
    end
  end # .search_repositories

  describe ".search_users" do
    it "searches users", :vcr do
      results = @client.search_users 'mike followers:>10', \
        :sort  => 'joined',
        :order => 'desc'

      assert_requested :get, github_url('/search/users?q=mike%20followers:%3E10&sort=joined&order=desc')
      expect(results.total_count).to be_kind_of Fixnum
      expect(results.items).to be_kind_of Array
    end
  end # .search_users

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
octokit-2.3.0 spec/octokit/client/search_spec.rb
octokit-2.2.0 spec/octokit/client/search_spec.rb
octokit-2.1.2 spec/octokit/client/search_spec.rb
octokit-2.1.1 spec/octokit/client/search_spec.rb
octokit-2.1.0 spec/octokit/client/search_spec.rb
octokit-2.0.0 spec/octokit/client/search_spec.rb
octokit-2.0.0.rc4 spec/octokit/client/search_spec.rb
octokit-2.0.0.rc3 spec/octokit/client/search_spec.rb
octokit-2.0.0.rc2 spec/octokit/client/search_spec.rb