octokit 1.23.0 → 1.24.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,14 +1,18 @@
1
- unless ENV['CI']
2
- require 'simplecov'
3
- SimpleCov.start do
4
- add_filter "/spec"
5
- end
6
- end
1
+ require 'simplecov'
2
+ require 'coveralls'
3
+
4
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
5
+ SimpleCov::Formatter::HTMLFormatter,
6
+ Coveralls::SimpleCov::Formatter
7
+ ]
8
+ SimpleCov.start
7
9
 
8
10
  require 'octokit'
9
11
  require 'rspec'
10
12
  require 'webmock/rspec'
11
13
 
14
+ WebMock.disable_net_connect!(:allow => 'coveralls.io')
15
+
12
16
  RSpec.configure do |config|
13
17
  config.expect_with :rspec do |c|
14
18
  c.syntax = :expect
@@ -35,6 +35,28 @@ describe Octokit::Client::Issues do
35
35
  end
36
36
 
37
37
  end
38
+
39
+ describe ".user_issues" do
40
+
41
+ it "returns issues for the authenticated user" do
42
+ stub_get("/user/issues").
43
+ to_return(json_response("user_issues.json"))
44
+ issues = @client.user_issues
45
+ expect(issues.first.number).to eq(43)
46
+ end
47
+
48
+ end
49
+
50
+ describe ".org_issues" do
51
+
52
+ it "returns issues for the organization" do
53
+ stub_get("/orgs/github/issues").
54
+ to_return(json_response("org_issues.json"))
55
+ issues = @client.org_issues('github')
56
+ expect(issues.first.number).to eq(43)
57
+ end
58
+
59
+ end
38
60
 
39
61
  describe ".create_issue" do
40
62
 
@@ -74,7 +96,7 @@ describe Octokit::Client::Issues do
74
96
  describe ".close_issue" do
75
97
 
76
98
  it "closes an issue" do
77
- stub_post("/repos/ctshryock/octokit/issues/12").
99
+ stub_patch("/repos/ctshryock/octokit/issues/12").
78
100
  with(:body => {"state" => "closed"},
79
101
  :headers => {'Content-Type'=>'application/json'}).
80
102
  to_return(json_response("issue_closed.json"))
@@ -89,7 +111,7 @@ describe Octokit::Client::Issues do
89
111
  describe ".reopen_issue" do
90
112
 
91
113
  it "reopens an issue" do
92
- stub_post("/repos/ctshryock/octokit/issues/12").
114
+ stub_patch("/repos/ctshryock/octokit/issues/12").
93
115
  with(:body => {"state" => "open"},
94
116
  :headers => {'Content-Type'=>'application/json'}).
95
117
  to_return(json_response("issue.json"))
@@ -103,7 +125,7 @@ describe Octokit::Client::Issues do
103
125
  describe ".update_issue" do
104
126
 
105
127
  it "updates an issue" do
106
- stub_post("/repos/ctshryock/octokit/issues/12").
128
+ stub_patch("/repos/ctshryock/octokit/issues/12").
107
129
  with(:body => {"title" => "Use all the v3 api!", "body" => ""},
108
130
  :headers => {'Content-Type'=>'application/json'}).
109
131
  to_return(json_response("issue.json"))
@@ -162,7 +184,7 @@ describe Octokit::Client::Issues do
162
184
  describe ".update_comment" do
163
185
 
164
186
  it "updates an existing comment" do
165
- stub_post("/repos/pengwynn/octokit/issues/comments/1194549").
187
+ stub_patch("/repos/pengwynn/octokit/issues/comments/1194549").
166
188
  with(:body => {"body" => "A test comment update"}).
167
189
  to_return(json_response('comment.json'))
168
190
  comment = @client.update_comment("pengwynn/octokit", 1194549, "A test comment update")
@@ -54,7 +54,7 @@ describe Octokit::Client::Labels do
54
54
  describe ".update_label" do
55
55
 
56
56
  it "updates a label with a new color" do
57
- stub_post("/repos/pengwynn/octokit/labels/V3+Addition").
57
+ stub_patch("/repos/pengwynn/octokit/labels/V3+Addition").
58
58
  with(:body => {"color" => "ededed"},
59
59
  :headers => {'Content-Type'=>'application/json'}).
60
60
  to_return(json_response('label.json'))
@@ -44,7 +44,7 @@ describe Octokit::Client::Milestones do
44
44
  describe ".update_milestone" do
45
45
 
46
46
  it "updates a milestone" do
47
- stub_post("/repos/pengwynn/octokit/milestones/1").
47
+ stub_patch("/repos/pengwynn/octokit/milestones/1").
48
48
  with(:body => {"description" => "Add support for API v3"}).
