Sha256: 252c64ea40f36ce8f043eadecb0b64f39395862fa9764dfb0cfae8dbcc3d38f7

Contents?: true

Size: 1.38 KB

Versions: 2

Compression:

Stored size: 1.38 KB

Contents

require 'helper'

describe Octokit::Client::LegacySearch do

  before do
    Octokit.reset!
    @client = oauth_client
  end

  describe ".legacy_search_issues", :vcr do
    it "returns matching issues" do
      issues = @client.search_issues("sferik/rails_admin", "activerecord")
      expect(issues).to_not be_empty
      assert_requested :get, github_url("/legacy/issues/search/sferik/rails_admin/open/activerecord")
    end
  end # .search_issues

  describe ".legacy_search_repos", :vcr do
    it "returns matching repositories" do
      repositories = @client.search_repositories("One40Proof")
      expect(repositories).to_not be_empty
      assert_requested :get, github_url("/legacy/repos/search/One40Proof")
    end
  end # .legacy_search_repos

  describe ".legacy_search_users", :vcr do
    it "returns matching username" do
      users = @client.search_users("sferik")
      expect(users.first.username).to eq("sferik")
      assert_requested :get, github_url("/legacy/user/search/sferik")
    end
    it "should not raise URI::InvalidURIError and returns success" do
      VCR.eject_cassette
      VCR.turn_off!
      stub_get("https://api.github.com/legacy/user/search/follower:>0")
      expect { @client.search_users("follower:>0") }.to_not raise_error
      assert_requested :get, github_url("/legacy/user/search/follower:%3E0")
      VCR.turn_on!
    end
  end # .legacy_searcy_users

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
octokit-2.0.0.rc1 spec/octokit/client/legacy_search_spec.rb
octokit-2.0.0.pre spec/octokit/client/legacy_search_spec.rb