octokit 1.14.0 → 1.15.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -68,6 +68,26 @@ describe Octokit::Client::Repositories do
68
68
 
69
69
  end
70
70
 
71
+ describe ".star" do
72
+
73
+ it "should star a repository" do
74
+ stub_put("/user/starred/sferik/rails_admin").
75
+ to_return(:status => 204)
76
+ @client.star("sferik/rails_admin").should be_nil
77
+ end
78
+
79
+ end
80
+
81
+ describe ".unstar" do
82
+
83
+ it "should unstar a repository" do
84
+ stub_delete("/user/starred/sferik/rails_admin").
85
+ to_return(:status => 204)
86
+ @client.unstar("sferik/rails_admin").should be_nil
87
+ end
88
+
89
+ end
90
+
71
91
  describe ".watch" do
72
92
 
73
93
  it "should watch a repository" do
@@ -260,6 +280,17 @@ describe Octokit::Client::Repositories do
260
280
 
261
281
  end
262
282
 
283
+ describe ".stargazers" do
284
+
285
+ it "should return all repository stargazers" do
286
+ stub_get("/repos/sferik/rails_admin/stargazers").
287
+ to_return(:body => fixture("v3/stargazers.json"))
288
+ stargazers = @client.stargazers("sferik/rails_admin")
289
+ stargazers.first.login.should == "sferik"
290
+ end
291
+
292
+ end
293
+
263
294
  describe ".watchers" do
264
295
 
265
296
  it "should return all repository watchers" do
@@ -164,6 +164,58 @@ describe Octokit::Client::Users do
164
164
 
165
165
  end
166
166
 
167
+ describe ".starred?" do
168
+
169
+ context "with on user starring a repo" do
170
+
171
+ it "should return true" do
172
+ stub_get("https://api.github.com/user/starred/sferik/rails_admin").
173
+ to_return(:status => 204, :body => "")
174
+ starred = @client.starred?("sferik", "rails_admin")
175
+ starred.should be_true
176
+ end
177
+
178
+ end
179
+
180
+ context "with on user not starring a repo" do
181
+
182
+ it "should return false" do
183
+ stub_get("https://api.github.com/user/starred/sferik/dogbrainz").
184
+ to_return(:status => 404, :body => "")
185
+ starred = @client.starred?("sferik", "dogbrainz")
186
+ starred.should be_false
187
+ end
188
+
189
+ end
190
+
191
+ end
192
+
193
+ describe ".starred" do
194
+
195
+ context "with a username passed" do
196
+
197
+ it "should return starred repositories" do
198
+ stub_get("https://api.github.com/users/sferik/starred").
199
+ to_return(:body => fixture("v3/starred.json"))
200
+ repositories = @client.starred("sferik")
201
+ repositories.first.name.should == "grit"
202
+ end
203
+
204
+ end
205
+
206
+ context "without a username passed" do
207
+
208
+ it "should return starred repositories" do
209
+ stub_get("https://api.github.com/users/sferik/starred").
210
+ to_return(:body => fixture("v3/starred.json"))
211
+ repositories = @client.starred
212
+ repositories.first.name.should == "grit"
213
+ end
214
+
215
+ end
216
+
217
+ end
218
+
167
219
  describe ".watched" do
168
220
 
169
221
  context "with a username passed" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octokit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.14.0
4
+ version: 1.15.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-09-23 00:00:00.000000000 Z
14
+ date: 2012-09-24 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: addressable
@@ -329,6 +329,8 @@ files:
329
329
  - spec/fixtures/v3/repo_issues_events.json
330
330
  - spec/fixtures/v3/repositories.json
331
331
  - spec/fixtures/v3/repository.json
332
+ - spec/fixtures/v3/stargazers.json
333
+ - spec/fixtures/v3/starred.json
332
334
  - spec/fixtures/v3/starred_gists.json
333
335
  - spec/fixtures/v3/status.json
334
336
  - spec/fixtures/v3/statuses.json
@@ -465,6 +467,8 @@ test_files:
465
467
  - spec/fixtures/v3/repo_issues_events.json
466
468
  - spec/fixtures/v3/repositories.json
467
469
  - spec/fixtures/v3/repository.json
470
+ - spec/fixtures/v3/stargazers.json
471
+ - spec/fixtures/v3/starred.json
468
472
  - spec/fixtures/v3/starred_gists.json
469
473
  - spec/fixtures/v3/status.json
470
474
  - spec/fixtures/v3/statuses.json