49
49
  to_return(json_response('milestone.json'))
50
50
  milestone = @client.update_milestone("pengwynn/octokit", 1, {:description => "Add support for API v3"})
@@ -23,7 +23,7 @@ describe Octokit::Client::Pulls do
23
23
  describe ".update_pull_request" do
24
24
 
25
25
  it "updates a pull request" do
26
- stub_post("https://api.github.com/repos/pengwynn/octokit/pulls/67").
26
+ stub_patch("https://api.github.com/repos/pengwynn/octokit/pulls/67").
27
27
  with(:pull => { :title => "New title", :body => "Updated body", :state => "closed"}).
28
28
  to_return(json_response('pull_update.json'))
29
29
  pull = @client.update_pull_request('pengwynn/octokit', 67, 'New title', 'Updated body', 'closed')
@@ -458,6 +458,17 @@ describe Octokit::Client::Repositories do
458
458
 
459
459
  end
460
460
 
461
+ describe ".check_assignee" do
462
+
463
+ it "checks to see if a particular user is an assignee for a repository" do
464
+ stub_get("/repos/pengwynn/octokit/assignees/andrew").
465
+ to_return(:status => 204)
466
+ is_assignee = @client.check_assignee("pengwynn/octokit", 'andrew')
467
+ expect(is_assignee).to eq(true)
468
+ end
469
+
470
+ end
471
+
461
472
  describe ".subscribers" do
462
473
 
463
474
  it "lists all the users watching the repository" do
@@ -299,6 +299,17 @@ describe Octokit::Client::Users do
299
299
  end
300
300
 
301
301
  end
302
+
303
+ describe ".user_keys" do
304
+
305
+ it "returns public keys for a user" do
306
+ stub_get("https://api.github.com/users/pengwynn/keys").
307
+ to_return(json_response("public_keys.json"))
308
+ public_keys = @client.user_keys 'pengwynn'
309
+ expect(public_keys.first.id).to eq(103205)
310
+ end
311
+
312
+ end
302
313
 
303
314
  describe ".add_key" do
304
315
 
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.23.0
4
+ version: 1.24.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: 2013-02-08 00:00:00.000000000 Z
14
+ date: 2013-03-24 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler
@@ -84,7 +84,7 @@ dependencies:
84
84
  requirements:
85
85
  - - ~>
86
86
  - !ruby/object:Gem::Version
87
- version: '1.2'
87
+ version: '2.0'
88
88
  type: :runtime
89
89
  prerelease: false
90
90
  version_requirements: !ruby/object:Gem::Requirement
@@ -92,7 +92,7 @@ dependencies:
92
92
  requirements:
93
93
  - - ~>
94
94
  - !ruby/object:Gem::Version
95
- version: '1.2'
95
+ version: '2.0'
96
96
  - !ruby/object:Gem::Dependency
97
97
  name: multi_json
98
98
  requirement: !ruby/object:Gem::Requirement
@@ -240,6 +240,7 @@ files:
240
240
  - spec/fixtures/not_found.json
241
241
  - spec/fixtures/notification_thread.json
242
242
  - spec/fixtures/notifications.json
243
+ - spec/fixtures/org_issues.json
243
244
  - spec/fixtures/organization-repositories.json
244
245
  - spec/fixtures/organization-repository.json
245
246
  - spec/fixtures/organization.json
@@ -303,6 +304,7 @@ files:
303
304
  - spec/fixtures/tree_create.json
304
305
  - spec/fixtures/user.json
305
306
  - spec/fixtures/user_events.json
307
+ - spec/fixtures/user_issues.json
306
308
  - spec/fixtures/user_performed_public_events.json
307
309
  - spec/fixtures/user_public_events.json
308
310
  - spec/fixtures/user_token.json
@@ -428,6 +430,7 @@ test_files:
428
430
  - spec/fixtures/not_found.json
429
431
  - spec/fixtures/notification_thread.json
430
432
  - spec/fixtures/notifications.json
433
+ - spec/fixtures/org_issues.json
431
434
  - spec/fixtures/organization-repositories.json
432
435
  - spec/fixtures/organization-repository.json
433
436
  - spec/fixtures/organization.json
@@ -491,6 +494,7 @@ test_files:
491
494
  - spec/fixtures/tree_create.json
492
495
  - spec/fixtures/user.json
493
496
  - spec/fixtures/user_events.json
497
+ - spec/fixtures/user_issues.json
494
498
  - spec/fixtures/user_performed_public_events.json
495
499
  - spec/fixtures/user_public_events.json
496
500
  - spec/fixtures/user_token.json