github-search 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +250 -0
- data/Rakefile +10 -0
- data/github-search.gemspec +29 -0
- data/lib/github-search.rb +12 -0
- data/lib/github-search/issue.rb +55 -0
- data/lib/github-search/repository.rb +151 -0
- data/lib/github-search/search_string_builder.rb +63 -0
- data/lib/github-search/searcher.rb +35 -0
- data/lib/github-search/user.rb +51 -0
- data/lib/github-search/version.rb +3 -0
- data/test/fixtures/search_issues.yml +73 -0
- data/test/fixtures/search_issues_order_ascending.yml +73 -0
- data/test/fixtures/search_issues_order_descending.yml +73 -0
- data/test/fixtures/search_issues_sort_by_comments.yml +73 -0
- data/test/fixtures/search_issues_sort_by_created_at.yml +73 -0
- data/test/fixtures/search_issues_sort_by_updated_at.yml +73 -0
- data/test/fixtures/search_repositories.yml +69 -0
- data/test/fixtures/search_repositories_order_ascending.yml +74 -0
- data/test/fixtures/search_repositories_order_descending.yml +74 -0
- data/test/fixtures/search_repositories_sort_by_forks.yml +74 -0
- data/test/fixtures/search_repositories_sort_by_stars.yml +74 -0
- data/test/fixtures/search_repositories_sort_by_updated_at.yml +74 -0
- data/test/fixtures/search_users.yml +69 -0
- data/test/issues/issue_test.rb +132 -0
- data/test/repositories/repository_test.rb +181 -0
- data/test/test_helper.rb +9 -0
- data/test/users/user_test.rb +41 -0
- metadata +192 -0
@@ -0,0 +1,74 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.github.com/search/repositories?q=client%20user:jwaterfaucett&sort=updated
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.9.1
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
+
Accept:
|
15
|
+
- "*/*"
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Server:
|
22
|
+
- GitHub.com
|
23
|
+
Date:
|
24
|
+
- Thu, 26 Mar 2015 00:07:36 GMT
|
25
|
+
Content-Type:
|
26
|
+
- application/json; charset=utf-8
|
27
|
+
Transfer-Encoding:
|
28
|
+
- chunked
|
29
|
+
Status:
|
30
|
+
- 200 OK
|
31
|
+
X-Ratelimit-Limit:
|
32
|
+
- '10'
|
33
|
+
X-Ratelimit-Remaining:
|
34
|
+
- '8'
|
35
|
+
X-Ratelimit-Reset:
|
36
|
+
- '1427328515'
|
37
|
+
Cache-Control:
|
38
|
+
- no-cache
|
39
|
+
X-Github-Media-Type:
|
40
|
+
- github.v3
|
41
|
+
X-Xss-Protection:
|
42
|
+
- 1; mode=block
|
43
|
+
X-Frame-Options:
|
44
|
+
- deny
|
45
|
+
Content-Security-Policy:
|
46
|
+
- default-src 'none'
|
47
|
+
Access-Control-Allow-Credentials:
|
48
|
+
- 'true'
|
49
|
+
Access-Control-Expose-Headers:
|
50
|
+
- ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset,
|
51
|
+
X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
|
52
|
+
Access-Control-Allow-Origin:
|
53
|
+
- "*"
|
54
|
+
X-Github-Request-Id:
|
55
|
+
- 72A7B8B8:3DAA:448E58:55134DC8
|
56
|
+
Strict-Transport-Security:
|
57
|
+
- max-age=31536000; includeSubdomains; preload
|
58
|
+
X-Content-Type-Options:
|
59
|
+
- nosniff
|
60
|
+
Vary:
|
61
|
+
- Accept-Encoding
|
62
|
+
X-Served-By:
|
63
|
+
- 8dd185e423974a7e13abbbe6e060031e
|
64
|
+
body:
|
65
|
+
encoding: UTF-8
|
66
|
+
string: '{"total_count":5,"incomplete_results":false,"items":[{"id":29160694,"name":"jira_box","full_name":"jwaterfaucett/jira_box","owner":{"login":"jwaterfaucett","id":916309,"avatar_url":"https://avatars.githubusercontent.com/u/916309?v=3","gravatar_id":"","url":"https://api.github.com/users/jwaterfaucett","html_url":"https://github.com/jwaterfaucett","followers_url":"https://api.github.com/users/jwaterfaucett/followers","following_url":"https://api.github.com/users/jwaterfaucett/following{/other_user}","gists_url":"https://api.github.com/users/jwaterfaucett/gists{/gist_id}","starred_url":"https://api.github.com/users/jwaterfaucett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwaterfaucett/subscriptions","organizations_url":"https://api.github.com/users/jwaterfaucett/orgs","repos_url":"https://api.github.com/users/jwaterfaucett/repos","events_url":"https://api.github.com/users/jwaterfaucett/events{/privacy}","received_events_url":"https://api.github.com/users/jwaterfaucett/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jwaterfaucett/jira_box","description":"Jira
|
67
|
+
ruby rest client and oauth helpers","fork":false,"url":"https://api.github.com/repos/jwaterfaucett/jira_box","forks_url":"https://api.github.com/repos/jwaterfaucett/jira_box/forks","keys_url":"https://api.github.com/repos/jwaterfaucett/jira_box/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jwaterfaucett/jira_box/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jwaterfaucett/jira_box/teams","hooks_url":"https://api.github.com/repos/jwaterfaucett/jira_box/hooks","issue_events_url":"https://api.github.com/repos/jwaterfaucett/jira_box/issues/events{/number}","events_url":"https://api.github.com/repos/jwaterfaucett/jira_box/events","assignees_url":"https://api.github.com/repos/jwaterfaucett/jira_box/assignees{/user}","branches_url":"https://api.github.com/repos/jwaterfaucett/jira_box/branches{/branch}","tags_url":"https://api.github.com/repos/jwaterfaucett/jira_box/tags","blobs_url":"https://api.github.com/repos/jwaterfaucett/jira_box/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jwaterfaucett/jira_box/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jwaterfaucett/jira_box/git/refs{/sha}","trees_url":"https://api.github.com/repos/jwaterfaucett/jira_box/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jwaterfaucett/jira_box/statuses/{sha}","languages_url":"https://api.github.com/repos/jwaterfaucett/jira_box/languages","stargazers_url":"https://api.github.com/repos/jwaterfaucett/jira_box/stargazers","contributors_url":"https://api.github.com/repos/jwaterfaucett/jira_box/contributors","subscribers_url":"https://api.github.com/repos/jwaterfaucett/jira_box/subscribers","subscription_url":"https://api.github.com/repos/jwaterfaucett/jira_box/subscription","commits_url":"https://api.github.com/repos/jwaterfaucett/jira_box/commits{/sha}","git_commits_url":"https://api.github.com/repos/jwaterfaucett/jira_box/git/commits{/sha}","comments_url":"https://api.github.com/repos/jwaterfaucett/jira_box/comments{/number}","issue_comment_url":"https://api.github.com/repos/jwaterfaucett/jira_box/issues/comments{/number}","contents_url":"https://api.github.com/repos/jwaterfaucett/jira_box/contents/{+path}","compare_url":"https://api.github.com/repos/jwaterfaucett/jira_box/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jwaterfaucett/jira_box/merges","archive_url":"https://api.github.com/repos/jwaterfaucett/jira_box/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jwaterfaucett/jira_box/downloads","issues_url":"https://api.github.com/repos/jwaterfaucett/jira_box/issues{/number}","pulls_url":"https://api.github.com/repos/jwaterfaucett/jira_box/pulls{/number}","milestones_url":"https://api.github.com/repos/jwaterfaucett/jira_box/milestones{/number}","notifications_url":"https://api.github.com/repos/jwaterfaucett/jira_box/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jwaterfaucett/jira_box/labels{/name}","releases_url":"https://api.github.com/repos/jwaterfaucett/jira_box/releases{/id}","created_at":"2015-01-12T22:38:34Z","updated_at":"2015-01-26T15:38:58Z","pushed_at":"2015-01-26T15:38:58Z","git_url":"git://github.com/jwaterfaucett/jira_box.git","ssh_url":"git@github.com:jwaterfaucett/jira_box.git","clone_url":"https://github.com/jwaterfaucett/jira_box.git","svn_url":"https://github.com/jwaterfaucett/jira_box","homepage":null,"size":288,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master","score":0.8322847},{"id":19483583,"name":"bugherd_client","full_name":"jwaterfaucett/bugherd_client","owner":{"login":"jwaterfaucett","id":916309,"avatar_url":"https://avatars.githubusercontent.com/u/916309?v=3","gravatar_id":"","url":"https://api.github.com/users/jwaterfaucett","html_url":"https://github.com/jwaterfaucett","followers_url":"https://api.github.com/users/jwaterfaucett/followers","following_url":"https://api.github.com/users/jwaterfaucett/following{/other_user}","gists_url":"https://api.github.com/users/jwaterfaucett/gists{/gist_id}","starred_url":"https://api.github.com/users/jwaterfaucett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwaterfaucett/subscriptions","organizations_url":"https://api.github.com/users/jwaterfaucett/orgs","repos_url":"https://api.github.com/users/jwaterfaucett/repos","events_url":"https://api.github.com/users/jwaterfaucett/events{/privacy}","received_events_url":"https://api.github.com/users/jwaterfaucett/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jwaterfaucett/bugherd_client","description":"Ruby
|
68
|
+
Client for the BugHerd REST API","fork":false,"url":"https://api.github.com/repos/jwaterfaucett/bugherd_client","forks_url":"https://api.github.com/repos/jwaterfaucett/bugherd_client/forks","keys_url":"https://api.github.com/repos/jwaterfaucett/bugherd_client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jwaterfaucett/bugherd_client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jwaterfaucett/bugherd_client/teams","hooks_url":"https://api.github.com/repos/jwaterfaucett/bugherd_client/hooks","issue_events_url":"https://api.github.com/repos/jwaterfaucett/bugherd_client/issues/events{/number}","events_url":"https://api.github.com/repos/jwaterfaucett/bugherd_client/events","assignees_url":"https://api.github.com/repos/jwaterfaucett/bugherd_client/assignees{/user}","branches_url":"https://api.github.com/repos/jwaterfaucett/bugherd_client/branches{/branch}","tags_url":"https://api.github.com/repos/jwaterfaucett/bugherd_client/tags","blobs_url":"https://api.github.com/repos/jwaterfaucett/bugherd_client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jwaterfaucett/bugherd_client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jwaterfaucett/bugherd_client/git/refs{/sha}","trees_url":"https://api.github.com/repos/jwaterfaucett/bugherd_client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jwaterfaucett/bugherd_client/statuses/{sha}","languages_url":"https://api.github.com/repos/jwaterfaucett/bugherd_client/languages","stargazers_url":"https://api.github.com/repos/jwaterfaucett/bugherd_client/stargazers","contributors_url":"https://api.github.com/repos/jwaterfaucett/bugherd_client/contributors","subscribers_url":"https://api.github.com/repos/jwaterfaucett/bugherd_client/subscribers","subscription_url":"https://api.github.com/repos/jwaterfaucett/bugherd_client/subscription","commits_url":"https://api.github.com/repos/jwaterfaucett/bugherd_client/commits{/sha}","git_commits_url":"https://api.github.com/repos/jwaterfaucett/bugherd_client/git/commits{/sha}","comments_url":"https://api.github.com/repos/jwaterfaucett/bugherd_client/comments{/number}","issue_comment_url":"https://api.github.com/repos/jwaterfaucett/bugherd_client/issues/comments{/number}","contents_url":"https://api.github.com/repos/jwaterfaucett/bugherd_client/contents/{+path}","compare_url":"https://api.github.com/repos/jwaterfaucett/bugherd_client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jwaterfaucett/bugherd_client/merges","archive_url":"https://api.github.com/repos/jwaterfaucett/bugherd_client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jwaterfaucett/bugherd_client/downloads","issues_url":"https://api.github.com/repos/jwaterfaucett/bugherd_client/issues{/number}","pulls_url":"https://api.github.com/repos/jwaterfaucett/bugherd_client/pulls{/number}","milestones_url":"https://api.github.com/repos/jwaterfaucett/bugherd_client/milestones{/number}","notifications_url":"https://api.github.com/repos/jwaterfaucett/bugherd_client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jwaterfaucett/bugherd_client/labels{/name}","releases_url":"https://api.github.com/repos/jwaterfaucett/bugherd_client/releases{/id}","created_at":"2014-05-06T06:31:26Z","updated_at":"2015-01-15T11:43:57Z","pushed_at":"2015-01-15T11:44:06Z","git_url":"git://github.com/jwaterfaucett/bugherd_client.git","ssh_url":"git@github.com:jwaterfaucett/bugherd_client.git","clone_url":"https://github.com/jwaterfaucett/bugherd_client.git","svn_url":"https://github.com/jwaterfaucett/bugherd_client","homepage":"","size":548,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":2,"default_branch":"master","score":2.803472},{"id":16184608,"name":"youtrack","full_name":"jwaterfaucett/youtrack","owner":{"login":"jwaterfaucett","id":916309,"avatar_url":"https://avatars.githubusercontent.com/u/916309?v=3","gravatar_id":"","url":"https://api.github.com/users/jwaterfaucett","html_url":"https://github.com/jwaterfaucett","followers_url":"https://api.github.com/users/jwaterfaucett/followers","following_url":"https://api.github.com/users/jwaterfaucett/following{/other_user}","gists_url":"https://api.github.com/users/jwaterfaucett/gists{/gist_id}","starred_url":"https://api.github.com/users/jwaterfaucett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwaterfaucett/subscriptions","organizations_url":"https://api.github.com/users/jwaterfaucett/orgs","repos_url":"https://api.github.com/users/jwaterfaucett/repos","events_url":"https://api.github.com/users/jwaterfaucett/events{/privacy}","received_events_url":"https://api.github.com/users/jwaterfaucett/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jwaterfaucett/youtrack","description":"youTrack
|
69
|
+
ruby Client","fork":false,"url":"https://api.github.com/repos/jwaterfaucett/youtrack","forks_url":"https://api.github.com/repos/jwaterfaucett/youtrack/forks","keys_url":"https://api.github.com/repos/jwaterfaucett/youtrack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jwaterfaucett/youtrack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jwaterfaucett/youtrack/teams","hooks_url":"https://api.github.com/repos/jwaterfaucett/youtrack/hooks","issue_events_url":"https://api.github.com/repos/jwaterfaucett/youtrack/issues/events{/number}","events_url":"https://api.github.com/repos/jwaterfaucett/youtrack/events","assignees_url":"https://api.github.com/repos/jwaterfaucett/youtrack/assignees{/user}","branches_url":"https://api.github.com/repos/jwaterfaucett/youtrack/branches{/branch}","tags_url":"https://api.github.com/repos/jwaterfaucett/youtrack/tags","blobs_url":"https://api.github.com/repos/jwaterfaucett/youtrack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jwaterfaucett/youtrack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jwaterfaucett/youtrack/git/refs{/sha}","trees_url":"https://api.github.com/repos/jwaterfaucett/youtrack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jwaterfaucett/youtrack/statuses/{sha}","languages_url":"https://api.github.com/repos/jwaterfaucett/youtrack/languages","stargazers_url":"https://api.github.com/repos/jwaterfaucett/youtrack/stargazers","contributors_url":"https://api.github.com/repos/jwaterfaucett/youtrack/contributors","subscribers_url":"https://api.github.com/repos/jwaterfaucett/youtrack/subscribers","subscription_url":"https://api.github.com/repos/jwaterfaucett/youtrack/subscription","commits_url":"https://api.github.com/repos/jwaterfaucett/youtrack/commits{/sha}","git_commits_url":"https://api.github.com/repos/jwaterfaucett/youtrack/git/commits{/sha}","comments_url":"https://api.github.com/repos/jwaterfaucett/youtrack/comments{/number}","issue_comment_url":"https://api.github.com/repos/jwaterfaucett/youtrack/issues/comments{/number}","contents_url":"https://api.github.com/repos/jwaterfaucett/youtrack/contents/{+path}","compare_url":"https://api.github.com/repos/jwaterfaucett/youtrack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jwaterfaucett/youtrack/merges","archive_url":"https://api.github.com/repos/jwaterfaucett/youtrack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jwaterfaucett/youtrack/downloads","issues_url":"https://api.github.com/repos/jwaterfaucett/youtrack/issues{/number}","pulls_url":"https://api.github.com/repos/jwaterfaucett/youtrack/pulls{/number}","milestones_url":"https://api.github.com/repos/jwaterfaucett/youtrack/milestones{/number}","notifications_url":"https://api.github.com/repos/jwaterfaucett/youtrack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jwaterfaucett/youtrack/labels{/name}","releases_url":"https://api.github.com/repos/jwaterfaucett/youtrack/releases{/id}","created_at":"2014-01-23T20:26:25Z","updated_at":"2014-07-14T14:11:04Z","pushed_at":"2014-07-14T14:11:34Z","git_url":"git://github.com/jwaterfaucett/youtrack.git","ssh_url":"git@github.com:jwaterfaucett/youtrack.git","clone_url":"https://github.com/jwaterfaucett/youtrack.git","svn_url":"https://github.com/jwaterfaucett/youtrack","homepage":null,"size":353,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":4,"mirror_url":null,"open_issues_count":2,"forks":4,"open_issues":2,"watchers":0,"default_branch":"master","score":2.2171772},{"id":20739905,"name":"horizonte","full_name":"jwaterfaucett/horizonte","owner":{"login":"jwaterfaucett","id":916309,"avatar_url":"https://avatars.githubusercontent.com/u/916309?v=3","gravatar_id":"","url":"https://api.github.com/users/jwaterfaucett","html_url":"https://github.com/jwaterfaucett","followers_url":"https://api.github.com/users/jwaterfaucett/followers","following_url":"https://api.github.com/users/jwaterfaucett/following{/other_user}","gists_url":"https://api.github.com/users/jwaterfaucett/gists{/gist_id}","starred_url":"https://api.github.com/users/jwaterfaucett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwaterfaucett/subscriptions","organizations_url":"https://api.github.com/users/jwaterfaucett/orgs","repos_url":"https://api.github.com/users/jwaterfaucett/repos","events_url":"https://api.github.com/users/jwaterfaucett/events{/privacy}","received_events_url":"https://api.github.com/users/jwaterfaucett/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jwaterfaucett/horizonte","description":"A
|
70
|
+
Daytime Server and Client","fork":false,"url":"https://api.github.com/repos/jwaterfaucett/horizonte","forks_url":"https://api.github.com/repos/jwaterfaucett/horizonte/forks","keys_url":"https://api.github.com/repos/jwaterfaucett/horizonte/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jwaterfaucett/horizonte/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jwaterfaucett/horizonte/teams","hooks_url":"https://api.github.com/repos/jwaterfaucett/horizonte/hooks","issue_events_url":"https://api.github.com/repos/jwaterfaucett/horizonte/issues/events{/number}","events_url":"https://api.github.com/repos/jwaterfaucett/horizonte/events","assignees_url":"https://api.github.com/repos/jwaterfaucett/horizonte/assignees{/user}","branches_url":"https://api.github.com/repos/jwaterfaucett/horizonte/branches{/branch}","tags_url":"https://api.github.com/repos/jwaterfaucett/horizonte/tags","blobs_url":"https://api.github.com/repos/jwaterfaucett/horizonte/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jwaterfaucett/horizonte/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jwaterfaucett/horizonte/git/refs{/sha}","trees_url":"https://api.github.com/repos/jwaterfaucett/horizonte/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jwaterfaucett/horizonte/statuses/{sha}","languages_url":"https://api.github.com/repos/jwaterfaucett/horizonte/languages","stargazers_url":"https://api.github.com/repos/jwaterfaucett/horizonte/stargazers","contributors_url":"https://api.github.com/repos/jwaterfaucett/horizonte/contributors","subscribers_url":"https://api.github.com/repos/jwaterfaucett/horizonte/subscribers","subscription_url":"https://api.github.com/repos/jwaterfaucett/horizonte/subscription","commits_url":"https://api.github.com/repos/jwaterfaucett/horizonte/commits{/sha}","git_commits_url":"https://api.github.com/repos/jwaterfaucett/horizonte/git/commits{/sha}","comments_url":"https://api.github.com/repos/jwaterfaucett/horizonte/comments{/number}","issue_comment_url":"https://api.github.com/repos/jwaterfaucett/horizonte/issues/comments{/number}","contents_url":"https://api.github.com/repos/jwaterfaucett/horizonte/contents/{+path}","compare_url":"https://api.github.com/repos/jwaterfaucett/horizonte/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jwaterfaucett/horizonte/merges","archive_url":"https://api.github.com/repos/jwaterfaucett/horizonte/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jwaterfaucett/horizonte/downloads","issues_url":"https://api.github.com/repos/jwaterfaucett/horizonte/issues{/number}","pulls_url":"https://api.github.com/repos/jwaterfaucett/horizonte/pulls{/number}","milestones_url":"https://api.github.com/repos/jwaterfaucett/horizonte/milestones{/number}","notifications_url":"https://api.github.com/repos/jwaterfaucett/horizonte/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jwaterfaucett/horizonte/labels{/name}","releases_url":"https://api.github.com/repos/jwaterfaucett/horizonte/releases{/id}","created_at":"2014-06-11T20:21:06Z","updated_at":"2014-06-16T20:43:54Z","pushed_at":"2014-06-16T20:43:55Z","git_url":"git://github.com/jwaterfaucett/horizonte.git","ssh_url":"git@github.com:jwaterfaucett/horizonte.git","clone_url":"https://github.com/jwaterfaucett/horizonte.git","svn_url":"https://github.com/jwaterfaucett/horizonte","homepage":null,"size":128,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master","score":0.9709988},{"id":13445307,"name":"rodzilla","full_name":"jwaterfaucett/rodzilla","owner":{"login":"jwaterfaucett","id":916309,"avatar_url":"https://avatars.githubusercontent.com/u/916309?v=3","gravatar_id":"","url":"https://api.github.com/users/jwaterfaucett","html_url":"https://github.com/jwaterfaucett","followers_url":"https://api.github.com/users/jwaterfaucett/followers","following_url":"https://api.github.com/users/jwaterfaucett/following{/other_user}","gists_url":"https://api.github.com/users/jwaterfaucett/gists{/gist_id}","starred_url":"https://api.github.com/users/jwaterfaucett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwaterfaucett/subscriptions","organizations_url":"https://api.github.com/users/jwaterfaucett/orgs","repos_url":"https://api.github.com/users/jwaterfaucett/repos","events_url":"https://api.github.com/users/jwaterfaucett/events{/privacy}","received_events_url":"https://api.github.com/users/jwaterfaucett/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jwaterfaucett/rodzilla","description":"A
|
71
|
+
Bugzilla Json-RPC API Client in Ruby","fork":false,"url":"https://api.github.com/repos/jwaterfaucett/rodzilla","forks_url":"https://api.github.com/repos/jwaterfaucett/rodzilla/forks","keys_url":"https://api.github.com/repos/jwaterfaucett/rodzilla/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jwaterfaucett/rodzilla/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jwaterfaucett/rodzilla/teams","hooks_url":"https://api.github.com/repos/jwaterfaucett/rodzilla/hooks","issue_events_url":"https://api.github.com/repos/jwaterfaucett/rodzilla/issues/events{/number}","events_url":"https://api.github.com/repos/jwaterfaucett/rodzilla/events","assignees_url":"https://api.github.com/repos/jwaterfaucett/rodzilla/assignees{/user}","branches_url":"https://api.github.com/repos/jwaterfaucett/rodzilla/branches{/branch}","tags_url":"https://api.github.com/repos/jwaterfaucett/rodzilla/tags","blobs_url":"https://api.github.com/repos/jwaterfaucett/rodzilla/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jwaterfaucett/rodzilla/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jwaterfaucett/rodzilla/git/refs{/sha}","trees_url":"https://api.github.com/repos/jwaterfaucett/rodzilla/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jwaterfaucett/rodzilla/statuses/{sha}","languages_url":"https://api.github.com/repos/jwaterfaucett/rodzilla/languages","stargazers_url":"https://api.github.com/repos/jwaterfaucett/rodzilla/stargazers","contributors_url":"https://api.github.com/repos/jwaterfaucett/rodzilla/contributors","subscribers_url":"https://api.github.com/repos/jwaterfaucett/rodzilla/subscribers","subscription_url":"https://api.github.com/repos/jwaterfaucett/rodzilla/subscription","commits_url":"https://api.github.com/repos/jwaterfaucett/rodzilla/commits{/sha}","git_commits_url":"https://api.github.com/repos/jwaterfaucett/rodzilla/git/commits{/sha}","comments_url":"https://api.github.com/repos/jwaterfaucett/rodzilla/comments{/number}","issue_comment_url":"https://api.github.com/repos/jwaterfaucett/rodzilla/issues/comments{/number}","contents_url":"https://api.github.com/repos/jwaterfaucett/rodzilla/contents/{+path}","compare_url":"https://api.github.com/repos/jwaterfaucett/rodzilla/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jwaterfaucett/rodzilla/merges","archive_url":"https://api.github.com/repos/jwaterfaucett/rodzilla/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jwaterfaucett/rodzilla/downloads","issues_url":"https://api.github.com/repos/jwaterfaucett/rodzilla/issues{/number}","pulls_url":"https://api.github.com/repos/jwaterfaucett/rodzilla/pulls{/number}","milestones_url":"https://api.github.com/repos/jwaterfaucett/rodzilla/milestones{/number}","notifications_url":"https://api.github.com/repos/jwaterfaucett/rodzilla/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jwaterfaucett/rodzilla/labels{/name}","releases_url":"https://api.github.com/repos/jwaterfaucett/rodzilla/releases{/id}","created_at":"2013-10-09T14:58:57Z","updated_at":"2014-12-29T02:22:57Z","pushed_at":"2013-12-31T22:50:36Z","git_url":"git://github.com/jwaterfaucett/rodzilla.git","ssh_url":"git@github.com:jwaterfaucett/rodzilla.git","clone_url":"https://github.com/jwaterfaucett/rodzilla.git","svn_url":"https://github.com/jwaterfaucett/rodzilla","homepage":"","size":444,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":2,"default_branch":"master","score":0.9709988}]}'
|
72
|
+
http_version:
|
73
|
+
recorded_at: Thu, 26 Mar 2015 00:07:37 GMT
|
74
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,69 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.github.com/search/users?q=morred%20type:User
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.9.1
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
+
Accept:
|
15
|
+
- "*/*"
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Server:
|
22
|
+
- GitHub.com
|
23
|
+
Date:
|
24
|
+
- Mon, 19 Jan 2015 12:21:38 GMT
|
25
|
+
Content-Type:
|
26
|
+
- application/json; charset=utf-8
|
27
|
+
Transfer-Encoding:
|
28
|
+
- chunked
|
29
|
+
Status:
|
30
|
+
- 200 OK
|
31
|
+
X-Ratelimit-Limit:
|
32
|
+
- '10'
|
33
|
+
X-Ratelimit-Remaining:
|
34
|
+
- '9'
|
35
|
+
X-Ratelimit-Reset:
|
36
|
+
- '1421670158'
|
37
|
+
Cache-Control:
|
38
|
+
- no-cache
|
39
|
+
X-Github-Media-Type:
|
40
|
+
- github.v3
|
41
|
+
X-Xss-Protection:
|
42
|
+
- 1; mode=block
|
43
|
+
X-Frame-Options:
|
44
|
+
- deny
|
45
|
+
Content-Security-Policy:
|
46
|
+
- default-src 'none'
|
47
|
+
Access-Control-Allow-Credentials:
|
48
|
+
- 'true'
|
49
|
+
Access-Control-Expose-Headers:
|
50
|
+
- ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset,
|
51
|
+
X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
|
52
|
+
Access-Control-Allow-Origin:
|
53
|
+
- "*"
|
54
|
+
X-Github-Request-Id:
|
55
|
+
- 72A7C5D7:2985:E66093:54BCF6D1
|
56
|
+
Strict-Transport-Security:
|
57
|
+
- max-age=31536000; includeSubdomains; preload
|
58
|
+
X-Content-Type-Options:
|
59
|
+
- nosniff
|
60
|
+
Vary:
|
61
|
+
- Accept-Encoding
|
62
|
+
X-Served-By:
|
63
|
+
- 8dd185e423974a7e13abbbe6e060031e
|
64
|
+
body:
|
65
|
+
encoding: UTF-8
|
66
|
+
string: '{"total_count":3,"incomplete_results":false,"items":[{"login":"Morred","id":4008608,"avatar_url":"https://avatars.githubusercontent.com/u/4008608?v=3","gravatar_id":"","url":"https://api.github.com/users/Morred","html_url":"https://github.com/Morred","followers_url":"https://api.github.com/users/Morred/followers","following_url":"https://api.github.com/users/Morred/following{/other_user}","gists_url":"https://api.github.com/users/Morred/gists{/gist_id}","starred_url":"https://api.github.com/users/Morred/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Morred/subscriptions","organizations_url":"https://api.github.com/users/Morred/orgs","repos_url":"https://api.github.com/users/Morred/repos","events_url":"https://api.github.com/users/Morred/events{/privacy}","received_events_url":"https://api.github.com/users/Morred/received_events","type":"User","site_admin":false,"score":61.729008},{"login":"morredilma","id":9913642,"avatar_url":"https://avatars.githubusercontent.com/u/9913642?v=3","gravatar_id":"","url":"https://api.github.com/users/morredilma","html_url":"https://github.com/morredilma","followers_url":"https://api.github.com/users/morredilma/followers","following_url":"https://api.github.com/users/morredilma/following{/other_user}","gists_url":"https://api.github.com/users/morredilma/gists{/gist_id}","starred_url":"https://api.github.com/users/morredilma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/morredilma/subscriptions","organizations_url":"https://api.github.com/users/morredilma/orgs","repos_url":"https://api.github.com/users/morredilma/repos","events_url":"https://api.github.com/users/morredilma/events{/privacy}","received_events_url":"https://api.github.com/users/morredilma/received_events","type":"User","site_admin":false,"score":9.908167},{"login":"morredor","id":357475,"avatar_url":"https://avatars.githubusercontent.com/u/357475?v=3","gravatar_id":"","url":"https://api.github.com/users/morredor","html_url":"https://github.com/morredor","followers_url":"https://api.github.com/users/morredor/followers","following_url":"https://api.github.com/users/morredor/following{/other_user}","gists_url":"https://api.github.com/users/morredor/gists{/gist_id}","starred_url":"https://api.github.com/users/morredor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/morredor/subscriptions","organizations_url":"https://api.github.com/users/morredor/orgs","repos_url":"https://api.github.com/users/morredor/repos","events_url":"https://api.github.com/users/morredor/events{/privacy}","received_events_url":"https://api.github.com/users/morredor/received_events","type":"User","site_admin":false,"score":7.9265337}]}'
|
67
|
+
http_version:
|
68
|
+
recorded_at: Mon, 19 Jan 2015 12:21:37 GMT
|
69
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,132 @@
|
|
1
|
+
require './test/test_helper'
|
2
|
+
|
3
|
+
class IssueTest < Minitest::Test
|
4
|
+
def test_exists
|
5
|
+
assert GithubSearch::Issue
|
6
|
+
end
|
7
|
+
|
8
|
+
def test_returns_issues
|
9
|
+
|
10
|
+
VCR.use_cassette('search_issues') do
|
11
|
+
github = GithubSearch::Searcher.new
|
12
|
+
result = github.issues.search("test", "issue", repo: "Morred/github-search", label: "enhancement" )
|
13
|
+
|
14
|
+
assert_equal Array, result.class
|
15
|
+
assert_equal 2, result.length
|
16
|
+
assert_equal GithubSearch::Issue, result.first.class
|
17
|
+
|
18
|
+
# Check that the fields are accessible by the model
|
19
|
+
assert_equal 54452074, result.first.id
|
20
|
+
assert_equal 2, result.first.number
|
21
|
+
assert_equal "This is another test issue.", result.first.title
|
22
|
+
assert_equal "This is another test issue.", result.first.body
|
23
|
+
assert_equal "https://api.github.com/repos/Morred/github-search/issues/2", result.first.url
|
24
|
+
assert_equal "https://api.github.com/repos/Morred/github-search/issues/2/labels{/name}", result.first.labels_url
|
25
|
+
assert_equal "https://api.github.com/repos/Morred/github-search/issues/2/comments", result.first.comments_url
|
26
|
+
assert_equal "https://api.github.com/repos/Morred/github-search/issues/2/events", result.first.events_url
|
27
|
+
assert_equal "https://github.com/Morred/github-search/issues/2", result.first.html_url
|
28
|
+
assert_equal "Morred", result.first.user["login"]
|
29
|
+
assert_equal "enhancement", result.first.labels.first["name"]
|
30
|
+
assert_equal "open", result.first.state
|
31
|
+
assert_equal false, result.first.locked
|
32
|
+
assert_equal nil, result.first.assignee
|
33
|
+
assert_equal nil, result.first.milestone
|
34
|
+
assert_equal 0, result.first.comments
|
35
|
+
assert_equal "2015-01-15T14:02:14Z", result.first.created_at
|
36
|
+
assert_equal "2015-01-15T14:02:20Z", result.first.updated_at
|
37
|
+
assert_equal nil, result.first.closed_at
|
38
|
+
assert_equal 10.624432, result.first.score
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_can_sort_by_updated
|
43
|
+
VCR.use_cassette('search_issues_sort_by_updated_at') do
|
44
|
+
github = GithubSearch::Searcher.new
|
45
|
+
result = github.issues.search("test", "issue", repo: "Morred/github-search", label: "enhancement", sort: :updated)
|
46
|
+
|
47
|
+
assert_equal Array, result.class
|
48
|
+
assert_equal GithubSearch::Issue, result.first.class
|
49
|
+
|
50
|
+
previous_result_item = nil
|
51
|
+
result.each do |result_item|
|
52
|
+
if previous_result_item
|
53
|
+
assert result_item.updated_at <= previous_result_item.updated_at
|
54
|
+
end
|
55
|
+
previous_result_item = result_item
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_can_sort_by_created
|
61
|
+
VCR.use_cassette('search_issues_sort_by_created_at') do
|
62
|
+
github = GithubSearch::Searcher.new
|
63
|
+
result = github.issues.search("test", "issue", repo: "Morred/github-search", label: "enhancement", sort: :created)
|
64
|
+
|
65
|
+
assert_equal Array, result.class
|
66
|
+
assert_equal GithubSearch::Issue, result.first.class
|
67
|
+
|
68
|
+
previous_result_item = nil
|
69
|
+
result.each do |result_item|
|
70
|
+
if previous_result_item
|
71
|
+
assert result_item.created_at <= previous_result_item.created_at
|
72
|
+
end
|
73
|
+
previous_result_item = result_item
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_can_sort_by_comments
|
79
|
+
VCR.use_cassette('search_issues_sort_by_comments') do
|
80
|
+
github = GithubSearch::Searcher.new
|
81
|
+
result = github.issues.search("test", "issue", repo: "Morred/github-search", label: "enhancement", sort: :comments)
|
82
|
+
|
83
|
+
assert_equal Array, result.class
|
84
|
+
assert_equal GithubSearch::Issue, result.first.class
|
85
|
+
|
86
|
+
previous_result_item = nil
|
87
|
+
result.each do |result_item|
|
88
|
+
if previous_result_item
|
89
|
+
assert result_item.comments <= previous_result_item.comments
|
90
|
+
end
|
91
|
+
previous_result_item = result_item
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def test_can_order_ascending
|
97
|
+
VCR.use_cassette('search_issues_order_ascending') do
|
98
|
+
github = GithubSearch::Searcher.new
|
99
|
+
result = github.issues.search("test", "issue", repo: "Morred/github-search", label: "enhancement", sort: :comments, order: :asc)
|
100
|
+
|
101
|
+
assert_equal Array, result.class
|
102
|
+
assert_equal GithubSearch::Issue, result.first.class
|
103
|
+
|
104
|
+
previous_result_item = nil
|
105
|
+
result.each do |result_item|
|
106
|
+
if previous_result_item
|
107
|
+
assert result_item.comments >= previous_result_item.comments
|
108
|
+
end
|
109
|
+
previous_result_item = result_item
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
def test_can_order_descending
|
115
|
+
VCR.use_cassette('search_issues_order_descending') do
|
116
|
+
github = GithubSearch::Searcher.new
|
117
|
+
result = github.issues.search("test", "issue", repo: "Morred/github-search", label: "enhancement", sort: :comments, order: :desc)
|
118
|
+
|
119
|
+
assert_equal Array, result.class
|
120
|
+
assert_equal GithubSearch::Issue, result.first.class
|
121
|
+
|
122
|
+
previous_result_item = nil
|
123
|
+
result.each do |result_item|
|
124
|
+
if previous_result_item
|
125
|
+
assert result_item.comments <= previous_result_item.comments
|
126
|
+
end
|
127
|
+
previous_result_item = result_item
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
end
|
@@ -0,0 +1,181 @@
|
|
1
|
+
require './test/test_helper'
|
2
|
+
|
3
|
+
class RepositoryTest < Minitest::Test
|
4
|
+
def test_exists
|
5
|
+
assert GithubSearch::Repository
|
6
|
+
end
|
7
|
+
|
8
|
+
def test_returns_repositories
|
9
|
+
VCR.use_cassette('search_repositories') do
|
10
|
+
github = GithubSearch::Searcher.new
|
11
|
+
result = github.repos.search("github", user: "Morred", fork: false)
|
12
|
+
|
13
|
+
assert_equal Array, result.class
|
14
|
+
assert_equal 1, result.length
|
15
|
+
assert_equal GithubSearch::Repository, result.first.class
|
16
|
+
|
17
|
+
# Check that the fields are accessible by the model
|
18
|
+
assert_equal 29250518, result.first.id
|
19
|
+
assert_equal "github-search", result.first.name
|
20
|
+
assert_equal "Morred/github-search", result.first.full_name
|
21
|
+
assert_equal "Morred", result.first.owner["login"]
|
22
|
+
assert_equal false, result.first.private
|
23
|
+
assert_equal "https://github.com/Morred/github-search", result.first.html_url
|
24
|
+
assert_equal "", result.first.description
|
25
|
+
assert_equal false, result.first.fork
|
26
|
+
|
27
|
+
assert_equal "https://api.github.com/repos/Morred/github-search", result.first.url
|
28
|
+
assert_equal "https://api.github.com/repos/Morred/github-search/forks", result.first.forks_url
|
29
|
+
assert_equal "https://api.github.com/repos/Morred/github-search/keys{/key_id}", result.first.keys_url
|
30
|
+
assert_equal "https://api.github.com/repos/Morred/github-search/collaborators{/collaborator}", result.first.collaborators_url
|
31
|
+
assert_equal "https://api.github.com/repos/Morred/github-search/teams", result.first.teams_url
|
32
|
+
assert_equal "https://api.github.com/repos/Morred/github-search/hooks", result.first.hooks_url
|
33
|
+
assert_equal "https://api.github.com/repos/Morred/github-search/issues/events{/number}", result.first.issue_events_url
|
34
|
+
assert_equal "https://api.github.com/repos/Morred/github-search/events", result.first.events_url
|
35
|
+
assert_equal "https://api.github.com/repos/Morred/github-search/assignees{/user}", result.first.assignees_url
|
36
|
+
assert_equal "https://api.github.com/repos/Morred/github-search/branches{/branch}", result.first.branches_url
|
37
|
+
assert_equal "https://api.github.com/repos/Morred/github-search/tags", result.first.tags_url
|
38
|
+
assert_equal "https://api.github.com/repos/Morred/github-search/git/blobs{/sha}", result.first.blobs_url
|
39
|
+
assert_equal "https://api.github.com/repos/Morred/github-search/git/tags{/sha}", result.first.git_tags_url
|
40
|
+
assert_equal "https://api.github.com/repos/Morred/github-search/git/refs{/sha}", result.first.git_refs_url
|
41
|
+
assert_equal "https://api.github.com/repos/Morred/github-search/git/trees{/sha}", result.first.trees_url
|
42
|
+
assert_equal "https://api.github.com/repos/Morred/github-search/statuses/{sha}", result.first.statuses_url
|
43
|
+
assert_equal "https://api.github.com/repos/Morred/github-search/languages", result.first.languages_url
|
44
|
+
assert_equal "https://api.github.com/repos/Morred/github-search/stargazers", result.first.stargazers_url
|
45
|
+
assert_equal "https://api.github.com/repos/Morred/github-search/contributors", result.first.contributors_url
|
46
|
+
assert_equal "https://api.github.com/repos/Morred/github-search/subscribers", result.first.subscribers_url
|
47
|
+
assert_equal "https://api.github.com/repos/Morred/github-search/subscription", result.first.subscription_url
|
48
|
+
assert_equal "https://api.github.com/repos/Morred/github-search/commits{/sha}", result.first.commits_url
|
49
|
+
assert_equal "https://api.github.com/repos/Morred/github-search/git/commits{/sha}", result.first.git_commits_url
|
50
|
+
assert_equal "https://api.github.com/repos/Morred/github-search/comments{/number}", result.first.comments_url
|
51
|
+
assert_equal "https://api.github.com/repos/Morred/github-search/issues/comments{/number}", result.first.issue_comment_url
|
52
|
+
assert_equal "https://api.github.com/repos/Morred/github-search/contents/{+path}", result.first.contents_url
|
53
|
+
assert_equal "https://api.github.com/repos/Morred/github-search/compare/{base}...{head}", result.first.compare_url
|
54
|
+
assert_equal "https://api.github.com/repos/Morred/github-search/merges", result.first.merges_url
|
55
|
+
assert_equal "https://api.github.com/repos/Morred/github-search/{archive_format}{/ref}", result.first.archive_url
|
56
|
+
assert_equal "https://api.github.com/repos/Morred/github-search/downloads", result.first.downloads_url
|
57
|
+
assert_equal "https://api.github.com/repos/Morred/github-search/issues{/number}", result.first.issues_url
|
58
|
+
assert_equal "https://api.github.com/repos/Morred/github-search/pulls{/number}", result.first.pulls_url
|
59
|
+
assert_equal "https://api.github.com/repos/Morred/github-search/milestones{/number}", result.first.milestones_url
|
60
|
+
assert_equal "https://api.github.com/repos/Morred/github-search/notifications{?since,all,participating}", result.first.notifications_url
|
61
|
+
assert_equal "https://api.github.com/repos/Morred/github-search/labels{/name}", result.first.labels_url
|
62
|
+
assert_equal "https://api.github.com/repos/Morred/github-search/releases{/id}", result.first.releases_url
|
63
|
+
|
64
|
+
assert_equal "2015-01-14T15:24:13Z", result.first.created_at
|
65
|
+
assert_equal "2015-02-22T13:11:59Z", result.first.updated_at
|
66
|
+
assert_equal "2015-03-07T14:49:15Z", result.first.pushed_at
|
67
|
+
assert_equal "git://github.com/Morred/github-search.git", result.first.git_url
|
68
|
+
assert_equal "git@github.com:Morred/github-search.git", result.first.ssh_url
|
69
|
+
assert_equal "https://github.com/Morred/github-search.git", result.first.clone_url
|
70
|
+
assert_equal "https://github.com/Morred/github-search", result.first.svn_url
|
71
|
+
assert_equal nil, result.first.homepage
|
72
|
+
assert_equal 280, result.first.size
|
73
|
+
assert_equal 0, result.first.stargazers_count
|
74
|
+
assert_equal 0, result.first.watchers_count
|
75
|
+
assert_equal "Ruby", result.first.language
|
76
|
+
assert_equal true, result.first.has_issues
|
77
|
+
assert_equal true, result.first.has_downloads
|
78
|
+
assert_equal true, result.first.has_wiki
|
79
|
+
assert_equal false, result.first.has_pages
|
80
|
+
assert_equal 0, result.first.forks_count
|
81
|
+
assert_equal nil, result.first.mirror_url
|
82
|
+
assert_equal 5, result.first.open_issues_count
|
83
|
+
assert_equal 0, result.first.forks
|
84
|
+
assert_equal 5, result.first.open_issues
|
85
|
+
assert_equal 0, result.first.watchers
|
86
|
+
assert_equal "master", result.first.default_branch
|
87
|
+
assert_equal 1.5003858, result.first.score
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def test_can_sort_by_updated
|
92
|
+
VCR.use_cassette('search_repositories_sort_by_updated_at') do
|
93
|
+
github = GithubSearch::Searcher.new
|
94
|
+
result = github.repos.search("client", user: "jwaterfaucett", sort: :updated)
|
95
|
+
|
96
|
+
assert_equal Array, result.class
|
97
|
+
assert_equal GithubSearch::Repository, result.first.class
|
98
|
+
|
99
|
+
previous_result_item = nil
|
100
|
+
result.each do |result_item|
|
101
|
+
if previous_result_item
|
102
|
+
assert result_item.pushed_at <= previous_result_item.pushed_at
|
103
|
+
end
|
104
|
+
previous_result_item = result_item
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
def test_can_sort_by_stars
|
110
|
+
VCR.use_cassette('search_repositories_sort_by_stars') do
|
111
|
+
github = GithubSearch::Searcher.new
|
112
|
+
result = github.repos.search("client", user: "jwaterfaucett", sort: :stars)
|
113
|
+
|
114
|
+
assert_equal Array, result.class
|
115
|
+
assert_equal GithubSearch::Repository, result.first.class
|
116
|
+
|
117
|
+
previous_result_item = nil
|
118
|
+
result.each do |result_item|
|
119
|
+
if previous_result_item
|
120
|
+
assert result_item.stargazers_count <= previous_result_item.stargazers_count
|
121
|
+
end
|
122
|
+
previous_result_item = result_item
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
def test_can_sort_by_forks
|
128
|
+
VCR.use_cassette('search_repositories_sort_by_forks') do
|
129
|
+
github = GithubSearch::Searcher.new
|
130
|
+
result = github.repos.search("client", user: "jwaterfaucett", sort: :forks)
|
131
|
+
|
132
|
+
assert_equal Array, result.class
|
133
|
+
assert_equal GithubSearch::Repository, result.first.class
|
134
|
+
|
135
|
+
previous_result_item = nil
|
136
|
+
result.each do |result_item|
|
137
|
+
if previous_result_item
|
138
|
+
assert result_item.forks_count <= previous_result_item.forks_count
|
139
|
+
end
|
140
|
+
previous_result_item = result_item
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
def test_can_order_ascending
|
146
|
+
VCR.use_cassette('search_repositories_order_ascending') do
|
147
|
+
github = GithubSearch::Searcher.new
|
148
|
+
result = github.repos.search("client",user: "jwaterfaucett", sort: :stars, order: :asc)
|
149
|
+
|
150
|
+
assert_equal Array, result.class
|
151
|
+
assert_equal GithubSearch::Repository, result.first.class
|
152
|
+
|
153
|
+
previous_result_item = nil
|
154
|
+
result.each do |result_item|
|
155
|
+
if previous_result_item
|
156
|
+
assert result_item.stargazers_count >= previous_result_item.stargazers_count
|
157
|
+
end
|
158
|
+
previous_result_item = result_item
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
def test_can_order_descending
|
164
|
+
VCR.use_cassette('search_repositories_order_descending') do
|
165
|
+
github = GithubSearch::Searcher.new
|
166
|
+
result = github.repos.search("client",user: "jwaterfaucett", sort: :stars, order: :desc)
|
167
|
+
|
168
|
+
assert_equal Array, result.class
|
169
|
+
assert_equal GithubSearch::Repository, result.first.class
|
170
|
+
|
171
|
+
previous_result_item = nil
|
172
|
+
result.each do |result_item|
|
173
|
+
if previous_result_item
|
174
|
+
assert result_item.stargazers_count <= previous_result_item.stargazers_count
|
175
|
+
end
|
176
|
+
previous_result_item = result_item
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
end
|