github_api 0.10.2 → 0.11.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.
Files changed (95) hide show
  1. data/README.md +78 -59
  2. data/features/cassettes/repos/assets/delete.yml +52 -0
  3. data/features/cassettes/repos/assets/edit.yml +65 -0
  4. data/features/cassettes/repos/assets/get.yml +74 -0
  5. data/features/cassettes/repos/assets/list.yml +73 -0
  6. data/features/cassettes/repos/assets/upload.yml +66 -0
  7. data/features/cassettes/repos/list_org.yml +167 -0
  8. data/features/cassettes/repos/list_org_instance.yml +300 -0
  9. data/features/cassettes/repos/releases/create.yml +64 -0
  10. data/features/cassettes/repos/releases/delete.yml +52 -0
  11. data/features/cassettes/repos/releases/edit.yml +63 -0
  12. data/features/cassettes/repos/releases/get.yml +78 -0
  13. data/features/cassettes/repos/releases/list.yml +81 -0
  14. data/features/cassettes/search/code.yml +252 -0
  15. data/features/cassettes/search/code_query.yml +65 -0
  16. data/features/cassettes/search/issues.yml +616 -170
  17. data/features/cassettes/search/legacy/email.yml +72 -0
  18. data/features/cassettes/search/legacy/issues.yml +119 -0
  19. data/features/cassettes/search/legacy/repos.yml +394 -0
  20. data/features/cassettes/search/legacy/users.yml +72 -0
  21. data/features/cassettes/search/legacy/users_keyword.yml +63 -0
  22. data/features/cassettes/search/repos.yml +375 -364
  23. data/features/cassettes/search/users.yml +40 -22
  24. data/features/cassettes/search/users_keyword.yml +51 -56
  25. data/features/repos.feature +22 -0
  26. data/features/repos/assets.feature +59 -0
  27. data/features/repos/releases.feature +58 -0
  28. data/features/search.feature +24 -13
  29. data/features/search/legacy.feature +59 -0
  30. data/features/settings.yml +2 -5
  31. data/features/step_definitions/github_api_steps.rb +12 -0
  32. data/lib/github_api/configuration.rb +3 -1
  33. data/lib/github_api/error.rb +6 -17
  34. data/lib/github_api/error/unknown_media.rb +18 -0
  35. data/lib/github_api/params_hash.rb +20 -10
  36. data/lib/github_api/repos.rb +26 -15
  37. data/lib/github_api/repos/releases.rb +146 -0
  38. data/lib/github_api/repos/releases/assets.rb +126 -0
  39. data/lib/github_api/request.rb +14 -9
  40. data/lib/github_api/resource.rb +8 -1
  41. data/lib/github_api/search.rb +68 -27
  42. data/lib/github_api/search/legacy.rb +94 -0
  43. data/lib/github_api/ssl_certs/cacert.pem +41 -0
  44. data/lib/github_api/ssl_certs/cacerts.pem +2183 -0
  45. data/lib/github_api/version.rb +2 -2
  46. data/spec/fixtures/repos/asset.json +12 -0
  47. data/spec/fixtures/repos/assets.json +14 -0
  48. data/spec/fixtures/repos/release.json +15 -0
  49. data/spec/fixtures/repos/releases.json +17 -0
  50. data/spec/fixtures/search/code.json +76 -0
  51. data/spec/fixtures/search/issues.json +47 -16
  52. data/spec/fixtures/search/issues_legacy.json +23 -0
  53. data/spec/fixtures/search/repos.json +39 -0
  54. data/spec/fixtures/search/{repositories.json → repos_legacy.json} +0 -0
  55. data/spec/fixtures/search/users.json +15 -19
  56. data/spec/fixtures/search/users_legacy.json +24 -0
  57. data/spec/github/configuration_spec.rb +2 -0
  58. data/spec/github/error/unknown_media_spec.rb +21 -0
  59. data/spec/github/git_data/references/create_spec.rb +1 -1
  60. data/spec/github/git_data/references/get_spec.rb +6 -4
  61. data/spec/github/git_data/references/list_spec.rb +6 -16
  62. data/spec/github/pagination/iterator/number_spec.rb +2 -2
  63. data/spec/github/pagination/iterator/sha_spec.rb +2 -2
  64. data/spec/github/params_hash_spec.rb +6 -0
  65. data/spec/github/repos/assets/delete_spec.rb +40 -0
  66. data/spec/github/repos/assets/edit_spec.rb +40 -0
  67. data/spec/github/repos/assets/get_spec.rb +45 -0
  68. data/spec/github/repos/assets/list_spec.rb +55 -0
  69. data/spec/github/repos/assets/upload_spec.rb +44 -0
  70. data/spec/github/repos/downloads/upload_spec.rb +5 -5
  71. data/spec/github/repos/releases/create_spec.rb +44 -0
  72. data/spec/github/repos/releases/delete_spec.rb +40 -0
  73. data/spec/github/repos/releases/edit_spec.rb +40 -0
  74. data/spec/github/repos/releases/get_spec.rb +45 -0
  75. data/spec/github/repos/releases/list_spec.rb +54 -0
  76. data/spec/github/request/endpoint_spec.rb +1 -3
  77. data/spec/github/request/request_spec.rb +4 -8
  78. data/spec/github/request_spec.rb +3 -3
  79. data/spec/github/response_wrapper_spec.rb +3 -3
  80. data/spec/github/s3_uploader_spec.rb +2 -3
  81. data/spec/github/search/code_spec.rb +38 -0
  82. data/spec/github/search/issues_spec.rb +38 -0
  83. data/spec/github/search/legacy/email_spec.rb +34 -0
  84. data/spec/github/search/legacy/issues_spec.rb +39 -0
  85. data/spec/github/search/legacy/repos_spec.rb +36 -0
  86. data/spec/github/search/legacy/users_spec.rb +36 -0
  87. data/spec/github/search/repos_spec.rb +38 -0
  88. data/spec/github/search/users_spec.rb +38 -0
  89. data/spec/github/users/get_spec.rb +1 -1
  90. data/spec/github/validations/presence_spec.rb +2 -5
  91. data/spec/integration/repos_spec.rb +4 -0
  92. data/spec/integration/search_spec.rb +12 -0
  93. metadata +122 -62
  94. data/features/cassettes/search/email.yml +0 -99
  95. data/spec/github/search_spec.rb +0 -102
