octokit 1.0.7 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +1 -0
- data/lib/octokit/client.rb +3 -0
- data/lib/octokit/client/gists.rb +66 -0
- data/lib/octokit/gist.rb +27 -0
- data/lib/octokit/version.rb +1 -1
- data/spec/fixtures/timeline.json +1408 -1237
- data/spec/fixtures/v2/blob_metadata.json +2052 -1
- data/spec/fixtures/v2/blobs.json +260 -1
- data/spec/fixtures/v2/issues.json +49 -1
- data/spec/fixtures/v2/network_data.json +3551 -1
- data/spec/fixtures/v2/network_meta.json +2530 -1
- data/spec/fixtures/v2/repositories.json +173 -1
- data/spec/fixtures/v2/tree_metadata.json +2612 -1
- data/spec/fixtures/v2/user.json +19 -1
- data/spec/fixtures/v2/users.json +24 -1
- data/spec/fixtures/v3/blob.json +5 -5
- data/spec/fixtures/v3/branches.json +14 -14
- data/spec/fixtures/v3/collaborators.json +60 -60
- data/spec/fixtures/v3/comment.json +12 -12
- data/spec/fixtures/v3/comments.json +41 -41
- data/spec/fixtures/v3/commit.json +50 -1
- data/spec/fixtures/v3/commit_comment.json +17 -17
- data/spec/fixtures/v3/commit_comments.json +76 -76
- data/spec/fixtures/v3/commits.json +1414 -1
- data/spec/fixtures/v3/contributors.json +889 -889
- data/spec/fixtures/v3/download.json +9 -9
- data/spec/fixtures/v3/downloads.json +33 -33
- data/spec/fixtures/v3/emails.json +3 -3
- data/spec/fixtures/v3/followers.json +210 -210
- data/spec/fixtures/v3/following.json +207 -207
- data/spec/fixtures/v3/forks.json +870 -870
- data/spec/fixtures/v3/gist.json +51 -0
- data/spec/fixtures/v3/gists.json +548 -0
- data/spec/fixtures/v3/issue.json +33 -35
- data/spec/fixtures/v3/issue_closed.json +34 -36
- data/spec/fixtures/v3/issue_event.json +40 -42
- data/spec/fixtures/v3/issue_events.json +70 -70
- data/spec/fixtures/v3/issues.json +1559 -1577
- data/spec/fixtures/v3/label.json +3 -3
- data/spec/fixtures/v3/labels.json +15 -15
- data/spec/fixtures/v3/languages.json +3 -3
- data/spec/fixtures/v3/list_commit_comments.json +570 -570
- data/spec/fixtures/v3/milestone.json +9 -10
- data/spec/fixtures/v3/milestones.json +25 -25
- data/spec/fixtures/v3/not_found.json +1 -1
- data/spec/fixtures/v3/organization-repositories.json +4290 -4290
- data/spec/fixtures/v3/organization-repository.json +41 -41
- data/spec/fixtures/v3/organization.json +16 -16
- data/spec/fixtures/v3/organization_members.json +574 -574
- data/spec/fixtures/v3/organization_team_members.json +14 -14
- data/spec/fixtures/v3/organization_team_repos.json +60 -60
- data/spec/fixtures/v3/organizations.json +42 -42
- data/spec/fixtures/v3/public_events.json +1101 -1107
- data/spec/fixtures/v3/public_gists.json +968 -0
- data/spec/fixtures/v3/public_key.json +3 -3
- data/spec/fixtures/v3/public_keys.json +5 -5
- data/spec/fixtures/v3/pull_created.json +134 -134
- data/spec/fixtures/v3/pull_request.json +134 -134
- data/spec/fixtures/v3/pull_requests.json +185 -185
- data/spec/fixtures/v3/repo_events.json +1644 -1660
- data/spec/fixtures/v3/repo_issues_events.json +127 -133
- data/spec/fixtures/v3/repositories.json +871 -871
- data/spec/fixtures/v3/repository.json +33 -33
- data/spec/fixtures/v3/starred_gists.json +30 -0
- data/spec/fixtures/v3/tags.json +171 -171
- data/spec/fixtures/v3/team.json +6 -6
- data/spec/fixtures/v3/teams.json +10 -10
- data/spec/fixtures/v3/tree.json +110 -110
- data/spec/fixtures/v3/user.json +18 -18
- data/spec/fixtures/v3/user_events.json +99 -100
- data/spec/fixtures/v3/watched.json +1020 -1020
- data/spec/fixtures/v3/watchers.json +180 -180
- data/spec/octokit/client/gists_spec.rb +133 -0
- data/spec/octokit/gist_spec.rb +49 -0
- metadata +40 -26
@@ -1,182 +1,182 @@
|
|
1
1
|
[
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
2
|
+
{
|
3
|
+
"avatar_url": "https://secure.gravatar.com/avatar/1f74b13f1e5c6c69cb5d7fbaabb1e2cb?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
|
4
|
+
"id": 10308,
|
5
|
+
"login": "sferik",
|
6
|
+
"url": "https://api.github.com/users/sferik"
|
7
|
+
},
|
8
|
+
{
|
9
|
+
"avatar_url": "https://secure.gravatar.com/avatar/8ff2e3d23012979b285f97c33c8f43ba?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
|
10
|
+
"id": 3002,
|
11
|
+
"login": "reddavis",
|
12
|
+
"url": "https://api.github.com/users/reddavis"
|
13
|
+
},
|
14
|
+
{
|
15
|
+
"avatar_url": "https://secure.gravatar.com/avatar/dfa3143343f3680753e0ae09de57bcd6?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
|
16
|
+
"id": 2641,
|
17
|
+
"login": "hurrycane",
|
18
|
+
"url": "https://api.github.com/users/hurrycane"
|
19
|
+
},
|
20
|
+
{
|
21
|
+
"avatar_url": "https://secure.gravatar.com/avatar/428167a3ec72235ba971162924492609?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
|
22
|
+
"id": 4,
|
23
|
+
"login": "wycats",
|
24
|
+
"url": "https://api.github.com/users/wycats"
|
25
|
+
},
|
26
|
+
{
|
27
|
+
"avatar_url": "https://secure.gravatar.com/avatar/4dd5eeec0e5a4d235233dd88931a7804?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
|
28
|
+
"id": 43417,
|
29
|
+
"login": "Psli",
|
30
|
+
"url": "https://api.github.com/users/Psli"
|
31
|
+
},
|
32
|
+
{
|
33
|
+
"avatar_url": "https://secure.gravatar.com/avatar/23543848894f7af28866ccf2e0bd185b?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
|
34
|
+
"id": 5977,
|
35
|
+
"login": "gigamo",
|
36
|
+
"url": "https://api.github.com/users/gigamo"
|
37
|
+
},
|
38
|
+
{
|
39
|
+
"avatar_url": "https://secure.gravatar.com/avatar/67f6edecce4458e1f97764ad65fe5be9?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
|
40
|
+
"id": 62331,
|
41
|
+
"login": "stevehodgkiss",
|
42
|
+
"url": "https://api.github.com/users/stevehodgkiss"
|
43
|
+
},
|
44
|
+
{
|
45
|
+
"avatar_url": "https://secure.gravatar.com/avatar/582034b63279abeaa8e76acf12f5ee30?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
|
46
|
+
"id": 5004,
|
47
|
+
"login": "drogus",
|
48
|
+
"url": "https://api.github.com/users/drogus"
|
49
|
+
},
|
50
|
+
{
|
51
|
+
"avatar_url": "https://secure.gravatar.com/avatar/debde181b3a5925bb347193b7568de6d?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
|
52
|
+
"id": 1114,
|
53
|
+
"login": "digx",
|
54
|
+
"url": "https://api.github.com/users/digx"
|
55
|
+
},
|
56
|
+
{
|
57
|
+
"avatar_url": "https://secure.gravatar.com/avatar/63b09042812754c8e25faf71e3c3f09c?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
|
58
|
+
"id": 169271,
|
59
|
+
"login": "rubyorchard",
|
60
|
+
"url": "https://api.github.com/users/rubyorchard"
|
61
|
+
},
|
62
|
+
{
|
63
|
+
"avatar_url": "https://secure.gravatar.com/avatar/a434c7b2837e1d09bc1a32b17e3ca2a6?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
|
64
|
+
"id": 192933,
|
65
|
+
"login": "zhengjia",
|
66
|
+
"url": "https://api.github.com/users/zhengjia"
|
67
|
+
},
|
68
|
+
{
|
69
|
+
"avatar_url": "https://secure.gravatar.com/avatar/422a492216af1bcad85496da9c0657d3?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
|
70
|
+
"id": 12169,
|
71
|
+
"login": "sr3d",
|
72
|
+
"url": "https://api.github.com/users/sr3d"
|
73
|
+
},
|
74
|
+
{
|
75
|
+
"avatar_url": "https://secure.gravatar.com/avatar/40a0afa49eb7b12db4dcda70b2e1520d?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
|
76
|
+
"id": 215071,
|
77
|
+
"login": "kaapa",
|
78
|
+
"url": "https://api.github.com/users/kaapa"
|
79
|
+
},
|
80
|
+
{
|
81
|
+
"avatar_url": "https://secure.gravatar.com/avatar/1b9ab6d97d87242d04385928dd10d665?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
|
82
|
+
"id": 97366,
|
83
|
+
"login": "eXine",
|
84
|
+
"url": "https://api.github.com/users/eXine"
|
85
|
+
},
|
86
|
+
{
|
87
|
+
"avatar_url": "https://secure.gravatar.com/avatar/e21ea082781b0d150cfe15c3223549bf?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
|
88
|
+
"id": 158660,
|
89
|
+
"login": "simonomis",
|
90
|
+
"url": "https://api.github.com/users/simonomis"
|
91
|
+
},
|
92
|
+
{
|
93
|
+
"avatar_url": "https://secure.gravatar.com/avatar/7502b2ff04e7446bbc26a06081cbf5ed?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
|
94
|
+
"id": 101274,
|
95
|
+
"login": "brunomalvestuto",
|
96
|
+
"url": "https://api.github.com/users/brunomalvestuto"
|
97
|
+
},
|
98
|
+
{
|
99
|
+
"avatar_url": "https://secure.gravatar.com/avatar/e7a8287a95384365aebea228018e450b?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
|
100
|
+
"id": 105954,
|
101
|
+
"login": "galuto",
|
102
|
+
"url": "https://api.github.com/users/galuto"
|
103
|
+
},
|
104
|
+
{
|
105
|
+
"avatar_url": "https://secure.gravatar.com/avatar/254513687a01330ba0ae676538de459b?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
|
106
|
+
"id": 386,
|
107
|
+
"login": "brainopia",
|
108
|
+
"url": "https://api.github.com/users/brainopia"
|
109
|
+
},
|
110
|
+
{
|
111
|
+
"avatar_url": "https://secure.gravatar.com/avatar/e406931fbeece385c032f601968928b1?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
|
112
|
+
"id": 120809,
|
113
|
+
"login": "rozaliev",
|
114
|
+
"url": "https://api.github.com/users/rozaliev"
|
115
|
+
},
|
116
|
+
{
|
117
|
+
"avatar_url": "https://secure.gravatar.com/avatar/2a03308b3abcbb395a2825cfe3d5f710?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
|
118
|
+
"id": 6397,
|
119
|
+
"login": "lucasts",
|
120
|
+
"url": "https://api.github.com/users/lucasts"
|
121
|
+
},
|
122
|
+
{
|
123
|
+
"avatar_url": "https://secure.gravatar.com/avatar/c544188078900e5d5976689949177f11?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
|
124
|
+
"id": 11747,
|
125
|
+
"login": "slawosz",
|
126
|
+
"url": "https://api.github.com/users/slawosz"
|
127
|
+
},
|
128
|
+
{
|
129
|
+
"avatar_url": "https://secure.gravatar.com/avatar/ac6a1517accfdf91ef9c3906b19ff02c?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
|
130
|
+
"id": 6775,
|
131
|
+
"login": "shanlalit",
|
132
|
+
"url": "https://api.github.com/users/shanlalit"
|
133
|
+
},
|
134
|
+
{
|
135
|
+
"avatar_url": "https://secure.gravatar.com/avatar/a1bc8563b294df7078d1ce3d634f5d17?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
|
136
|
+
"id": 8074,
|
137
|
+
"login": "grigio",
|
138
|
+
"url": "https://api.github.com/users/grigio"
|
139
|
+
},
|
140
|
+
{
|
141
|
+
"avatar_url": "https://secure.gravatar.com/avatar/b6cf17bb9061afa615e86ce7f11da016?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
|
142
|
+
"id": 7192,
|
143
|
+
"login": "tokumine",
|
144
|
+
"url": "https://api.github.com/users/tokumine"
|
145
|
+
},
|
146
|
+
{
|
147
|
+
"avatar_url": "https://secure.gravatar.com/avatar/97822aeb6cea1c6b6e6a7170c6e96fd8?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
|
148
|
+
"id": 101310,
|
149
|
+
"login": "xlcrs",
|
150
|
+
"url": "https://api.github.com/users/xlcrs"
|
151
|
+
},
|
152
|
+
{
|
153
|
+
"avatar_url": "https://secure.gravatar.com/avatar/f08aeb02079e7f486b270e4ed094f638?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
|
154
|
+
"id": 755,
|
155
|
+
"login": "myabc",
|
156
|
+
"url": "https://api.github.com/users/myabc"
|
157
|
+
},
|
158
|
+
{
|
159
|
+
"avatar_url": "https://secure.gravatar.com/avatar/832ed6ace46d61032151f4e1864c057f?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
|
160
|
+
"id": 5091,
|
161
|
+
"login": "dmitry",
|
162
|
+
"url": "https://api.github.com/users/dmitry"
|
163
|
+
},
|
164
|
+
{
|
165
|
+
"avatar_url": "https://secure.gravatar.com/avatar/0945810eafa4ac5387084a7815488579?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
|
166
|
+
"id": 16054,
|
167
|
+
"login": "plukevdh",
|
168
|
+
"url": "https://api.github.com/users/plukevdh"
|
169
|
+
},
|
170
|
+
{
|
171
|
+
"avatar_url": "https://secure.gravatar.com/avatar/b444b54fb4349a617b68f55ed923ca7e?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
|
172
|
+
"id": 49547,
|
173
|
+
"login": "sunny36",
|
174
|
+
"url": "https://api.github.com/users/sunny36"
|
175
|
+
},
|
176
|
+
{
|
177
|
+
"avatar_url": "https://secure.gravatar.com/avatar/75cb325d7b55a6659fc050f6fa822c7c?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
|
178
|
+
"id": 1037,
|
179
|
+
"login": "zmack",
|
180
|
+
"url": "https://api.github.com/users/zmack"
|
181
|
+
}
|
182
182
|
]
|
@@ -0,0 +1,133 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
describe Octokit::Client::Gists do
|
5
|
+
|
6
|
+
before do
|
7
|
+
@username = "Oshuma"
|
8
|
+
@client = Octokit::Client.new(:login => @username)
|
9
|
+
end
|
10
|
+
|
11
|
+
describe ".public_gists" do
|
12
|
+
it "should return public gists" do
|
13
|
+
stub_get("/gists").to_return(:body => fixture("v3/public_gists.json"))
|
14
|
+
gists = @client.public_gists
|
15
|
+
gists.should_not be_empty
|
16
|
+
end
|
17
|
+
end # .public_gists
|
18
|
+
|
19
|
+
describe ".gists" do
|
20
|
+
context "with username passed" do
|
21
|
+
it "should return a list of gists" do
|
22
|
+
stub_get("/users/#{@username}/gists").
|
23
|
+
to_return(:body => fixture("v3/gists.json"))
|
24
|
+
gists = @client.gists(@username)
|
25
|
+
gists.first.user.login.should == @username
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context "without a username passed" do
|
30
|
+
it "should return a list of gists" do
|
31
|
+
stub_get("/gists").to_return(:body => fixture("v3/gists.json"))
|
32
|
+
gists = @client.gists
|
33
|
+
gists.first.user.login.should == @username
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end # .gists
|
37
|
+
|
38
|
+
describe ".starred_gists" do
|
39
|
+
it "should return the user's starred gists" do
|
40
|
+
stub_get("/gists/starred").to_return(:body => fixture("v3/starred_gists.json"))
|
41
|
+
gists = @client.starred_gists
|
42
|
+
gists.should_not be_empty
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe ".gist" do
|
47
|
+
it "should return the gist by ID" do
|
48
|
+
stub_get("/gists/1").to_return(:body => fixture("v3/gist.json"))
|
49
|
+
gist = @client.gist(1)
|
50
|
+
gist.user.login.should == @username
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
describe ".create_gist" do
|
55
|
+
it "should create a new gist" do
|
56
|
+
gist_content = JSON.parse(fixture("v3/gist.json").read)
|
57
|
+
new_gist = {
|
58
|
+
:description => gist_content['description'],
|
59
|
+
:public => gist_content['public'],
|
60
|
+
:files => gist_content['files'],
|
61
|
+
}
|
62
|
+
|
63
|
+
stub_post("/gists").with(new_gist).
|
64
|
+
to_return(:body => fixture("v3/gist.json"))
|
65
|
+
|
66
|
+
gist = @client.create_gist(new_gist)
|
67
|
+
gist.should == gist_content
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
describe ".edit_gist" do
|
72
|
+
it "should edit an existing gist" do
|
73
|
+
gist_content = JSON.parse(fixture("v3/gist.json").read)
|
74
|
+
gist_id = gist_content['id']
|
75
|
+
updated_gist = gist_content.merge(:description => 'updated')
|
76
|
+
|
77
|
+
stub_patch("/gists/#{gist_id}").
|
78
|
+
to_return(:body => updated_gist)
|
79
|
+
|
80
|
+
gist = @client.edit_gist(gist_id, :description => 'updated')
|
81
|
+
gist['description'].should == 'updated'
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
describe ".star_gist" do
|
86
|
+
it "should star an existing gist" do
|
87
|
+
stub_put("/gists/12345/star").to_return(:status => 204)
|
88
|
+
success = @client.star_gist(12345)
|
89
|
+
success.should be_true
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
describe ".unstar_gist" do
|
94
|
+
it "should unstar an existing gist" do
|
95
|
+
stub_delete("/gists/12345/star").to_return(:status => 204)
|
96
|
+
success = @client.unstar_gist(12345)
|
97
|
+
success.should be_true
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
describe ".gist_starred?" do
|
102
|
+
it "should be starred" do
|
103
|
+
stub_get("/gists/12345/star").to_return(:status => 204)
|
104
|
+
starred = @client.gist_starred?(12345)
|
105
|
+
starred.should be_true
|
106
|
+
end
|
107
|
+
|
108
|
+
it "should not be starred" do
|
109
|
+
stub_get("/gists/12345/star").to_return(:status => 404)
|
110
|
+
starred = @client.gist_starred?(12345)
|
111
|
+
starred.should be_false
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
describe ".fork_gist" do
|
116
|
+
it "should fork an existing gist" do
|
117
|
+
stub_post("/gists/12345/fork").
|
118
|
+
to_return(:body => fixture("v3/gist.json"))
|
119
|
+
|
120
|
+
gist = @client.fork_gist(12345)
|
121
|
+
gist.user.login.should == @username
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
describe ".delete_gist" do
|
126
|
+
it "should delete an existing gist" do
|
127
|
+
stub_delete("/gists/12345").to_return(:status => 204)
|
128
|
+
deleted = @client.delete_gist(12345)
|
129
|
+
deleted.should be_true
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
end
|