github_api 0.4.11 → 0.5.0.rc1
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.
- data/README.md +76 -72
- data/features/cassettes/gists/starred.yml +48 -0
- data/features/cassettes/pagination/repos/commits/list.yml +193 -0
- data/features/cassettes/pagination/repos/commits/next.yml +183 -0
- data/features/cassettes/pagination/repos/diff/next.yml +45 -0
- data/features/cassettes/pagination/repos/list.yml +176 -0
- data/features/cassettes/pagination/repos/list/next.yml +222 -0
- data/features/cassettes/pagination/repos/per_page/each_page.yml +45 -0
- data/features/cassettes/repos/list.yml +92 -0
- data/features/error_codes.feature +1 -1
- data/features/gists.feature +12 -3
- data/features/gists/comments.feature +3 -3
- data/features/github_api.feature +13 -2
- data/features/pagination.feature +40 -39
- data/features/repos.feature +2 -2
- data/features/step_definitions/common_steps.rb +12 -0
- data/features/step_definitions/github_api_steps.rb +12 -1
- data/lib/github_api.rb +1 -1
- data/lib/github_api/api.rb +4 -2
- data/lib/github_api/api_factory.rb +11 -5
- data/lib/github_api/authorizations.rb +23 -32
- data/lib/github_api/client.rb +1 -0
- data/lib/github_api/events.rb +38 -38
- data/lib/github_api/filter.rb +1 -1
- data/lib/github_api/gists.rb +47 -42
- data/lib/github_api/gists/comments.rb +77 -84
- data/lib/github_api/git_data.rb +25 -6
- data/lib/github_api/git_data/blobs.rb +48 -45
- data/lib/github_api/git_data/commits.rb +76 -73
- data/lib/github_api/git_data/references.rb +137 -118
- data/lib/github_api/git_data/tags.rb +74 -70
- data/lib/github_api/git_data/trees.rb +88 -85
- data/lib/github_api/issues.rb +43 -31
- data/lib/github_api/issues/comments.rb +116 -119
- data/lib/github_api/issues/events.rb +20 -19
- data/lib/github_api/issues/labels.rb +200 -197
- data/lib/github_api/issues/milestones.rb +137 -134
- data/lib/github_api/orgs.rb +27 -23
- data/lib/github_api/orgs/members.rb +105 -108
- data/lib/github_api/orgs/teams.rb +236 -237
- data/lib/github_api/paged_request.rb +1 -1
- data/lib/github_api/pull_requests.rb +40 -42
- data/lib/github_api/pull_requests/comments.rb +140 -143
- data/lib/github_api/repos.rb +101 -67
- data/lib/github_api/repos/collaborators.rb +64 -68
- data/lib/github_api/repos/commits.rb +50 -39
- data/lib/github_api/repos/downloads.rb +107 -110
- data/lib/github_api/repos/forks.rb +38 -39
- data/lib/github_api/repos/hooks.rb +161 -167
- data/lib/github_api/repos/keys.rb +86 -86
- data/lib/github_api/repos/pub_sub_hubbub.rb +99 -87
- data/lib/github_api/repos/watching.rb +80 -82
- data/lib/github_api/request.rb +5 -9
- data/lib/github_api/users.rb +26 -16
- data/lib/github_api/users/emails.rb +47 -47
- data/lib/github_api/users/followers.rb +85 -86
- data/lib/github_api/users/keys.rb +73 -75
- data/lib/github_api/validations.rb +25 -0
- data/lib/github_api/validations/format.rb +23 -0
- data/lib/github_api/validations/presence.rb +25 -0
- data/lib/github_api/validations/required.rb +21 -0
- data/lib/github_api/validations/token.rb +41 -0
- data/lib/github_api/version.rb +3 -3
- data/spec/fixtures/repos/commit_comparison.json +112 -0
- data/spec/github/api_factory_spec.rb +17 -1
- data/spec/github/authorizations_spec.rb +36 -34
- data/spec/github/gists/comments_spec.rb +39 -45
- data/spec/github/gists_spec.rb +50 -53
- data/spec/github/git_data/blobs_spec.rb +27 -20
- data/spec/github/git_data/commits_spec.rb +20 -19
- data/spec/github/git_data/references_spec.rb +83 -46
- data/spec/github/git_data/tags_spec.rb +16 -15
- data/spec/github/git_data/trees_spec.rb +20 -19
- data/spec/github/git_data_spec.rb +10 -1
- data/spec/github/issues/comments_spec.rb +78 -68
- data/spec/github/issues/events_spec.rb +42 -34
- data/spec/github/issues/labels_spec.rb +89 -101
- data/spec/github/issues/milestones_spec.rb +76 -54
- data/spec/github/issues_spec.rb +53 -57
- data/spec/github/orgs/members_spec.rb +64 -49
- data/spec/github/orgs/teams_spec.rb +112 -101
- data/spec/github/orgs_spec.rb +41 -31
- data/spec/github/paged_request_spec.rb +6 -5
- data/spec/github/pull_requests/comments_spec.rb +39 -44
- data/spec/github/pull_requests_spec.rb +32 -48
- data/spec/github/repos/collaborators_spec.rb +40 -29
- data/spec/github/repos/commits_spec.rb +108 -64
- data/spec/github/repos/downloads_spec.rb +46 -45
- data/spec/github/repos/forks_spec.rb +23 -24
- data/spec/github/repos/hooks_spec.rb +69 -71
- data/spec/github/repos/keys_spec.rb +39 -34
- data/spec/github/repos/pub_sub_hubbub_spec.rb +4 -4
- data/spec/github/repos/watching_spec.rb +31 -33
- data/spec/github/repos_spec.rb +74 -83
- data/spec/github/request_spec.rb +31 -2
- data/spec/github/users/emails_spec.rb +19 -17
- data/spec/github/users/followers_spec.rb +30 -28
- data/spec/github/users/keys_spec.rb +37 -33
- data/spec/github/users_spec.rb +124 -125
- data/spec/github/validations/format_spec.rb +42 -0
- data/spec/github/validations/presence_spec.rb +18 -0
- data/spec/github/validations/required_spec.rb +28 -0
- data/spec/github/validations/token_spec.rb +19 -0
- data/spec/github/validations_spec.rb +23 -0
- metadata +33 -10
- data/features/cassettes/pagination/repos.yml +0 -177
- data/features/cassettes/pagination/repos/next.yml +0 -177
- data/lib/github_api/validation.rb +0 -53
- data/spec/github/validation_spec.rb +0 -62
|
@@ -5,123 +5,131 @@ describe Github::Orgs::Members do
|
|
|
5
5
|
let(:member) { 'peter-murach' }
|
|
6
6
|
let(:org) { 'github' }
|
|
7
7
|
|
|
8
|
-
after {
|
|
8
|
+
after { reset_authentication_for github }
|
|
9
|
+
|
|
10
|
+
describe "#list" do
|
|
11
|
+
it { github.orgs.members.should respond_to :all }
|
|
9
12
|
|
|
10
|
-
describe "members" do
|
|
11
13
|
context "resource found" do
|
|
12
14
|
before do
|
|
13
15
|
stub_get("/orgs/#{org}/members").
|
|
14
|
-
to_return(:body => fixture('orgs/members.json'), :status => 200,
|
|
16
|
+
to_return(:body => fixture('orgs/members.json'), :status => 200,
|
|
17
|
+
:headers => {:content_type => "application/json; charset=utf-8"})
|
|
15
18
|
end
|
|
16
19
|
|
|
17
20
|
it "should fail to get resource without org name" do
|
|
18
|
-
expect { github.orgs.members }.to raise_error(ArgumentError)
|
|
21
|
+
expect { github.orgs.members.list nil }.to raise_error(ArgumentError)
|
|
19
22
|
end
|
|
20
23
|
|
|
21
24
|
it "should get the resources" do
|
|
22
|
-
github.orgs.members org
|
|
25
|
+
github.orgs.members.list org
|
|
23
26
|
a_get("/orgs/#{org}/members").should have_been_made
|
|
24
27
|
end
|
|
25
28
|
|
|
26
29
|
it "should return array of resources" do
|
|
27
|
-
members = github.orgs.members org
|
|
30
|
+
members = github.orgs.members.list org
|
|
28
31
|
members.should be_an Array
|
|
29
32
|
members.should have(1).items
|
|
30
33
|
end
|
|
31
34
|
|
|
32
35
|
it "should be a mash type" do
|
|
33
|
-
members = github.orgs.members org
|
|
36
|
+
members = github.orgs.members.list org
|
|
34
37
|
members.first.should be_a Hashie::Mash
|
|
35
38
|
end
|
|
36
39
|
|
|
37
40
|
it "should get members information" do
|
|
38
|
-
members = github.orgs.members org
|
|
41
|
+
members = github.orgs.members.list org
|
|
39
42
|
members.first.login.should == 'octocat'
|
|
40
43
|
end
|
|
41
44
|
|
|
42
45
|
it "should yield to a block" do
|
|
43
|
-
github.orgs.should_receive(:
|
|
44
|
-
github.orgs.members(org) { |param| 'web' }
|
|
46
|
+
github.orgs.members.should_receive(:list).with(org).and_yield('web')
|
|
47
|
+
github.orgs.members.list(org) { |param| 'web' }
|
|
45
48
|
end
|
|
46
49
|
end
|
|
47
50
|
|
|
48
51
|
context "resource not found" do
|
|
49
52
|
before do
|
|
50
53
|
stub_get("/orgs/#{org}/members").
|
|
51
|
-
to_return(:body => fixture('orgs/members.json'), :status => 404,
|
|
54
|
+
to_return(:body => fixture('orgs/members.json'), :status => 404,
|
|
55
|
+
:headers => {:content_type => "application/json; charset=utf-8"})
|
|
52
56
|
end
|
|
53
57
|
|
|
54
58
|
it "should return 404 with a message 'Not Found'" do
|
|
55
59
|
expect {
|
|
56
|
-
github.orgs.members org
|
|
60
|
+
github.orgs.members.list org
|
|
57
61
|
}.to raise_error(Github::Error::NotFound)
|
|
58
62
|
end
|
|
59
63
|
end
|
|
60
|
-
end #
|
|
64
|
+
end # list
|
|
61
65
|
|
|
62
|
-
describe "member?" do
|
|
66
|
+
describe "#member?" do
|
|
63
67
|
context "with username ane reponame passed" do
|
|
64
68
|
context "this repo is being watched by the user"
|
|
65
69
|
before do
|
|
66
70
|
stub_get("/orgs/#{org}/members/#{member}").
|
|
67
|
-
to_return(:body => "", :status => 404,
|
|
71
|
+
to_return(:body => "", :status => 404,
|
|
72
|
+
:headers => {:user_agent => github.user_agent})
|
|
68
73
|
end
|
|
69
74
|
|
|
70
75
|
it "should return false if resource not found" do
|
|
71
|
-
membership = github.orgs.member? org, member
|
|
76
|
+
membership = github.orgs.members.member? org, member
|
|
72
77
|
membership.should be_false
|
|
73
78
|
end
|
|
74
79
|
|
|
75
80
|
it "should return true if resoure found" do
|
|
76
81
|
stub_get("/orgs/#{org}/members/#{member}").
|
|
77
82
|
to_return(:body => "", :status => 204, :headers => {:user_agent => github.user_agent})
|
|
78
|
-
membership = github.orgs.member? org, member
|
|
83
|
+
membership = github.orgs.members.member? org, member
|
|
79
84
|
membership.should be_true
|
|
80
85
|
end
|
|
81
86
|
end
|
|
82
87
|
|
|
83
88
|
context "without org name and member name passed" do
|
|
84
89
|
it "should fail validation " do
|
|
85
|
-
expect {
|
|
90
|
+
expect {
|
|
91
|
+
github.orgs.members.member?(nil, nil)
|
|
92
|
+
}.to raise_error(ArgumentError)
|
|
86
93
|
end
|
|
87
94
|
end
|
|
88
95
|
end # member?
|
|
89
96
|
|
|
90
|
-
describe "
|
|
97
|
+
describe "#list_public" do
|
|
91
98
|
context "resource found" do
|
|
92
99
|
before do
|
|
93
100
|
stub_get("/orgs/#{org}/public_members").
|
|
94
|
-
to_return(:body => fixture('orgs/members.json'), :status => 200,
|
|
101
|
+
to_return(:body => fixture('orgs/members.json'), :status => 200,
|
|
102
|
+
:headers => {:content_type => "application/json; charset=utf-8"})
|
|
95
103
|
end
|
|
96
104
|
|
|
97
105
|
it "should fail to get resource without org name" do
|
|
98
|
-
expect { github.orgs.
|
|
106
|
+
expect { github.orgs.members.list_public }.to raise_error(ArgumentError)
|
|
99
107
|
end
|
|
100
108
|
|
|
101
109
|
it "should get the resources" do
|
|
102
|
-
github.orgs.
|
|
110
|
+
github.orgs.members.list_public org
|
|
103
111
|
a_get("/orgs/#{org}/public_members").should have_been_made
|
|
104
112
|
end
|
|
105
113
|
|
|
106
114
|
it "should return array of resources" do
|
|
107
|
-
public_members = github.orgs.
|
|
115
|
+
public_members = github.orgs.members.list_public org
|
|
108
116
|
public_members.should be_an Array
|
|
109
117
|
public_members.should have(1).items
|
|
110
118
|
end
|
|
111
119
|
|
|
112
120
|
it "should be a mash type" do
|
|
113
|
-
public_members = github.orgs.
|
|
121
|
+
public_members = github.orgs.members.list_public org
|
|
114
122
|
public_members.first.should be_a Hashie::Mash
|
|
115
123
|
end
|
|
116
124
|
|
|
117
125
|
it "should get public_members information" do
|
|
118
|
-
public_members = github.orgs.
|
|
126
|
+
public_members = github.orgs.members.list_public org
|
|
119
127
|
public_members.first.login.should == 'octocat'
|
|
120
128
|
end
|
|
121
129
|
|
|
122
130
|
it "should yield to a block" do
|
|
123
|
-
github.orgs.should_receive(:
|
|
124
|
-
github.orgs.
|
|
131
|
+
github.orgs.members.should_receive(:list_public).with(org).and_yield('web')
|
|
132
|
+
github.orgs.members.list_public(org) { |param| 'web' }
|
|
125
133
|
end
|
|
126
134
|
end
|
|
127
135
|
|
|
@@ -133,11 +141,11 @@ describe Github::Orgs::Members do
|
|
|
133
141
|
|
|
134
142
|
it "should return 404 with a message 'Not Found'" do
|
|
135
143
|
expect {
|
|
136
|
-
github.orgs.
|
|
144
|
+
github.orgs.members.list_public org
|
|
137
145
|
}.to raise_error(Github::Error::NotFound)
|
|
138
146
|
end
|
|
139
147
|
end
|
|
140
|
-
end #
|
|
148
|
+
end # list_public
|
|
141
149
|
|
|
142
150
|
describe "public_member?" do
|
|
143
151
|
context "with username ane reponame passed" do
|
|
@@ -148,21 +156,23 @@ describe Github::Orgs::Members do
|
|
|
148
156
|
end
|
|
149
157
|
|
|
150
158
|
it "should return false if resource not found" do
|
|
151
|
-
public_member = github.orgs.public_member? org, member
|
|
159
|
+
public_member = github.orgs.members.public_member? org, member
|
|
152
160
|
public_member.should be_false
|
|
153
161
|
end
|
|
154
162
|
|
|
155
163
|
it "should return true if resoure found" do
|
|
156
164
|
stub_get("/orgs/#{org}/public_members/#{member}").
|
|
157
165
|
to_return(:body => "", :status => 204, :headers => {:user_agent => github.user_agent})
|
|
158
|
-
public_member = github.orgs.public_member? org, member
|
|
166
|
+
public_member = github.orgs.members.public_member? org, member
|
|
159
167
|
public_member.should be_true
|
|
160
168
|
end
|
|
161
169
|
end
|
|
162
170
|
|
|
163
171
|
context "without org name and member name passed" do
|
|
164
172
|
it "should fail validation " do
|
|
165
|
-
expect {
|
|
173
|
+
expect {
|
|
174
|
+
github.orgs.members.public_member?(nil, nil)
|
|
175
|
+
}.to raise_error(ArgumentError)
|
|
166
176
|
end
|
|
167
177
|
end
|
|
168
178
|
end # public_member?
|
|
@@ -175,11 +185,11 @@ describe Github::Orgs::Members do
|
|
|
175
185
|
end
|
|
176
186
|
|
|
177
187
|
it "should fail to get resource without org name" do
|
|
178
|
-
expect { github.orgs.publicize }.to raise_error(ArgumentError)
|
|
188
|
+
expect { github.orgs.members.publicize }.to raise_error(ArgumentError)
|
|
179
189
|
end
|
|
180
190
|
|
|
181
191
|
it "should get the resources" do
|
|
182
|
-
github.orgs.publicize org, member
|
|
192
|
+
github.orgs.members.publicize org, member
|
|
183
193
|
a_put("/orgs/#{org}/public_members/#{member}").should have_been_made
|
|
184
194
|
end
|
|
185
195
|
end
|
|
@@ -187,30 +197,34 @@ describe Github::Orgs::Members do
|
|
|
187
197
|
context "resource not found" do
|
|
188
198
|
before do
|
|
189
199
|
stub_put("/orgs/#{org}/public_members/#{member}").
|
|
190
|
-
to_return(:body => fixture('orgs/members.json'), :status => 404,
|
|
200
|
+
to_return(:body => fixture('orgs/members.json'), :status => 404,
|
|
201
|
+
:headers => {:content_type => "application/json; charset=utf-8"})
|
|
191
202
|
end
|
|
192
203
|
|
|
193
204
|
it "should return 404 with a message 'Not Found'" do
|
|
194
205
|
expect {
|
|
195
|
-
github.orgs.publicize org, member
|
|
206
|
+
github.orgs.members.publicize org, member
|
|
196
207
|
}.to raise_error(Github::Error::NotFound)
|
|
197
208
|
end
|
|
198
209
|
end
|
|
199
210
|
end # publicize
|
|
200
211
|
|
|
201
|
-
describe "conceal" do
|
|
212
|
+
describe "#conceal" do
|
|
202
213
|
context "request perfomed successfully" do
|
|
203
214
|
before do
|
|
204
215
|
stub_delete("/orgs/#{org}/public_members/#{member}").
|
|
205
|
-
to_return(:body => fixture('orgs/members.json'), :status => 204,
|
|
216
|
+
to_return(:body => fixture('orgs/members.json'), :status => 204,
|
|
217
|
+
:headers => {:content_type => "application/json; charset=utf-8"})
|
|
206
218
|
end
|
|
207
219
|
|
|
208
220
|
it "should fail to get resource without org name" do
|
|
209
|
-
expect {
|
|
221
|
+
expect {
|
|
222
|
+
github.orgs.members.conceal nil, nil
|
|
223
|
+
}.to raise_error(ArgumentError)
|
|
210
224
|
end
|
|
211
225
|
|
|
212
226
|
it "should get the resources" do
|
|
213
|
-
github.orgs.conceal org, member
|
|
227
|
+
github.orgs.members.conceal org, member
|
|
214
228
|
a_delete("/orgs/#{org}/public_members/#{member}").should have_been_made
|
|
215
229
|
end
|
|
216
230
|
end
|
|
@@ -218,18 +232,19 @@ describe Github::Orgs::Members do
|
|
|
218
232
|
context "resource not found" do
|
|
219
233
|
before do
|
|
220
234
|
stub_delete("/orgs/#{org}/public_members/#{member}").
|
|
221
|
-
to_return(:body => fixture('orgs/members.json'), :status => 404,
|
|
235
|
+
to_return(:body => fixture('orgs/members.json'), :status => 404,
|
|
236
|
+
:headers => {:content_type => "application/json; charset=utf-8"})
|
|
222
237
|
end
|
|
223
238
|
|
|
224
239
|
it "should return 404 with a message 'Not Found'" do
|
|
225
240
|
expect {
|
|
226
|
-
github.orgs.conceal org, member
|
|
241
|
+
github.orgs.members.conceal org, member
|
|
227
242
|
}.to raise_error(Github::Error::NotFound)
|
|
228
243
|
end
|
|
229
244
|
end
|
|
230
245
|
end # conceal
|
|
231
246
|
|
|
232
|
-
describe "
|
|
247
|
+
describe "#delete" do
|
|
233
248
|
let(:hook_id) { 1 }
|
|
234
249
|
|
|
235
250
|
context "resource deleted successfully" do
|
|
@@ -239,11 +254,11 @@ describe Github::Orgs::Members do
|
|
|
239
254
|
end
|
|
240
255
|
|
|
241
256
|
it "should fail to delete without org and member parameters" do
|
|
242
|
-
expect { github.
|
|
257
|
+
expect { github.orgs.members.delete nil, nil }.to raise_error(ArgumentError)
|
|
243
258
|
end
|
|
244
259
|
|
|
245
260
|
it "should delete the resource" do
|
|
246
|
-
github.orgs.
|
|
261
|
+
github.orgs.members.delete org, member
|
|
247
262
|
a_delete("/orgs/#{org}/members/#{member}").should have_been_made
|
|
248
263
|
end
|
|
249
264
|
end
|
|
@@ -251,16 +266,16 @@ describe Github::Orgs::Members do
|
|
|
251
266
|
context "failed to edit resource" do
|
|
252
267
|
before do
|
|
253
268
|
stub_delete("/orgs/#{org}/members/#{member}").
|
|
254
|
-
to_return(:body => '', :status => 404,
|
|
255
|
-
|
|
269
|
+
to_return(:body => '', :status => 404,
|
|
270
|
+
:headers => { :content_type => "application/json; charset=utf-8"})
|
|
256
271
|
end
|
|
257
272
|
|
|
258
273
|
it "should fail to find resource" do
|
|
259
274
|
expect {
|
|
260
|
-
github.orgs.
|
|
275
|
+
github.orgs.members.delete org, member
|
|
261
276
|
}.to raise_error(Github::Error::NotFound)
|
|
262
277
|
end
|
|
263
278
|
end
|
|
264
|
-
end #
|
|
279
|
+
end # delete
|
|
265
280
|
|
|
266
281
|
end # Github::Orgs::Members
|
|
@@ -8,84 +8,87 @@ describe Github::Orgs::Teams do
|
|
|
8
8
|
let(:team) { 'github' }
|
|
9
9
|
let(:member) { 'github' }
|
|
10
10
|
|
|
11
|
-
after {
|
|
11
|
+
after { reset_authentication_for github }
|
|
12
12
|
|
|
13
|
-
describe "
|
|
13
|
+
describe "#list" do
|
|
14
14
|
context "resource found" do
|
|
15
15
|
before do
|
|
16
16
|
stub_get("/orgs/#{org}/teams").
|
|
17
|
-
to_return(:body => fixture('orgs/teams.json'), :status => 200,
|
|
17
|
+
to_return(:body => fixture('orgs/teams.json'), :status => 200,
|
|
18
|
+
:headers => {:content_type => "application/json; charset=utf-8"})
|
|
18
19
|
end
|
|
19
20
|
|
|
20
21
|
it "should fail to get resource without org name" do
|
|
21
|
-
expect { github.orgs.teams nil }.to raise_error(ArgumentError)
|
|
22
|
+
expect { github.orgs.teams.list nil }.to raise_error(ArgumentError)
|
|
22
23
|
end
|
|
23
24
|
|
|
24
25
|
it "should get the resources" do
|
|
25
|
-
github.orgs.teams org
|
|
26
|
+
github.orgs.teams.list org
|
|
26
27
|
a_get("/orgs/#{org}/teams").should have_been_made
|
|
27
28
|
end
|
|
28
29
|
|
|
29
30
|
it "should return array of resources" do
|
|
30
|
-
teams = github.orgs.teams org
|
|
31
|
+
teams = github.orgs.teams.list org
|
|
31
32
|
teams.should be_an Array
|
|
32
33
|
teams.should have(1).items
|
|
33
34
|
end
|
|
34
35
|
|
|
35
36
|
it "should be a mash type" do
|
|
36
|
-
teams = github.orgs.teams org
|
|
37
|
+
teams = github.orgs.teams.list org
|
|
37
38
|
teams.first.should be_a Hashie::Mash
|
|
38
39
|
end
|
|
39
40
|
|
|
40
41
|
it "should get teams information" do
|
|
41
|
-
teams = github.orgs.teams org
|
|
42
|
+
teams = github.orgs.teams.list org
|
|
42
43
|
teams.first.name.should == 'Owners'
|
|
43
44
|
end
|
|
44
45
|
|
|
45
46
|
it "should yield to a block" do
|
|
46
|
-
github.orgs.should_receive(:
|
|
47
|
-
github.orgs.teams(org) { |param| 'web' }
|
|
47
|
+
github.orgs.teams.should_receive(:list).with(org).and_yield('web')
|
|
48
|
+
github.orgs.teams.list(org) { |param| 'web' }
|
|
48
49
|
end
|
|
49
50
|
end
|
|
50
51
|
|
|
51
52
|
context "resource not found" do
|
|
52
53
|
before do
|
|
53
54
|
stub_get("/orgs/#{org}/teams").
|
|
54
|
-
to_return(:body => fixture('orgs/teams.json'), :status => 404,
|
|
55
|
+
to_return(:body => fixture('orgs/teams.json'), :status => 404,
|
|
56
|
+
:headers => {:content_type => "application/json; charset=utf-8"})
|
|
55
57
|
end
|
|
56
58
|
|
|
57
59
|
it "should return 404 with a message 'Not Found'" do
|
|
58
60
|
expect {
|
|
59
|
-
github.orgs.teams org
|
|
61
|
+
github.orgs.teams.list org
|
|
60
62
|
}.to raise_error(Github::Error::NotFound)
|
|
61
63
|
end
|
|
62
64
|
end
|
|
63
|
-
end #
|
|
65
|
+
end # list
|
|
64
66
|
|
|
65
|
-
describe "
|
|
67
|
+
describe "#get" do
|
|
66
68
|
context "resource found" do
|
|
67
69
|
before do
|
|
68
70
|
stub_get("/teams/#{team}").
|
|
69
|
-
to_return(:body => fixture('orgs/team.json'), :status => 200,
|
|
71
|
+
to_return(:body => fixture('orgs/team.json'), :status => 200,
|
|
72
|
+
:headers => {:content_type => "application/json; charset=utf-8"})
|
|
70
73
|
end
|
|
71
74
|
|
|
72
75
|
it "should fail to get resource without org name" do
|
|
73
|
-
expect { github.orgs.
|
|
76
|
+
expect { github.orgs.teams.get nil }.to raise_error(ArgumentError)
|
|
74
77
|
end
|
|
75
78
|
|
|
76
79
|
it "should get the resource" do
|
|
77
|
-
github.orgs.
|
|
80
|
+
github.orgs.teams.get team
|
|
78
81
|
a_get("/teams/#{team}").should have_been_made
|
|
79
82
|
end
|
|
80
83
|
|
|
81
84
|
it "should get team information" do
|
|
82
|
-
team_res = github.orgs.
|
|
85
|
+
team_res = github.orgs.teams.get team
|
|
83
86
|
team_res.id.should == 1
|
|
84
87
|
team_res.name.should == 'Owners'
|
|
85
88
|
end
|
|
86
89
|
|
|
87
90
|
it "should return mash" do
|
|
88
|
-
team_res = github.orgs.
|
|
91
|
+
team_res = github.orgs.teams.get team
|
|
89
92
|
team_res.should be_a Hashie::Mash
|
|
90
93
|
end
|
|
91
94
|
end
|
|
@@ -93,18 +96,19 @@ describe Github::Orgs::Teams do
|
|
|
93
96
|
context "resource not found" do
|
|
94
97
|
before do
|
|
95
98
|
stub_get("/teams/#{team}").
|
|
96
|
-
to_return(:body => fixture('orgs/team.json'), :status => 404,
|
|
99
|
+
to_return(:body => fixture('orgs/team.json'), :status => 404,
|
|
100
|
+
:headers => {:content_type => "application/json; charset=utf-8"})
|
|
97
101
|
end
|
|
98
102
|
|
|
99
103
|
it "should fail to retrive resource" do
|
|
100
104
|
expect {
|
|
101
|
-
github.orgs.
|
|
105
|
+
github.orgs.teams.get team
|
|
102
106
|
}.to raise_error(Github::Error::NotFound)
|
|
103
107
|
end
|
|
104
108
|
end
|
|
105
|
-
end #
|
|
109
|
+
end # get
|
|
106
110
|
|
|
107
|
-
describe "
|
|
111
|
+
describe "#create" do
|
|
108
112
|
let(:inputs) { { :name => 'new team', :permissions => 'push', :repo_names => [ 'github/dotfiles' ] }}
|
|
109
113
|
|
|
110
114
|
context "resouce created" do
|
|
@@ -114,27 +118,27 @@ describe Github::Orgs::Teams do
|
|
|
114
118
|
end
|
|
115
119
|
|
|
116
120
|
it "should fail to create resource if 'org_name' param is missing" do
|
|
117
|
-
expect { github.orgs.
|
|
121
|
+
expect { github.orgs.teams.create nil, inputs }.to raise_error(ArgumentError)
|
|
118
122
|
end
|
|
119
123
|
|
|
120
124
|
it "should failt to create resource if 'name' input is missing" do
|
|
121
125
|
expect {
|
|
122
|
-
github.orgs.
|
|
126
|
+
github.orgs.teams.create org, inputs.except(:name)
|
|
123
127
|
}.to raise_error(Github::Error::RequiredParams)
|
|
124
128
|
end
|
|
125
129
|
|
|
126
130
|
it "should create resource successfully" do
|
|
127
|
-
github.orgs.
|
|
131
|
+
github.orgs.teams.create org, inputs
|
|
128
132
|
a_post("/orgs/#{org}/teams").with(inputs).should have_been_made
|
|
129
133
|
end
|
|
130
134
|
|
|
131
135
|
it "should return the resource" do
|
|
132
|
-
team = github.orgs.
|
|
136
|
+
team = github.orgs.teams.create org, inputs
|
|
133
137
|
team.should be_a Hashie::Mash
|
|
134
138
|
end
|
|
135
139
|
|
|
136
140
|
it "should get the team information" do
|
|
137
|
-
team = github.orgs.
|
|
141
|
+
team = github.orgs.teams.create org, inputs
|
|
138
142
|
team.name.should == 'Owners'
|
|
139
143
|
end
|
|
140
144
|
end
|
|
@@ -142,49 +146,50 @@ describe Github::Orgs::Teams do
|
|
|
142
146
|
context "failed to create resource" do
|
|
143
147
|
before do
|
|
144
148
|
stub_post("/orgs/#{org}/teams").with(inputs).
|
|
145
|
-
to_return(:body => fixture('orgs/team.json'), :status => 404,
|
|
149
|
+
to_return(:body => fixture('orgs/team.json'), :status => 404,
|
|
150
|
+
:headers => {:content_type => "application/json; charset=utf-8"})
|
|
146
151
|
end
|
|
147
152
|
|
|
148
153
|
it "should faile to retrieve resource" do
|
|
149
154
|
expect {
|
|
150
|
-
github.orgs.
|
|
155
|
+
github.orgs.teams.create org, inputs
|
|
151
156
|
}.to raise_error(Github::Error::NotFound)
|
|
152
157
|
end
|
|
153
158
|
end
|
|
154
|
-
end #
|
|
159
|
+
end # create
|
|
155
160
|
|
|
156
|
-
describe "
|
|
161
|
+
describe "#edit" do
|
|
157
162
|
let(:inputs) { { :name => 'new team', :permissions => 'push' } }
|
|
158
163
|
|
|
159
164
|
context "resouce edited" do
|
|
160
165
|
before do
|
|
161
166
|
stub_patch("/teams/#{team}").with(inputs).
|
|
162
|
-
to_return(:body => fixture('orgs/team.json'), :status => 201,
|
|
163
|
-
|
|
167
|
+
to_return(:body => fixture('orgs/team.json'), :status => 201,
|
|
168
|
+
:headers => {:content_type => "application/json; charset=utf-8"})
|
|
164
169
|
end
|
|
165
170
|
|
|
166
171
|
it "should fail to create resource if 'team name' param is missing" do
|
|
167
|
-
expect { github.orgs.
|
|
172
|
+
expect { github.orgs.teams.edit nil, inputs }.to raise_error(ArgumentError)
|
|
168
173
|
end
|
|
169
174
|
|
|
170
175
|
it "should failt to create resource if 'name' input is missing" do
|
|
171
176
|
expect {
|
|
172
|
-
github.orgs.
|
|
177
|
+
github.orgs.teams.edit team, inputs.except(:name)
|
|
173
178
|
}.to raise_error(Github::Error::RequiredParams)
|
|
174
179
|
end
|
|
175
180
|
|
|
176
181
|
it "should create resource successfully" do
|
|
177
|
-
github.orgs.
|
|
182
|
+
github.orgs.teams.edit team, inputs
|
|
178
183
|
a_patch("/teams/#{team}").with(inputs).should have_been_made
|
|
179
184
|
end
|
|
180
185
|
|
|
181
186
|
it "should return the resource" do
|
|
182
|
-
edited_team = github.orgs.
|
|
187
|
+
edited_team = github.orgs.teams.edit team, inputs
|
|
183
188
|
edited_team.should be_a Hashie::Mash
|
|
184
189
|
end
|
|
185
190
|
|
|
186
191
|
it "should get the team information" do
|
|
187
|
-
edited_team = github.orgs.
|
|
192
|
+
edited_team = github.orgs.teams.edit team, inputs
|
|
188
193
|
edited_team.name.should == 'Owners'
|
|
189
194
|
end
|
|
190
195
|
end
|
|
@@ -192,20 +197,23 @@ describe Github::Orgs::Teams do
|
|
|
192
197
|
context "failed to create resource" do
|
|
193
198
|
before do
|
|
194
199
|
stub_patch("/teams/#{team}").with(inputs).
|
|
195
|
-
to_return(:body => fixture('orgs/team.json'), :status => 404,
|
|
200
|
+
to_return(:body => fixture('orgs/team.json'), :status => 404,
|
|
201
|
+
:headers => {:content_type => "application/json; charset=utf-8"})
|
|
196
202
|
end
|
|
197
203
|
|
|
198
204
|
it "should faile to retrieve resource" do
|
|
199
205
|
expect {
|
|
200
|
-
github.orgs.
|
|
206
|
+
github.orgs.teams.edit team, inputs
|
|
201
207
|
}.to raise_error(Github::Error::NotFound)
|
|
202
208
|
end
|
|
203
209
|
end
|
|
204
|
-
end #
|
|
210
|
+
end # edit
|
|
205
211
|
|
|
206
|
-
describe "
|
|
212
|
+
describe "#delete" do
|
|
207
213
|
let(:team_id) { 1 }
|
|
208
214
|
|
|
215
|
+
it { github.orgs.teams.should respond_to :remove }
|
|
216
|
+
|
|
209
217
|
context "resource edited successfully" do
|
|
210
218
|
before do
|
|
211
219
|
stub_delete("/teams/#{team}").
|
|
@@ -213,12 +221,11 @@ describe Github::Orgs::Teams do
|
|
|
213
221
|
end
|
|
214
222
|
|
|
215
223
|
it "should fail to delete without 'team_id' parameter" do
|
|
216
|
-
|
|
217
|
-
expect { github.orgs.delete_team }.to raise_error(ArgumentError)
|
|
224
|
+
expect { github.orgs.teams.delete nil }.to raise_error(ArgumentError)
|
|
218
225
|
end
|
|
219
226
|
|
|
220
227
|
it "should delete the resource" do
|
|
221
|
-
github.orgs.
|
|
228
|
+
github.orgs.teams.delete team
|
|
222
229
|
a_delete("/teams/#{team}").should have_been_made
|
|
223
230
|
end
|
|
224
231
|
end
|
|
@@ -230,12 +237,14 @@ describe Github::Orgs::Teams do
|
|
|
230
237
|
end
|
|
231
238
|
|
|
232
239
|
it "should fail to find resource" do
|
|
233
|
-
expect {
|
|
240
|
+
expect {
|
|
241
|
+
github.orgs.teams.delete team
|
|
242
|
+
}.to raise_error(Github::Error::NotFound)
|
|
234
243
|
end
|
|
235
244
|
end
|
|
236
|
-
end #
|
|
245
|
+
end # delete
|
|
237
246
|
|
|
238
|
-
describe "
|
|
247
|
+
describe "#list_members" do
|
|
239
248
|
context "resource found" do
|
|
240
249
|
before do
|
|
241
250
|
stub_get("/teams/#{team}/members").
|
|
@@ -243,33 +252,33 @@ describe Github::Orgs::Teams do
|
|
|
243
252
|
end
|
|
244
253
|
|
|
245
254
|
it "should fail to get resource without org name" do
|
|
246
|
-
expect { github.orgs.
|
|
255
|
+
expect { github.orgs.teams.list_members }.to raise_error(ArgumentError)
|
|
247
256
|
end
|
|
248
257
|
|
|
249
258
|
it "should get the resources" do
|
|
250
|
-
github.orgs.
|
|
259
|
+
github.orgs.teams.list_members team
|
|
251
260
|
a_get("/teams/#{team}/members").should have_been_made
|
|
252
261
|
end
|
|
253
262
|
|
|
254
263
|
it "should return array of resources" do
|
|
255
|
-
teams = github.orgs.
|
|
264
|
+
teams = github.orgs.teams.list_members team
|
|
256
265
|
teams.should be_an Array
|
|
257
266
|
teams.should have(1).items
|
|
258
267
|
end
|
|
259
268
|
|
|
260
269
|
it "should be a mash type" do
|
|
261
|
-
teams = github.orgs.
|
|
270
|
+
teams = github.orgs.teams.list_members team
|
|
262
271
|
teams.first.should be_a Hashie::Mash
|
|
263
272
|
end
|
|
264
273
|
|
|
265
274
|
it "should get team members information" do
|
|
266
|
-
teams = github.orgs.
|
|
275
|
+
teams = github.orgs.teams.list_members team
|
|
267
276
|
teams.first.name.should == 'Owners'
|
|
268
277
|
end
|
|
269
278
|
|
|
270
279
|
it "should yield to a block" do
|
|
271
|
-
github.orgs.should_receive(:
|
|
272
|
-
github.orgs.
|
|
280
|
+
github.orgs.teams.should_receive(:list_members).with(team).and_yield('web')
|
|
281
|
+
github.orgs.teams.list_members(team) { |param| 'web' }
|
|
273
282
|
end
|
|
274
283
|
end
|
|
275
284
|
|
|
@@ -281,11 +290,11 @@ describe Github::Orgs::Teams do
|
|
|
281
290
|
|
|
282
291
|
it "should return 404 with a message 'Not Found'" do
|
|
283
292
|
expect {
|
|
284
|
-
github.orgs.
|
|
293
|
+
github.orgs.teams.list_members team
|
|
285
294
|
}.to raise_error(Github::Error::NotFound)
|
|
286
295
|
end
|
|
287
296
|
end
|
|
288
|
-
end #
|
|
297
|
+
end # list_members
|
|
289
298
|
|
|
290
299
|
describe "team_member?" do
|
|
291
300
|
context "with teamname ane membername passed" do
|
|
@@ -297,14 +306,14 @@ describe Github::Orgs::Teams do
|
|
|
297
306
|
end
|
|
298
307
|
|
|
299
308
|
it "should return false if resource not found" do
|
|
300
|
-
team_membership = github.orgs.team_member? team, member
|
|
309
|
+
team_membership = github.orgs.teams.team_member? team, member
|
|
301
310
|
team_membership.should be_false
|
|
302
311
|
end
|
|
303
312
|
|
|
304
313
|
it "should return true if resoure found" do
|
|
305
314
|
stub_get("/teams/#{team}/members/#{member}").
|
|
306
315
|
to_return(:body => "", :status => 204, :headers => {:user_agent => github.user_agent})
|
|
307
|
-
team_membership = github.orgs.team_member? team, member
|
|
316
|
+
team_membership = github.orgs.teams.team_member? team, member
|
|
308
317
|
team_membership.should be_true
|
|
309
318
|
end
|
|
310
319
|
|
|
@@ -312,12 +321,14 @@ describe Github::Orgs::Teams do
|
|
|
312
321
|
|
|
313
322
|
context "without org name and member name passed" do
|
|
314
323
|
it "should fail validation " do
|
|
315
|
-
expect {
|
|
324
|
+
expect {
|
|
325
|
+
github.orgs.teams.team_member?(nil, nil)
|
|
326
|
+
}.to raise_error(ArgumentError)
|
|
316
327
|
end
|
|
317
328
|
end
|
|
318
|
-
end #
|
|
329
|
+
end # team_member?
|
|
319
330
|
|
|
320
|
-
describe "
|
|
331
|
+
describe "#add_member" do
|
|
321
332
|
context "resouce added" do
|
|
322
333
|
before do
|
|
323
334
|
stub_put("/teams/#{team}/members/#{member}").
|
|
@@ -326,18 +337,18 @@ describe Github::Orgs::Teams do
|
|
|
326
337
|
|
|
327
338
|
it "should fail to add resource if 'team' input is nil" do
|
|
328
339
|
expect {
|
|
329
|
-
github.orgs.
|
|
340
|
+
github.orgs.teams.add_member nil, member
|
|
330
341
|
}.to raise_error(ArgumentError)
|
|
331
342
|
end
|
|
332
343
|
|
|
333
344
|
it "should fail to add resource if 'member' input is nil" do
|
|
334
345
|
expect {
|
|
335
|
-
github.orgs.
|
|
346
|
+
github.orgs.teams.add_member team, nil
|
|
336
347
|
}.to raise_error(ArgumentError)
|
|
337
348
|
end
|
|
338
349
|
|
|
339
350
|
it "should add resource successfully" do
|
|
340
|
-
github.orgs.
|
|
351
|
+
github.orgs.teams.add_member team, member
|
|
341
352
|
a_put("/teams/#{team}/members/#{member}").should have_been_made
|
|
342
353
|
end
|
|
343
354
|
end
|
|
@@ -350,13 +361,13 @@ describe Github::Orgs::Teams do
|
|
|
350
361
|
|
|
351
362
|
it "should fail to add resource" do
|
|
352
363
|
expect {
|
|
353
|
-
github.orgs.
|
|
364
|
+
github.orgs.teams.add_member team, member
|
|
354
365
|
}.to raise_error(Github::Error::NotFound)
|
|
355
366
|
end
|
|
356
367
|
end
|
|
357
|
-
end #
|
|
368
|
+
end # add_member
|
|
358
369
|
|
|
359
|
-
describe "
|
|
370
|
+
describe "#remove_member" do
|
|
360
371
|
context "resouce deleted" do
|
|
361
372
|
before do
|
|
362
373
|
stub_delete("/teams/#{team}/members/#{member}").
|
|
@@ -365,18 +376,18 @@ describe Github::Orgs::Teams do
|
|
|
365
376
|
|
|
366
377
|
it "should fail to delete resource if 'team' input is nil" do
|
|
367
378
|
expect {
|
|
368
|
-
github.orgs.
|
|
379
|
+
github.orgs.teams.remove_member nil, member
|
|
369
380
|
}.to raise_error(ArgumentError)
|
|
370
381
|
end
|
|
371
382
|
|
|
372
383
|
it "should fail to delete resource if 'member' input is nil" do
|
|
373
384
|
expect {
|
|
374
|
-
github.orgs.
|
|
385
|
+
github.orgs.teams.remove_member member, nil
|
|
375
386
|
}.to raise_error(ArgumentError)
|
|
376
387
|
end
|
|
377
388
|
|
|
378
389
|
it "should add resource successfully" do
|
|
379
|
-
github.orgs.
|
|
390
|
+
github.orgs.teams.remove_member team, member
|
|
380
391
|
a_delete("/teams/#{team}/members/#{member}").should have_been_made
|
|
381
392
|
end
|
|
382
393
|
end
|
|
@@ -389,13 +400,13 @@ describe Github::Orgs::Teams do
|
|
|
389
400
|
|
|
390
401
|
it "should fail to remove resource" do
|
|
391
402
|
expect {
|
|
392
|
-
github.orgs.
|
|
403
|
+
github.orgs.teams.remove_member team, member
|
|
393
404
|
}.to raise_error(Github::Error::NotFound)
|
|
394
405
|
end
|
|
395
406
|
end
|
|
396
|
-
end #
|
|
407
|
+
end # remove_member
|
|
397
408
|
|
|
398
|
-
describe "
|
|
409
|
+
describe "#list_repos" do
|
|
399
410
|
context "resource found" do
|
|
400
411
|
before do
|
|
401
412
|
stub_get("/teams/#{team}/repos").
|
|
@@ -403,33 +414,33 @@ describe Github::Orgs::Teams do
|
|
|
403
414
|
end
|
|
404
415
|
|
|
405
416
|
it "should fail to get resource without team name" do
|
|
406
|
-
expect { github.orgs.
|
|
417
|
+
expect { github.orgs.teams.list_repos nil }.to raise_error(ArgumentError)
|
|
407
418
|
end
|
|
408
419
|
|
|
409
420
|
it "should get the resources" do
|
|
410
|
-
github.orgs.
|
|
421
|
+
github.orgs.teams.list_repos team
|
|
411
422
|
a_get("/teams/#{team}/repos").should have_been_made
|
|
412
423
|
end
|
|
413
424
|
|
|
414
425
|
it "should return array of resources" do
|
|
415
|
-
team_repos = github.orgs.
|
|
426
|
+
team_repos = github.orgs.teams.list_repos team
|
|
416
427
|
team_repos.should be_an Array
|
|
417
428
|
team_repos.should have(1).items
|
|
418
429
|
end
|
|
419
430
|
|
|
420
431
|
it "should be a mash type" do
|
|
421
|
-
team_repos = github.orgs.
|
|
432
|
+
team_repos = github.orgs.teams.list_repos team
|
|
422
433
|
team_repos.first.should be_a Hashie::Mash
|
|
423
434
|
end
|
|
424
435
|
|
|
425
436
|
it "should get teams information" do
|
|
426
|
-
team_repos = github.orgs.
|
|
437
|
+
team_repos = github.orgs.teams.list_repos team
|
|
427
438
|
team_repos.first.name.should == 'github'
|
|
428
439
|
end
|
|
429
440
|
|
|
430
441
|
it "should yield to a block" do
|
|
431
|
-
github.orgs.should_receive(:
|
|
432
|
-
github.orgs.
|
|
442
|
+
github.orgs.teams.should_receive(:list_repos).with(team).and_yield('web')
|
|
443
|
+
github.orgs.teams.list_repos(team) { |param| 'web' }
|
|
433
444
|
end
|
|
434
445
|
end
|
|
435
446
|
|
|
@@ -441,44 +452,44 @@ describe Github::Orgs::Teams do
|
|
|
441
452
|
|
|
442
453
|
it "should return 404 with a message 'Not Found'" do
|
|
443
454
|
expect {
|
|
444
|
-
github.orgs.
|
|
455
|
+
github.orgs.teams.list_repos team
|
|
445
456
|
}.to raise_error(Github::Error::NotFound)
|
|
446
457
|
end
|
|
447
458
|
end
|
|
448
|
-
end #
|
|
459
|
+
end # list_repos
|
|
449
460
|
|
|
450
461
|
describe "team_repo?" do
|
|
451
462
|
context "with teamname, username ane reponame passed" do
|
|
452
463
|
|
|
453
464
|
context "this repo is managed by the team"
|
|
454
465
|
before do
|
|
455
|
-
github.oauth_token = nil
|
|
456
|
-
github.user = nil
|
|
457
466
|
stub_get("/teams/#{team}/repos/#{user}/#{repo}").
|
|
458
467
|
to_return(:body => "", :status => 404, :headers => {:user_agent => github.user_agent})
|
|
459
468
|
end
|
|
460
469
|
|
|
461
470
|
it "should return false if resource not found" do
|
|
462
|
-
team_managed = github.orgs.team_repo? team, user, repo
|
|
471
|
+
team_managed = github.orgs.teams.team_repo? team, user, repo
|
|
463
472
|
team_managed.should be_false
|
|
464
473
|
end
|
|
465
474
|
|
|
466
475
|
it "should return true if resoure found" do
|
|
467
476
|
stub_get("/teams/#{team}/repos/#{user}/#{repo}").
|
|
468
477
|
to_return(:body => "", :status => 204, :headers => {:user_agent => github.user_agent})
|
|
469
|
-
team_managed = github.orgs.team_repo? team, user, repo
|
|
478
|
+
team_managed = github.orgs.teams.team_repo? team, user, repo
|
|
470
479
|
team_managed.should be_true
|
|
471
480
|
end
|
|
472
481
|
end
|
|
473
482
|
|
|
474
483
|
context "without org name and member name passed" do
|
|
475
484
|
it "should fail validation " do
|
|
476
|
-
expect {
|
|
485
|
+
expect {
|
|
486
|
+
github.orgs.teams.team_repo?(nil, nil, nil)
|
|
487
|
+
}.to raise_error(ArgumentError)
|
|
477
488
|
end
|
|
478
489
|
end
|
|
479
490
|
end # team_repo?
|
|
480
491
|
|
|
481
|
-
describe "
|
|
492
|
+
describe "#add_repo" do
|
|
482
493
|
context "resouce added" do
|
|
483
494
|
before do
|
|
484
495
|
stub_put("/teams/#{team}/repos/#{user}/#{repo}").
|
|
@@ -487,18 +498,18 @@ describe Github::Orgs::Teams do
|
|
|
487
498
|
|
|
488
499
|
it "should fail to add resource if 'team' input is nil" do
|
|
489
500
|
expect {
|
|
490
|
-
github.orgs.
|
|
501
|
+
github.orgs.teams.add_repo nil, user, repo
|
|
491
502
|
}.to raise_error(ArgumentError)
|
|
492
503
|
end
|
|
493
504
|
|
|
494
505
|
it "should fail to add resource if 'user' input is nil" do
|
|
495
506
|
expect {
|
|
496
|
-
github.orgs.
|
|
507
|
+
github.orgs.teams.add_repo team, nil, repo
|
|
497
508
|
}.to raise_error(ArgumentError)
|
|
498
509
|
end
|
|
499
510
|
|
|
500
511
|
it "should add resource successfully" do
|
|
501
|
-
github.orgs.
|
|
512
|
+
github.orgs.teams.add_repo team, user, repo
|
|
502
513
|
a_put("/teams/#{team}/repos/#{user}/#{repo}").should have_been_made
|
|
503
514
|
end
|
|
504
515
|
end
|
|
@@ -511,13 +522,13 @@ describe Github::Orgs::Teams do
|
|
|
511
522
|
|
|
512
523
|
it "should fail to add resource" do
|
|
513
524
|
expect {
|
|
514
|
-
github.orgs.
|
|
525
|
+
github.orgs.teams.add_repo team, user, repo
|
|
515
526
|
}.to raise_error(Github::Error::NotFound)
|
|
516
527
|
end
|
|
517
528
|
end
|
|
518
|
-
end #
|
|
529
|
+
end # add_repo
|
|
519
530
|
|
|
520
|
-
describe "
|
|
531
|
+
describe "#remove_repo" do
|
|
521
532
|
context "resouce deleted" do
|
|
522
533
|
before do
|
|
523
534
|
stub_delete("/teams/#{team}/repos/#{user}/#{repo}").
|
|
@@ -526,18 +537,18 @@ describe Github::Orgs::Teams do
|
|
|
526
537
|
|
|
527
538
|
it "should fail to delete resource if 'team' input is nil" do
|
|
528
539
|
expect {
|
|
529
|
-
github.orgs.
|
|
540
|
+
github.orgs.teams.remove_repo nil, user, repo
|
|
530
541
|
}.to raise_error(ArgumentError)
|
|
531
542
|
end
|
|
532
543
|
|
|
533
544
|
it "should fail to delete resource if 'user' input is nil" do
|
|
534
545
|
expect {
|
|
535
|
-
github.orgs.
|
|
546
|
+
github.orgs.teams.remove_repo team, nil, repo
|
|
536
547
|
}.to raise_error(ArgumentError)
|
|
537
548
|
end
|
|
538
549
|
|
|
539
550
|
it "should add resource successfully" do
|
|
540
|
-
github.orgs.
|
|
551
|
+
github.orgs.teams.remove_repo team, user, repo
|
|
541
552
|
a_delete("/teams/#{team}/repos/#{user}/#{repo}").should have_been_made
|
|
542
553
|
end
|
|
543
554
|
end
|
|
@@ -550,10 +561,10 @@ describe Github::Orgs::Teams do
|
|
|
550
561
|
|
|
551
562
|
it "should fail to remove resource" do
|
|
552
563
|
expect {
|
|
553
|
-
github.orgs.
|
|
564
|
+
github.orgs.teams.remove_repo team, user, repo
|
|
554
565
|
}.to raise_error(Github::Error::NotFound)
|
|
555
566
|
end
|
|
556
567
|
end
|
|
557
|
-
end #
|
|
568
|
+
end # remove_repo
|
|
558
569
|
|
|
559
570
|
end # Github::Orgs::Teams
|