@@ -3,8 +3,8 @@
3
3
  module Github
4
4
  module VERSION
5
5
  MAJOR = 0
6
- MINOR = 10
7
- PATCH = 2
6
+ MINOR = 11
7
+ PATCH = 0
8
8
  BUILD = nil
9
9
 
10
10
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.');
@@ -0,0 +1,12 @@
1
+ {
2
+ "url": "https://api.github.com/repos/octocat/Hello-World/releases/assets/1",
3
+ "id": 1,
4
+ "name": "example.zip",
5
+ "label": "short description",
6
+ "state": "uploaded",
7
+ "content_type": "application/zip",
8
+ "size": 1024,
9
+ "download_count": 42,
10
+ "created_at": "2013-02-27T19:35:32Z",
11
+ "updated_at": "2013-02-27T19:35:32Z"
12
+ }
@@ -0,0 +1,14 @@
1
+ [
2
+ {
3
+ "url": "https://api.github.com/repos/octocat/Hello-World/releases/assets/1",
4
+ "id": 1,
5
+ "name": "example.zip",
6
+ "label": "short description",
7
+ "state": "uploaded",
8
+ "content_type": "application/zip",
9
+ "size": 1024,
10
+ "download_count": 42,
11
+ "created_at": "2013-02-27T19:35:32Z",
12
+ "updated_at": "2013-02-27T19:35:32Z"
13
+ }
14
+ ]
@@ -0,0 +1,15 @@
1
+ {
2
+ "url": "https://api.github.com/repos/octocat/Hello-World/releases/1",
3
+ "html_url": "https://github.com/octocat/Hello-World/releases/v1.0.0",
4
+ "assets_url": "https://api.github.com/repos/octocat/Hello-World/releases/1/assets",
5
+ "upload_url": "https://uploads.github.com/repos/octocat/Hello-World/releases/1/assets{?name}",
6
+ "id": 1,
7
+ "tag_name": "v1.0.0",
8
+ "target_commitish": "master",
9
+ "name": "v1.0.0",
10
+ "body": "Description of the release",
11
+ "draft": false,
12
+ "prerelease": false,
13
+ "created_at": "2013-02-27T19:35:32Z",
14
+ "published_at": "2013-02-27T19:35:32Z"
15
+ }
@@ -0,0 +1,17 @@
1
+ [
2
+ {
3
+ "url": "https://api.github.com/repos/octocat/Hello-World/releases/1",
4
+ "html_url": "https://github.com/octocat/Hello-World/releases/v1.0.0",
5
+ "assets_url": "https://api.github.com/repos/octocat/Hello-World/releases/1/assets",
6
+ "upload_url": "https://uploads.github.com/repos/octocat/Hello-World/releases/1/assets{?name}",
7
+ "id": 1,
8
+ "tag_name": "v1.0.0",
9
+ "target_commitish": "master",
10
+ "name": "v1.0.0",
11
+ "body": "Description of the release",
12
+ "draft": false,
13
+ "prerelease": false,
14
+ "created_at": "2013-02-27T19:35:32Z",
15
+ "published_at": "2013-02-27T19:35:32Z"
16
+ }
17
+ ]
@@ -0,0 +1,76 @@
1
+ {
2
+ "total_count": 104,
3
+ "items": [
4
+ {
5
+ "name": "github-issue-importer.gemspec",
6
+ "path": "github-issue-importer.gemspec",
7
+ "sha": "394508202991504d8a0771ae027454facaaa045a",
8
+ "url": "https://api.github.com/repositories/1586630/contents/github-issue-importer.gemspec?ref=aa22a4be513163c73531e96bd99f4b49d6ded8a6",
9
+ "git_url": "https://api.github.com/repositories/1586630/git/blobs/394508202991504d8a0771ae027454facaaa045a",
10
+ "html_url": "https://github.com/johnf/github-issue-importer/blob/aa22a4be513163c73531e96bd99f4b49d6ded8a6/github-issue-importer.gemspec",
11
+ "repository": {
12
+ "id": 1586630,
13
+ "name": "github-issue-importer",
14
+ "full_name": "johnf/github-issue-importer",
15
+ "owner": {
16
+ "login": "johnf",
17
+ "id": 42590,
18
+ "avatar_url": "https://secure.gravatar.com/avatar/ab4d879ba3233a270aa14f447c795505?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
19
+ "gravatar_id": "ab4d879ba3233a270aa14f447c795505",
20
+ "url": "https://api.github.com/users/johnf",
21
+ "html_url": "https://github.com/johnf",
22
+ "followers_url": "https://api.github.com/users/johnf/followers",
23
+ "following_url": "https://api.github.com/users/johnf/following{/other_user}",
24
+ "gists_url": "https://api.github.com/users/johnf/gists{/gist_id}",
25
+ "starred_url": "https://api.github.com/users/johnf/starred{/owner}{/repo}",
26
+ "subscriptions_url": "https://api.github.com/users/johnf/subscriptions",
27
+ "organizations_url": "https://api.github.com/users/johnf/orgs",
28
+ "repos_url": "https://api.github.com/users/johnf/repos",
29
+ "events_url": "https://api.github.com/users/johnf/events{/privacy}",
30
+ "received_events_url": "https://api.github.com/users/johnf/received_events",
31
+ "type": "User"
32
+ },
33
+ "private": false,
34
+ "html_url": "https://github.com/johnf/github-issue-importer",
35
+ "description": "Import Issues from Launchpad (for now) into github",
36
+ "fork": false,
37
+ "url": "https://api.github.com/repos/johnf/github-issue-importer",
38
+ "forks_url": "https://api.github.com/repos/johnf/github-issue-importer/forks",
39
+ "keys_url": "https://api.github.com/repos/johnf/github-issue-importer/keys{/key_id}",
40
+ "collaborators_url": "https://api.github.com/repos/johnf/github-issue-importer/collaborators{/collaborator}",
41
+ "teams_url": "https://api.github.com/repos/johnf/github-issue-importer/teams",
42
+ "hooks_url": "https://api.github.com/repos/johnf/github-issue-importer/hooks",
43
+ "issue_events_url": "https://api.github.com/repos/johnf/github-issue-importer/issues/events{/number}",
44
+ "events_url": "https://api.github.com/repos/johnf/github-issue-importer/events",
45
+ "assignees_url": "https://api.github.com/repos/johnf/github-issue-importer/assignees{/user}",
46
+ "branches_url": "https://api.github.com/repos/johnf/github-issue-importer/branches{/branch}",
47
+ "tags_url": "https://api.github.com/repos/johnf/github-issue-importer/tags",
48
+ "blobs_url": "https://api.github.com/repos/johnf/github-issue-importer/git/blobs{/sha}",
49
+ "git_tags_url": "https://api.github.com/repos/johnf/github-issue-importer/git/tags{/sha}",
50
+ "git_refs_url": "https://api.github.com/repos/johnf/github-issue-importer/git/refs{/sha}",
51
+ "trees_url": "https://api.github.com/repos/johnf/github-issue-importer/git/trees{/sha}",
52
+ "statuses_url": "https://api.github.com/repos/johnf/github-issue-importer/statuses/{sha}",
53
+ "languages_url": "https://api.github.com/repos/johnf/github-issue-importer/languages",
54
+ "stargazers_url": "https://api.github.com/repos/johnf/github-issue-importer/stargazers",
55
+ "contributors_url": "https://api.github.com/repos/johnf/github-issue-importer/contributors",
56
+ "subscribers_url": "https://api.github.com/repos/johnf/github-issue-importer/subscribers",
57
+ "subscription_url": "https://api.github.com/repos/johnf/github-issue-importer/subscription",
58
+ "commits_url": "https://api.github.com/repos/johnf/github-issue-importer/commits{/sha}",
59
+ "git_commits_url": "https://api.github.com/repos/johnf/github-issue-importer/git/commits{/sha}",
60
+ "comments_url": "https://api.github.com/repos/johnf/github-issue-importer/comments{/number}",
61
+ "issue_comment_url": "https://api.github.com/repos/johnf/github-issue-importer/issues/comments/{number}",
62
+ "contents_url": "https://api.github.com/repos/johnf/github-issue-importer/contents/{+path}",
63
+ "compare_url": "https://api.github.com/repos/johnf/github-issue-importer/compare/{base}...{head}",
64
+ "merges_url": "https://api.github.com/repos/johnf/github-issue-importer/merges",
65
+ "archive_url": "https://api.github.com/repos/johnf/github-issue-importer/{archive_format}{/ref}",
66
+ "downloads_url": "https://api.github.com/repos/johnf/github-issue-importer/downloads",
67
+ "issues_url": "https://api.github.com/repos/johnf/github-issue-importer/issues{/number}",
68
+ "pulls_url": "https://api.github.com/repos/johnf/github-issue-importer/pulls{/number}",
69
+ "milestones_url": "https://api.github.com/repos/johnf/github-issue-importer/milestones{/number}",
70
+ "notifications_url": "https://api.github.com/repos/johnf/github-issue-importer/notifications{?since,all,participating}",
71
+ "labels_url": "https://api.github.com/repos/johnf/github-issue-importer/labels{/name}"
72
+ },
73
+ "score": 0.96691436
74
+ }
75
+ ]
76
+ }
@@ -1,23 +1,54 @@
1
1
  {
2
- "issues": [
2
+ "total_count": 280,
3
+ "items": [
3
4
  {
4
- "gravatar_id": "4c3d600867886124a73f14a907b1a955",
5
- "position": 10,
6
- "number": 10,
7
- "votes": 2,
8
- "created_at": "2010-06-04T23:20:33-07:00",
9
- "comments": 5,
10
- "body": "Issue body goes here",
11
- "title": "This is is the issue title",
12
- "updated_at": "2010-06-04T23:20:33-07:00",
13
- "html_url": "https => //github.com/pengwynn/linkedin/issues/10",
14
- "user": "ckarbass",
5
+ "url": "https://api.github.com/repos/batterseapower/pinyin-toolkit/issues/132",
6
+ "labels_url": "https://api.github.com/repos/batterseapower/pinyin-toolkit/issues/132/labels{/name}",
7
+ "comments_url": "https://api.github.com/repos/batterseapower/pinyin-toolkit/issues/132/comments",
8
+ "events_url": "https://api.github.com/repos/batterseapower/pinyin-toolkit/issues/132/events",
9
+ "html_url": "https://github.com/batterseapower/pinyin-toolkit/issues/132",
10
+ "id": 35802,
11
+ "number": 132,
12
+ "title": "Line Number Indexes Beyond 20 Not Displayed",
13
+ "user": {
14
+ "login": "Nick3C",
15
+ "id": 90254,
16
+ "avatar_url": "https://secure.gravatar.com/avatar/934442aadfe3b2f4630510de416c5718?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
17
+ "gravatar_id": "934442aadfe3b2f4630510de416c5718",
18
+ "url": "https://api.github.com/users/Nick3C",
19
+ "html_url": "https://github.com/Nick3C",
20
+ "followers_url": "https://api.github.com/users/Nick3C/followers",
21
+ "following_url": "https://api.github.com/users/Nick3C/following{/other_user}",
22
+ "gists_url": "https://api.github.com/users/Nick3C/gists{/gist_id}",
23
+ "starred_url": "https://api.github.com/users/Nick3C/starred{/owner}{/repo}",
24
+ "subscriptions_url": "https://api.github.com/users/Nick3C/subscriptions",
25
+ "organizations_url": "https://api.github.com/users/Nick3C/orgs",
26
+ "repos_url": "https://api.github.com/users/Nick3C/repos",
27
+ "events_url": "https://api.github.com/users/Nick3C/events{/privacy}",
28
+ "received_events_url": "https://api.github.com/users/Nick3C/received_events",
29
+ "type": "User"
30
+ },
15
31
  "labels": [
16
- "api",
17
- "feature request",
18
- "investigation"
32
+ {
33
+ "url": "https://api.github.com/repos/batterseapower/pinyin-toolkit/labels/bug",
34
+ "name": "bug",
35
+ "color": "ff0000"
36
+ }
19
37
  ],
20
- "state": "open"
38
+ "state": "open",
39
+ "assignee": null,
40
+ "milestone": null,
41
+ "comments": 15,
42
+ "created_at": "2009-07-12T20:10:41Z",
43
+ "updated_at": "2009-07-19T09:23:43Z",
44
+ "closed_at": null,
45
+ "pull_request": {
46
+ "html_url": null,
47
+ "diff_url": null,
48
+ "patch_url": null
49
+ },
50
+ "body": "...",
51
+ "score": 1.3859273
21
52
  }
22
53
  ]
23
54
  }
@@ -0,0 +1,23 @@
1
+ {
2
+ "issues": [
3
+ {
4
+ "gravatar_id": "4c3d600867886124a73f14a907b1a955",
5
+ "position": 10,
6
+ "number": 10,
7
+ "votes": 2,
8
+ "created_at": "2010-06-04T23:20:33-07:00",
9
+ "comments": 5,
10
+ "body": "Issue body goes here",
11
+ "title": "This is is the issue title",
12
+ "updated_at": "2010-06-04T23:20:33-07:00",
13
+ "html_url": "https => //github.com/pengwynn/linkedin/issues/10",
14
+ "user": "ckarbass",
15
+ "labels": [
16
+ "api",
17
+ "feature request",
18
+ "investigation"
19
+ ],
20
+ "state": "open"
21
+ }
22
+ ]
23
+ }
@@ -0,0 +1,39 @@
1
+ {
2
+ "total_count": 40,
3
+ "items": [
4
+ {
5
+ "id": 3081286,
6
+ "name": "Tetris",
7
+ "full_name": "dtrupenn/Tetris",
8
+ "owner": {
9
+ "login": "dtrupenn",
10
+ "id": 872147,
11
+ "avatar_url": "https://secure.gravatar.com/avatar/e7956084e75f239de85d3a31bc172ace?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
12
+ "gravatar_id": "e7956084e75f239de85d3a31bc172ace",
13
+ "url": "https://api.github.com/users/dtrupenn",
14
+ "received_events_url": "https://api.github.com/users/dtrupenn/received_events",
15
+ "type": "User"
16
+ },
17
+ "private": false,
18
+ "html_url": "https://github.com/dtrupenn/Tetris",
19
+ "description": "A C implementation of Tetris using Pennsim through LC4",
20
+ "fork": false,
21
+ "url": "https://api.github.com/repos/dtrupenn/Tetris",
22
+ "created_at": "2012-01-01T00:31:50Z",
23
+ "updated_at": "2013-01-05T17:58:47Z",
24
+ "pushed_at": "2012-01-01T00:37:02Z",
25
+ "homepage": "",
26
+ "size": 524,
27
+ "watchers_count": 1,
28
+ "language": "Assembly",
29
+ "forks_count": 0,
30
+ "open_issues_count": 0,
31
+ "forks": 0,
32
+ "open_issues": 0,
33
+ "watchers": 1,
34
+ "master_branch": "master",
35
+ "default_branch": "master",
36
+ "score": 10.309712
37
+ }
38
+ ]
39
+ }
@@ -1,24 +1,20 @@
1
1
  {
2
- "users": [
2
+ "total_count": 12,
3
+ "items": [
3
4
  {
4
- "gravatar_id": "70889091349f7598bce9afa588034310",
5
- "name": "Hirotaka Kawata",
6
- "created_at": "2009-10-05T01:32:06Z",
7
- "location": "Tsukuba, Ibaraki, Japan",
8
- "public_repo_count": 8,
9
- "followers": 10,
10
- "language": "Python",
11
- "fullname": "Hirotaka Kawata",
12
- "username": "techno",
13
- "id": "user-135050",
14
- "repos": 8,
15
- "type": "user",
16
- "followers_count": 10,
17
- "pushed": "2012-04-18T02:15:17.511Z",
18
- "login": "techno",
19
- "score": 4.2559967,
20
- "record": null,
21
- "created": "2009-10-05T01:32:06Z"
5
+ "login": "mojombo",
6
+ "id": 1,
7
+ "avatar_url": "https://secure.gravatar.com/avatar/25c7c18223fb42a4c6ae1c8db6f50f9b?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
8
+ "gravatar_id": "25c7c18223fb42a4c6ae1c8db6f50f9b",
9
+ "url": "https://api.github.com/users/mojombo",
10
+ "html_url": "https://github.com/mojombo",
11
+ "followers_url": "https://api.github.com/users/mojombo/followers",
12
+ "subscriptions_url": "https://api.github.com/users/mojombo/subscriptions",
13
+ "organizations_url": "https://api.github.com/users/mojombo/orgs",
14
+ "repos_url": "https://api.github.com/users/mojombo/repos",
15
+ "received_events_url": "https://api.github.com/users/mojombo/received_events",
16
+ "type": "User",
17
+ "score": 105.47857
22
18
  }
23
19
  ]
24
20
  }
@@ -0,0 +1,24 @@
1
+ {
2
+ "users": [
3
+ {
4
+ "gravatar_id": "70889091349f7598bce9afa588034310",
5
+ "name": "Hirotaka Kawata",
6
+ "created_at": "2009-10-05T01:32:06Z",
7
+ "location": "Tsukuba, Ibaraki, Japan",
8
+ "public_repo_count": 8,
9
+ "followers": 10,
10
+ "language": "Python",
11
+ "fullname": "Hirotaka Kawata",
12
+ "username": "techno",
13
+ "id": "user-135050",
14
+ "repos": 8,
15
+ "type": "user",
16
+ "followers_count": 10,
17
+ "pushed": "2012-04-18T02:15:17.511Z",
18
+ "login": "techno",
19
+ "score": 4.2559967,
20
+ "record": null,
21
+ "created": "2009-10-05T01:32:06Z"
22
+ }
23
+ ]
24
+ }
@@ -35,6 +35,8 @@ describe Github::Configuration do
35
35
 
36
36
  its(:user) { should be_nil }
37
37
 
38
+ its(:org) { should be_nil }
39
+
38
40
  its(:connection_options) { should be_a Hash }
39
41
 
40
42
  its(:connection_options) { should be_empty }
@@ -0,0 +1,21 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Github::Error::UnknownMedia do
6
+ describe '#message' do
7
+ let(:error) { described_class.new('README.md') }
8
+
9
+ it 'contains the problem in the message' do
10
+ error.message.should include "Unknown content type for: 'README.md' provided for this request."
11
+ end
12
+
13
+ it 'contains the summary in the message' do
14
+ error.message.should include "Github gem infers the content type of the resource by calling the mime-types gem type inference."
15
+ end
16
+
17
+ it 'contains the resolution in the message' do
18
+ error.message.should include "Please install mime-types gem to infer the resource content type."
19
+ end
20
+ end
21
+ end # Github::Error::UnkownMedia
@@ -41,7 +41,7 @@ describe Github::GitData::References, '#create' do
41
41
  it "should fail to create resource if 'ref' is correct" do
42
42
  expect {
43
43
  subject.create user, repo, :ref => '/heads/master', :sha => '13t2a1r3'
44
- }.not_to raise_error(ArgumentError)
44
+ }.not_to raise_error()
45
45
  end
46
46
 
47
47
  it "should create resource successfully" do
@@ -25,10 +25,12 @@ describe Github::GitData::References, '#get' do
25
25
  expect { subject.get user, repo, nil }.to raise_error(ArgumentError)
26
26
  end
27
27
 
28
- it "should fail to get resource with wrong ref" do
29
- expect {
30
- subject.get user, repo, '/branch'
31
- }.not_to raise_error(ArgumentError)
28
+ context 'when wrong ref' do
29
+ let(:ref) { 'branch' }
30
+
31
+ it "should fail to get resource with wrong ref" do
32
+ expect { subject.get user, repo, '/branch' }.not_to raise_error()
33
+ end
32
34
  end
33
35
 
34
36
  it "should get the resource" do
@@ -22,16 +22,14 @@ describe Github::GitData::References, '#list' do
22
22
  it { should respond_to :all }
23
23
 
24
24
  it "should fail to get resource without username" do
25
- expect { subject.list nil, repo }.to raise_error(ArgumentError)
25
+ expect { subject.list(nil, repo) }.to raise_error(ArgumentError)
26
26
  end
27
27
 
28
28
  context 'with invalid reference' do
29
29
  let(:ref) { '/branch/featureA' }
30
30
 
31
31
  it "should fail to call" do
32
- expect {
33
- subject.list user, repo, :ref => ref
34
- }.to_not raise_error(ArgumentError, /reference/)
32
+ expect { subject.list(user, repo, :ref => ref) }.to_not raise_error()
35
33
  end
36
34
  end
37
35
 
@@ -39,9 +37,7 @@ describe Github::GitData::References, '#list' do
39
37
  let(:ref) { 'heads/lleger-refactor' }
40
38
 
41
39
  it "should pass with valid reference" do
42
- expect {
43
- subject.list user, repo, :ref => ref
44
- }.to_not raise_error(ArgumentError, /reference/)
40
+ expect { subject.list(user, repo, :ref => ref) }.to_not raise_error()
45
41
  end
46
42
  end
47
43
 
@@ -49,9 +45,7 @@ describe Github::GitData::References, '#list' do
49
45
  let(:ref) { 'refactors/lleger-refactor' }
50
46
 
51
47
  it "should pass with valid reference" do
52
- expect {
53
- subject.list user, repo, :ref => ref
54
- }.to_not raise_error(ArgumentError, /reference/)
48
+ expect { subject.list(user, repo, :ref => ref) }.to_not raise_error()
55
49
  end
56
50
  end
57
51
 
@@ -59,9 +53,7 @@ describe Github::GitData::References, '#list' do
59
53
  let(:ref) { 'refs/heads/lleger-refactor' }
60
54
 
61
55
  it "should pass with valid reference" do
62
- expect {
63
- subject.list user, repo, :ref => ref
64
- }.to_not raise_error(ArgumentError, /reference/)
56
+ expect { subject.list(user, repo, :ref => ref) }.to_not raise_error()
65
57
  end
66
58
  end
67
59
 
@@ -69,9 +61,7 @@ describe Github::GitData::References, '#list' do
69
61
  let(:ref) { '/refs/heads/lleger-refactor' }
70
62
 
71
63
  it "should pass with valid reference" do
72
- expect {
73
- subject.list user, repo, :ref => ref
74
- }.to_not raise_error(ArgumentError, /reference/)
64
+ expect { subject.list(user, repo, :ref => ref) }.to_not raise_error()
75
65
  end
76
66
  end
77
67