octokit 0.6.5 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +1 -2
- data/.travis.yml +0 -1
- data/CHANGELOG.md +1 -0
- data/Gemfile +1 -1
- data/README.md +41 -28
- data/Rakefile +11 -0
- data/lib/faraday/response/raise_octokit_error.rb +4 -2
- data/lib/octokit/client.rb +2 -0
- data/lib/octokit/client/commits.rb +12 -0
- data/lib/octokit/client/events.rb +26 -0
- data/lib/octokit/client/issues.rb +35 -7
- data/lib/octokit/client/labels.rb +5 -5
- data/lib/octokit/client/objects.rb +10 -6
- data/lib/octokit/client/organizations.rb +25 -21
- data/lib/octokit/client/pub_sub_hubbub/service_hooks.rb +2 -2
- data/lib/octokit/client/pulls.rb +4 -4
- data/lib/octokit/client/repositories.rb +18 -18
- data/lib/octokit/client/users.rb +19 -14
- data/lib/octokit/configuration.rb +14 -11
- data/lib/octokit/connection.rb +3 -3
- data/lib/octokit/request.rb +17 -1
- data/lib/octokit/version.rb +1 -1
- data/octokit.gemspec +13 -12
- data/spec/fixtures/v3/blob.json +7 -0
- data/spec/fixtures/v3/commit_comment.json +19 -0
- data/spec/fixtures/v3/commit_comments.json +78 -0
- data/spec/fixtures/v3/emails.json +4 -0
- data/spec/fixtures/v3/followers.json +212 -0
- data/spec/fixtures/v3/following.json +209 -0
- data/spec/fixtures/v3/issue.json +37 -0
- data/spec/fixtures/v3/issue_closed.json +37 -0
- data/spec/fixtures/v3/issue_event.json +44 -0
- data/spec/fixtures/v3/issue_events.json +72 -0
- data/spec/fixtures/v3/list_commit_comments.json +572 -0
- data/spec/fixtures/v3/organization-repositories.json +4292 -0
- data/spec/fixtures/v3/organization-repository.json +42 -0
- data/spec/fixtures/v3/organization.json +18 -0
- data/spec/fixtures/v3/organization_members.json +576 -0
- data/spec/fixtures/v3/organization_team_members.json +16 -0
- data/spec/fixtures/v3/organization_team_repos.json +62 -0
- data/spec/fixtures/v3/organizations.json +44 -0
- data/spec/fixtures/v3/public_events.json +1110 -0
- data/spec/fixtures/v3/pull_created.json +138 -0
- data/spec/fixtures/v3/pull_request.json +138 -0
- data/spec/fixtures/v3/pull_requests.json +187 -0
- data/spec/fixtures/v3/repo_events.json +1668 -0
- data/spec/fixtures/v3/repo_issues_events.json +134 -0
- data/spec/fixtures/v3/team.json +8 -0
- data/spec/fixtures/v3/teams.json +4 -4
- data/spec/fixtures/v3/tree.json +112 -0
- data/spec/fixtures/v3/watched.json +1022 -0
- data/spec/helper.rb +3 -3
- data/spec/octokit/client/commits_spec.rb +33 -0
- data/spec/octokit/client/events_spec.rb +27 -0
- data/spec/octokit/client/issue_events_spec.rb +30 -0
- data/spec/octokit/client/issues_spec.rb +31 -20
- data/spec/octokit/client/labels_spec.rb +1 -1
- data/spec/octokit/client/objects_spec.rb +9 -8
- data/spec/octokit/client/organizations_spec.rb +56 -67
- data/spec/octokit/client/pulls_spec.rb +19 -18
- data/spec/octokit/client/repositories_spec.rb +24 -38
- data/spec/octokit/client/users_spec.rb +50 -51
- data/spec/octokit/client_spec.rb +16 -0
- metadata +111 -81
- data/puppeteer.jpg +0 -0
- data/spec/fixtures/v2/blob.json +0 -1
- data/spec/fixtures/v2/comment.json +0 -1
- data/spec/fixtures/v2/comments.json +0 -1
- data/spec/fixtures/v2/delete_failure.json +0 -1
- data/spec/fixtures/v2/delete_token.json +0 -1
- data/spec/fixtures/v2/emails.json +0 -1
- data/spec/fixtures/v2/followers.json +0 -1
- data/spec/fixtures/v2/following.json +0 -1
- data/spec/fixtures/v2/issue.json +0 -1
- data/spec/fixtures/v2/labels.json +0 -1
- data/spec/fixtures/v2/organization.json +0 -1
- data/spec/fixtures/v2/organizations.json +0 -1
- data/spec/fixtures/v2/public_keys.json +0 -1
- data/spec/fixtures/v2/pull.json +0 -1
- data/spec/fixtures/v2/pulls.json +0 -1
- data/spec/fixtures/v2/tags.json +0 -1
- data/spec/fixtures/v2/team.json +0 -1
- data/spec/fixtures/v2/teams.json +0 -1
- data/spec/fixtures/v2/tree.json +0 -1
data/spec/helper.rb
CHANGED
@@ -29,4 +29,37 @@ describe Octokit::Client::Commits do
|
|
29
29
|
|
30
30
|
end
|
31
31
|
|
32
|
+
describe ".list_commit_comments" do
|
33
|
+
|
34
|
+
it "should return a list of all commit comments" do
|
35
|
+
stub_get("/repos/sferik/rails_admin/comments").
|
36
|
+
to_return(:body => fixture("v3/list_commit_comments.json"))
|
37
|
+
commit_comments = @client.list_commit_comments("sferik/rails_admin")
|
38
|
+
commit_comments.first.user.login.should == "sferik"
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
describe ".commit_comments" do
|
44
|
+
|
45
|
+
it "should return a list of comments for a specific commit" do
|
46
|
+
stub_get("/repos/sferik/rails_admin/commits/629e9fd9d4df25528e84d31afdc8ebeb0f56fbb3/comments").
|
47
|
+
to_return(:body => fixture("v3/commit_comments.json"))
|
48
|
+
commit_comments = @client.commit_comments("sferik/rails_admin", "629e9fd9d4df25528e84d31afdc8ebeb0f56fbb3")
|
49
|
+
commit_comments.first.user.login.should == "bbenezech"
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
describe ".commit_comment" do
|
55
|
+
|
56
|
+
it "should return a single commit comment" do
|
57
|
+
stub_get("/repos/sferik/rails_admin/comments/861907").
|
58
|
+
to_return(:body => fixture("v3/commit_comment.json"))
|
59
|
+
commit = @client.commit_comment("sferik/rails_admin", "861907")
|
60
|
+
commit.user.login.should == "bbenezech"
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
32
65
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
describe Octokit::Client::Events do
|
5
|
+
before do
|
6
|
+
@client = Octokit::Client.new(:login => 'sferik')
|
7
|
+
end
|
8
|
+
|
9
|
+
describe ".public_events" do
|
10
|
+
it "should return all public events" do
|
11
|
+
stub_get("/events").
|
12
|
+
to_return(:body => fixture("v3/public_events.json"))
|
13
|
+
public_events = @client.public_events
|
14
|
+
public_events.first.id.should == '1513284759'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe ".repository_events" do
|
19
|
+
it "should return events for a repository" do
|
20
|
+
stub_get("/repos/sferik/rails_admin/events").
|
21
|
+
to_return(:body => fixture("v3/repo_events.json"))
|
22
|
+
repo_events = @client.repository_events("sferik/rails_admin")
|
23
|
+
repo_events.first.type.should == "IssuesEvent"
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
describe Octokit::Client::Issues do
|
5
|
+
|
6
|
+
before do
|
7
|
+
@client = Octokit::Client.new(:login => 'sferik')
|
8
|
+
end
|
9
|
+
|
10
|
+
describe ".issue_events" do
|
11
|
+
|
12
|
+
it "should list events for an issue" do
|
13
|
+
stub_get("/repos/pengwynn/octokit/issues/38/events").
|
14
|
+
to_return(:body => fixture("v3/issue_events.json"))
|
15
|
+
events = @client.issue_events("pengwynn/octokit", 38)
|
16
|
+
events.first.event.should == "mentioned"
|
17
|
+
events.last.actor.login.should == "ctshryock"
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should get a single event" do
|
21
|
+
stub_get("/repos/pengwynn/octokit/issues/events/3094334").
|
22
|
+
to_return(:body => fixture("v3/issue_event.json"))
|
23
|
+
events = @client.issue_event("pengwynn/octokit", 3094334)
|
24
|
+
events.actor.login.should == "sferik"
|
25
|
+
events.event.should == "closed"
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
@@ -32,10 +32,12 @@ describe Octokit::Client::Issues do
|
|
32
32
|
describe ".create_issue" do
|
33
33
|
|
34
34
|
it "should create an issue" do
|
35
|
-
stub_post("
|
36
|
-
|
37
|
-
|
38
|
-
|
35
|
+
stub_post("/repos/ctshryock/octokit/issues").
|
36
|
+
with(:body => {"title" => "Migrate issues to v3", "body" => "Move all Issues calls to v3 of the API"},
|
37
|
+
:headers => {'Content-Type'=>'application/json'}).
|
38
|
+
to_return(:body => fixture("v3/issue.json"))
|
39
|
+
issue = @client.create_issue("ctshryock/octokit", "Migrate issues to v3", "Move all Issues calls to v3 of the API")
|
40
|
+
issue.number.should == 12
|
39
41
|
end
|
40
42
|
|
41
43
|
end
|
@@ -43,10 +45,10 @@ describe Octokit::Client::Issues do
|
|
43
45
|
describe ".issue" do
|
44
46
|
|
45
47
|
it "should return an issue" do
|
46
|
-
stub_get("
|
47
|
-
to_return(:body => fixture("
|
48
|
-
issue = @client.issue("
|
49
|
-
issue.number.should ==
|
48
|
+
stub_get("/repos/ctshryock/octokit/issues/12").
|
49
|
+
to_return(:body => fixture("v3/issue.json"))
|
50
|
+
issue = @client.issue("ctshryock/octokit", 12)
|
51
|
+
issue.number.should == 12
|
50
52
|
end
|
51
53
|
|
52
54
|
end
|
@@ -54,10 +56,14 @@ describe Octokit::Client::Issues do
|
|
54
56
|
describe ".close_issue" do
|
55
57
|
|
56
58
|
it "should close an issue" do
|
57
|
-
stub_post("
|
58
|
-
|
59
|
-
|
60
|
-
|
59
|
+
stub_post("/repos/ctshryock/octokit/issues/12").
|
60
|
+
with(:body => {"state" => "closed"},
|
61
|
+
:headers => {'Content-Type'=>'application/json'}).
|
62
|
+
to_return(:body => fixture("v3/issue_closed.json"))
|
63
|
+
issue = @client.close_issue("ctshryock/octokit", 12)
|
64
|
+
issue.number.should == 12
|
65
|
+
issue.should include :closed_at
|
66
|
+
issue.state.should == "closed"
|
61
67
|
end
|
62
68
|
|
63
69
|
end
|
@@ -65,10 +71,13 @@ describe Octokit::Client::Issues do
|
|
65
71
|
describe ".reopen_issue" do
|
66
72
|
|
67
73
|
it "should reopen an issue" do
|
68
|
-
stub_post("
|
69
|
-
|
70
|
-
|
71
|
-
|
74
|
+
stub_post("/repos/ctshryock/octokit/issues/12").
|
75
|
+
with(:body => {"state" => "open"},
|
76
|
+
:headers => {'Content-Type'=>'application/json'}).
|
77
|
+
to_return(:body => fixture("v3/issue.json"))
|
78
|
+
issue = @client.reopen_issue("ctshryock/octokit", 12)
|
79
|
+
issue.number.should == 12
|
80
|
+
issue.state.should == "open"
|
72
81
|
end
|
73
82
|
|
74
83
|
end
|
@@ -76,10 +85,12 @@ describe Octokit::Client::Issues do
|
|
76
85
|
describe ".update_issue" do
|
77
86
|
|
78
87
|
it "should update an issue" do
|
79
|
-
stub_post("
|
80
|
-
|
81
|
-
|
82
|
-
|
88
|
+
stub_post("/repos/ctshryock/octokit/issues/12").
|
89
|
+
with(:body => {"title" => "Use all the v3 api!", "body" => ""},
|
90
|
+
:headers => {'Content-Type'=>'application/json'}).
|
91
|
+
to_return(:body => fixture("v3/issue.json"))
|
92
|
+
issue = @client.update_issue("ctshryock/octokit", 12, "Use all the v3 api!", "")
|
93
|
+
issue.number.should == 12
|
83
94
|
end
|
84
95
|
|
85
96
|
end
|
@@ -10,10 +10,11 @@ describe Octokit::Client::Objects do
|
|
10
10
|
describe ".tree" do
|
11
11
|
|
12
12
|
it "should return a tree" do
|
13
|
-
stub_get("https://github.com/
|
14
|
-
to_return(:body => fixture("
|
15
|
-
|
16
|
-
|
13
|
+
stub_get("https://api.github.com/repos/sferik/rails_admin/git/trees/3cdfabd973bc3caac209cba903cfdb3bf6636bcd").
|
14
|
+
to_return(:body => fixture("v3/tree.json"))
|
15
|
+
result = @client.tree("sferik/rails_admin", "3cdfabd973bc3caac209cba903cfdb3bf6636bcd")
|
16
|
+
result.sha.should == "3cdfabd973bc3caac209cba903cfdb3bf6636bcd"
|
17
|
+
result.tree.first.path.should == ".gitignore"
|
17
18
|
end
|
18
19
|
|
19
20
|
end
|
@@ -21,10 +22,10 @@ describe Octokit::Client::Objects do
|
|
21
22
|
describe ".blob" do
|
22
23
|
|
23
24
|
it "should return a blob" do
|
24
|
-
stub_get("https://github.com/
|
25
|
-
to_return(:body => fixture("
|
26
|
-
blob = @client.blob("sferik/rails_admin", "
|
27
|
-
blob.
|
25
|
+
stub_get("https://api.github.com/repos/sferik/rails_admin/git/blobs/94616fa57520ac8147522c7cf9f03d555595c5ea").
|
26
|
+
to_return(:body => fixture("v3/blob.json"))
|
27
|
+
blob = @client.blob("sferik/rails_admin", "94616fa57520ac8147522c7cf9f03d555595c5ea")
|
28
|
+
blob.sha.should == "94616fa57520ac8147522c7cf9f03d555595c5ea"
|
28
29
|
end
|
29
30
|
|
30
31
|
end
|
@@ -10,8 +10,8 @@ describe Octokit::Client::Organizations do
|
|
10
10
|
describe ".organization" do
|
11
11
|
|
12
12
|
it "should return an organization" do
|
13
|
-
stub_get("https://github.com/
|
14
|
-
to_return(:body => fixture("
|
13
|
+
stub_get("https://api.github.com/orgs/codeforamerica").
|
14
|
+
to_return(:body => fixture("v3/organization.json"))
|
15
15
|
organization = @client.organization("codeforamerica")
|
16
16
|
organization.name.should == "Code For America"
|
17
17
|
end
|
@@ -21,9 +21,9 @@ describe Octokit::Client::Organizations do
|
|
21
21
|
describe ".update_organization" do
|
22
22
|
|
23
23
|
it "should update an organization" do
|
24
|
-
|
24
|
+
stub_patch("https://api.github.com/orgs/codeforamerica").
|
25
25
|
with(:name => "Code For America").
|
26
|
-
to_return(:body => fixture("
|
26
|
+
to_return(:body => fixture("v3/organization.json"))
|
27
27
|
organization = @client.update_organization("codeforamerica", {:name => "Code For America"})
|
28
28
|
organization.name.should == "Code For America"
|
29
29
|
end
|
@@ -32,24 +32,24 @@ describe Octokit::Client::Organizations do
|
|
32
32
|
|
33
33
|
describe ".organizations" do
|
34
34
|
|
35
|
-
context "with
|
35
|
+
context "with a user passed" do
|
36
36
|
|
37
37
|
it "should return all organizations for a user" do
|
38
|
-
stub_get("https://github.com/
|
39
|
-
to_return(:body => fixture("
|
38
|
+
stub_get("https://api.github.com/users/sferik/orgs").
|
39
|
+
to_return(:body => fixture("v3/organizations.json"))
|
40
40
|
organizations = @client.organizations("sferik")
|
41
|
-
organizations.first.
|
41
|
+
organizations.first.login.should == "Hubcap"
|
42
42
|
end
|
43
43
|
|
44
44
|
end
|
45
45
|
|
46
|
-
context "without
|
46
|
+
context "without user passed" do
|
47
47
|
|
48
48
|
it "should return all organizations for a user" do
|
49
|
-
stub_get("https://github.com/
|
50
|
-
to_return(:body => fixture("
|
49
|
+
stub_get("https://api.github.com/user/orgs").
|
50
|
+
to_return(:body => fixture("v3/organizations.json"))
|
51
51
|
organizations = @client.organizations
|
52
|
-
organizations.first.
|
52
|
+
organizations.first.login.should == "Hubcap"
|
53
53
|
end
|
54
54
|
|
55
55
|
end
|
@@ -61,10 +61,10 @@ describe Octokit::Client::Organizations do
|
|
61
61
|
context "with an org passed" do
|
62
62
|
|
63
63
|
it "should return all public repositories for an organization" do
|
64
|
-
stub_get("https://github.com/
|
65
|
-
to_return(:body => fixture("
|
64
|
+
stub_get("https://api.github.com/orgs/codeforamerica/repos").
|
65
|
+
to_return(:body => fixture("v3/organization-repositories.json"))
|
66
66
|
repositories = @client.organization_repositories("codeforamerica")
|
67
|
-
repositories.first.name.should == "
|
67
|
+
repositories.first.name.should == "cfahelloworld"
|
68
68
|
end
|
69
69
|
|
70
70
|
end
|
@@ -75,7 +75,7 @@ describe Octokit::Client::Organizations do
|
|
75
75
|
stub_get("https://github.com/api/v2/json/organizations/repositories").
|
76
76
|
to_return(:body => fixture("v2/repositories.json"))
|
77
77
|
repositories = @client.organization_repositories
|
78
|
-
repositories.first.name.should == "One40Proof"
|
78
|
+
repositories.repositories.first.name.should == "One40Proof"
|
79
79
|
end
|
80
80
|
|
81
81
|
end
|
@@ -85,10 +85,10 @@ describe Octokit::Client::Organizations do
|
|
85
85
|
describe ".organization_members" do
|
86
86
|
|
87
87
|
it "should return all public members of an organization" do
|
88
|
-
stub_get("https://github.com/
|
89
|
-
to_return(:body => fixture("
|
88
|
+
stub_get("https://api.github.com/orgs/codeforamerica/members").
|
89
|
+
to_return(:body => fixture("v3/organization_members.json"))
|
90
90
|
users = @client.organization_members("codeforamerica")
|
91
|
-
users.first.
|
91
|
+
users.first.login.should == "akit"
|
92
92
|
end
|
93
93
|
|
94
94
|
end
|
@@ -96,8 +96,8 @@ describe Octokit::Client::Organizations do
|
|
96
96
|
describe ".organization_teams" do
|
97
97
|
|
98
98
|
it "should return all teams for an organization" do
|
99
|
-
stub_get("https://github.com/
|
100
|
-
to_return(:body => fixture("
|
99
|
+
stub_get("https://api.github.com/orgs/codeforamerica/teams").
|
100
|
+
to_return(:body => fixture("v3/teams.json"))
|
101
101
|
teams = @client.organization_teams("codeforamerica")
|
102
102
|
teams.first.name.should == "Fellows"
|
103
103
|
end
|
@@ -107,9 +107,9 @@ describe Octokit::Client::Organizations do
|
|
107
107
|
describe ".create_team" do
|
108
108
|
|
109
109
|
it "should create a team" do
|
110
|
-
stub_post("https://github.com/
|
110
|
+
stub_post("https://api.github.com/orgs/codeforamerica/teams").
|
111
111
|
with(:name => "Fellows").
|
112
|
-
to_return(:body => fixture("
|
112
|
+
to_return(:body => fixture("v3/team.json"))
|
113
113
|
team = @client.create_team("codeforamerica", {:name => "Fellows"})
|
114
114
|
team.name.should == "Fellows"
|
115
115
|
end
|
@@ -119,8 +119,8 @@ describe Octokit::Client::Organizations do
|
|
119
119
|
describe ".team" do
|
120
120
|
|
121
121
|
it "should return a team" do
|
122
|
-
stub_get("https://github.com/
|
123
|
-
to_return(:body => fixture("
|
122
|
+
stub_get("https://api.github.com/teams/32598").
|
123
|
+
to_return(:body => fixture("v3/team.json"))
|
124
124
|
team = @client.team(32598)
|
125
125
|
team.name.should == "Fellows"
|
126
126
|
end
|
@@ -130,9 +130,9 @@ describe Octokit::Client::Organizations do
|
|
130
130
|
describe ".update_team" do
|
131
131
|
|
132
132
|
it "should update a team" do
|
133
|
-
|
133
|
+
stub_patch("https://api.github.com/teams/32598").
|
134
134
|
with(:name => "Fellows").
|
135
|
-
to_return(:body => fixture("
|
135
|
+
to_return(:body => fixture("v3/team.json"))
|
136
136
|
team = @client.update_team(32598, :name => "Fellows")
|
137
137
|
team.name.should == "Fellows"
|
138
138
|
end
|
@@ -142,32 +142,22 @@ describe Octokit::Client::Organizations do
|
|
142
142
|
describe ".delete_team" do
|
143
143
|
|
144
144
|
it "should delete a team" do
|
145
|
-
stub_delete("https://github.com/
|
146
|
-
to_return(:
|
147
|
-
|
148
|
-
|
145
|
+
stub_delete("https://api.github.com/teams/32598").
|
146
|
+
to_return(:status => 204)
|
147
|
+
result = @client.delete_team(32598)
|
148
|
+
result.status.should == 204
|
149
149
|
end
|
150
150
|
|
151
151
|
end
|
152
152
|
|
153
|
-
describe ".delete_team" do
|
154
|
-
|
155
|
-
it "should delete a team" do
|
156
|
-
stub_delete("https://github.com/api/v2/json/teams/32598").
|
157
|
-
to_return(:body => fixture("v2/team.json"))
|
158
|
-
team = @client.delete_team(32598)
|
159
|
-
team.name.should == "Fellows"
|
160
|
-
end
|
161
|
-
|
162
|
-
end
|
163
153
|
|
164
154
|
describe ".team_members" do
|
165
155
|
|
166
156
|
it "should return team members" do
|
167
|
-
stub_get("https://github.com/
|
168
|
-
to_return(:body => fixture("
|
169
|
-
users = @client.team_members(
|
170
|
-
users.first.
|
157
|
+
stub_get("https://api.github.com/teams/33239/members").
|
158
|
+
to_return(:body => fixture("v3/organization_team_members.json"))
|
159
|
+
users = @client.team_members(33239)
|
160
|
+
users.first.login.should == "ctshryock"
|
171
161
|
end
|
172
162
|
|
173
163
|
end
|
@@ -175,11 +165,11 @@ describe Octokit::Client::Organizations do
|
|
175
165
|
describe ".add_team_member" do
|
176
166
|
|
177
167
|
it "should add a team member" do
|
178
|
-
|
168
|
+
stub_put("https://api.github.com/teams/32598/members/sferik").
|
179
169
|
with(:name => "sferik").
|
180
|
-
to_return(:
|
181
|
-
|
182
|
-
|
170
|
+
to_return(:status => 204)
|
171
|
+
result = @client.add_team_member(32598, "sferik")
|
172
|
+
result.should be_true
|
183
173
|
end
|
184
174
|
|
185
175
|
end
|
@@ -187,11 +177,10 @@ describe Octokit::Client::Organizations do
|
|
187
177
|
describe ".remove_team_member" do
|
188
178
|
|
189
179
|
it "should remove a team member" do
|
190
|
-
stub_delete("https://github.com/
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
user.name.should == "Erik Michaels-Ober"
|
180
|
+
stub_delete("https://api.github.com/teams/32598/members/sferik").
|
181
|
+
to_return(:status => 204)
|
182
|
+
result = @client.remove_team_member(32598, "sferik")
|
183
|
+
result.should be_true
|
195
184
|
end
|
196
185
|
|
197
186
|
end
|
@@ -199,10 +188,11 @@ describe Octokit::Client::Organizations do
|
|
199
188
|
describe ".team_repositories" do
|
200
189
|
|
201
190
|
it "should return team repositories" do
|
202
|
-
stub_get("https://github.com/
|
203
|
-
to_return(:body => fixture("
|
204
|
-
repositories = @client.team_repositories(
|
205
|
-
repositories.first.name.should == "
|
191
|
+
stub_get("https://api.github.com/teams/33239/repos").
|
192
|
+
to_return(:body => fixture("v3/organization_team_repos.json"))
|
193
|
+
repositories = @client.team_repositories(33239)
|
194
|
+
repositories.first.name.should == "GitTalk"
|
195
|
+
repositories.first.owner.id.should == 570695
|
206
196
|
end
|
207
197
|
|
208
198
|
end
|
@@ -210,11 +200,11 @@ describe Octokit::Client::Organizations do
|
|
210
200
|
describe ".add_team_repository" do
|
211
201
|
|
212
202
|
it "should add a team repository" do
|
213
|
-
|
203
|
+
stub_put("https://api.github.com/teams/32598/repos/reddavis/One40Proof").
|
214
204
|
with(:name => "reddavis/One40Proof").
|
215
|
-
to_return(:
|
216
|
-
|
217
|
-
|
205
|
+
to_return(:status => 204)
|
206
|
+
result = @client.add_team_repository(32598, "reddavis/One40Proof")
|
207
|
+
result.should be_true
|
218
208
|
end
|
219
209
|
|
220
210
|
end
|
@@ -222,11 +212,10 @@ describe Octokit::Client::Organizations do
|
|
222
212
|
describe ".remove_team_repository" do
|
223
213
|
|
224
214
|
it "should remove a team repository" do
|
225
|
-
stub_delete("https://github.com/
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
repositories.first.name.should == "One40Proof"
|
215
|
+
stub_delete("https://api.github.com/teams/32598/repos/reddavis/One40Proof").
|
216
|
+
to_return(:status => 204)
|
217
|
+
result = @client.remove_team_repository(32598, "reddavis/One40Proof")
|
218
|
+
result.should be_true
|
230
219
|
end
|
231
220
|
|
232
221
|
end
|