github_api 0.4.6 → 0.4.7
Sign up to get free protection for your applications and to get access to all the features.
- data/features/cassettes/errors/repos/create.yml +33 -23
- data/features/cassettes/gists/comments/all.yml +116 -106
- data/features/cassettes/gists/comments/first.yml +41 -31
- data/features/cassettes/gists/gist.yml +61 -50
- data/features/cassettes/gists/gists/public_all.yml +31 -58
- data/features/cassettes/gists/gists/user_all.yml +44 -34
- data/features/cassettes/pagination/repos.yml +161 -287
- data/features/cassettes/pagination/repos/commits.yml +174 -299
- data/features/cassettes/pagination/repos/commits/next.yml +166 -161
- data/features/cassettes/pagination/repos/commits/sha.yml +127 -121
- data/features/cassettes/pagination/repos/commits/sha/next.yml +130 -250
- data/features/cassettes/pagination/repos/diff.yml +126 -154
- data/features/cassettes/pagination/repos/diff/next.yml +123 -246
- data/features/cassettes/pagination/repos/next.yml +162 -157
- data/features/cassettes/pagination/repos/per_page/each_page.yml +370 -352
- data/features/cassettes/pagination/repos/per_page/first.yml +127 -121
- data/features/cassettes/repos/branches.yml +38 -65
- data/features/cassettes/repos/tags.yml +127 -175
- data/features/support/vcr.rb +2 -2
- data/lib/github_api/authorization.rb +3 -3
- data/lib/github_api/error.rb +3 -0
- data/lib/github_api/error/client_error.rb +20 -0
- data/lib/github_api/error/invalid_options.rb +18 -0
- data/lib/github_api/error/required_params.rb +18 -0
- data/lib/github_api/error/service_error.rb +1 -1
- data/lib/github_api/error/validations.rb +18 -0
- data/lib/github_api/gists.rb +1 -5
- data/lib/github_api/gists/comments.rb +2 -8
- data/lib/github_api/git_data/blobs.rb +1 -2
- data/lib/github_api/git_data/commits.rb +1 -2
- data/lib/github_api/git_data/references.rb +2 -4
- data/lib/github_api/git_data/trees.rb +1 -1
- data/lib/github_api/issues.rb +1 -2
- data/lib/github_api/issues/comments.rb +2 -2
- data/lib/github_api/issues/labels.rb +2 -4
- data/lib/github_api/issues/milestones.rb +2 -4
- data/lib/github_api/orgs/teams.rb +3 -4
- data/lib/github_api/repos.rb +9 -3
- data/lib/github_api/repos/commits.rb +2 -2
- data/lib/github_api/repos/downloads.rb +1 -2
- data/lib/github_api/repos/hooks.rb +2 -8
- data/lib/github_api/repos/keys.rb +2 -3
- data/lib/github_api/validation.rb +5 -1
- data/lib/github_api/version.rb +1 -1
- data/spec/github/api_factory_spec.rb +2 -1
- data/spec/github/api_spec.rb +4 -2
- data/spec/github/authorization_spec.rb +19 -28
- data/spec/github/authorizations_spec.rb +2 -1
- data/spec/github/client_spec.rb +4 -1
- data/spec/github/deprecation_spec.rb +2 -1
- data/spec/github/error/client_error_spec.rb +28 -0
- data/spec/github/error/invalid_options_spec.rb +21 -0
- data/spec/github/error/required_params_spec.rb +21 -0
- data/spec/github/events_spec.rb +4 -4
- data/spec/github/filter_spec.rb +2 -2
- data/spec/github/gists/comments_spec.rb +8 -4
- data/spec/github/gists_spec.rb +19 -14
- data/spec/github/git_data/blobs_spec.rb +10 -4
- data/spec/github/git_data/commits_spec.rb +13 -6
- data/spec/github/git_data/references_spec.rb +13 -8
- data/spec/github/git_data/tags_spec.rb +8 -3
- data/spec/github/git_data/trees_spec.rb +9 -3
- data/spec/github/issues/comments_spec.rb +10 -3
- data/spec/github/issues/events_spec.rb +8 -3
- data/spec/github/issues/labels_spec.rb +13 -7
- data/spec/github/issues/milestones_spec.rb +10 -3
- data/spec/github/issues_spec.rb +3 -3
- data/spec/github/mime_type_spec.rb +64 -64
- data/spec/github/orgs/members_spec.rb +2 -11
- data/spec/github/orgs/teams_spec.rb +9 -9
- data/spec/github/orgs_spec.rb +22 -8
- data/spec/github/page_iterator_spec.rb +2 -1
- data/spec/github/page_links_spec.rb +2 -1
- data/spec/github/paged_request_spec.rb +2 -1
- data/spec/github/pull_requests/comments_spec.rb +9 -3
- data/spec/github/pull_requests_spec.rb +6 -2
- data/spec/github/repos/collaborators_spec.rb +12 -7
- data/spec/github/repos/commits_spec.rb +20 -14
- data/spec/github/repos/downloads_spec.rb +19 -8
- data/spec/github/repos/forks_spec.rb +6 -3
- data/spec/github/repos/hooks_spec.rb +14 -8
- data/spec/github/repos/keys_spec.rb +8 -6
- data/spec/github/repos/pub_sub_hubbub_spec.rb +4 -11
- data/spec/github/repos/watching_spec.rb +15 -38
- data/spec/github/repos_spec.rb +35 -39
- data/spec/github/request_spec.rb +4 -0
- data/spec/github/response/helpers_spec.rb +0 -2
- data/spec/github/result_spec.rb +2 -3
- data/spec/github/users/followers_spec.rb +6 -8
- data/spec/github/users_spec.rb +123 -123
- data/spec/github/validation_spec.rb +8 -7
- data/spec/github_spec.rb +6 -7
- data/spec/spec_helper.rb +2 -2
- metadata +36 -21
- data/features/cassettes/gists/star.yml +0 -34
- data/features/cassettes/pagination/repos/per_page/1.yml +0 -134
- data/features/cassettes/repos/teams.yml +0 -38
@@ -1,10 +1,16 @@
|
|
1
|
-
|
1
|
+
# encoding: utf-8
|
2
2
|
|
3
|
-
|
3
|
+
require 'spec_helper'
|
4
4
|
|
5
|
+
describe Github::GitData::References do
|
6
|
+
let(:github) { Github.new }
|
7
|
+
let(:user) { 'peter-murach' }
|
8
|
+
let(:repo) { 'github' }
|
5
9
|
let(:ref) { "heads/master" }
|
6
10
|
let(:sha) { "3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15" }
|
7
11
|
|
12
|
+
after { github.user, github.repo, github.oauth_token = nil, nil, nil }
|
13
|
+
|
8
14
|
it { described_class::VALID_REF_PARAM_NAMES.should_not be_nil }
|
9
15
|
it { described_class::VALID_REF_PARAM_VALUES.should_not be_nil }
|
10
16
|
|
@@ -23,7 +29,6 @@ describe Github::GitData::References, :type => :base do
|
|
23
29
|
end
|
24
30
|
|
25
31
|
it "should fail to get resource without username" do
|
26
|
-
github.user, github.repo = nil, nil
|
27
32
|
expect { github.git_data.references }.to raise_error(ArgumentError)
|
28
33
|
end
|
29
34
|
|
@@ -161,7 +166,7 @@ describe Github::GitData::References, :type => :base do
|
|
161
166
|
it "should fail to create resource if 'sha' input is missing" do
|
162
167
|
expect {
|
163
168
|
github.git_data.create_reference user, repo, inputs.except('sha')
|
164
|
-
}.to raise_error(
|
169
|
+
}.to raise_error(Github::Error::RequiredParams)
|
165
170
|
end
|
166
171
|
|
167
172
|
it "should fail to create resource if 'ref' is wrong" do
|
@@ -217,13 +222,13 @@ describe Github::GitData::References, :type => :base do
|
|
217
222
|
to_return(:body => fixture('git_data/reference.json'), :status => 201, :headers => {:content_type => "application/json; charset=utf-8"})
|
218
223
|
end
|
219
224
|
|
220
|
-
it "should fail to
|
225
|
+
it "should fail to update resource if 'sha' input is missing" do
|
221
226
|
expect {
|
222
227
|
github.git_data.update_reference user, repo, ref, inputs.except('sha')
|
223
|
-
}.to raise_error(
|
228
|
+
}.to raise_error(Github::Error::RequiredParams)
|
224
229
|
end
|
225
230
|
|
226
|
-
it "should fail to
|
231
|
+
it "should fail to update resource if 'ref' is wrong" do
|
227
232
|
expect {
|
228
233
|
github.git_data.update_reference user, repo, 'branch', inputs
|
229
234
|
}.to raise_error(ArgumentError)
|
@@ -245,7 +250,7 @@ describe Github::GitData::References, :type => :base do
|
|
245
250
|
end
|
246
251
|
end
|
247
252
|
|
248
|
-
context "failed to
|
253
|
+
context "failed to update resource" do
|
249
254
|
before do
|
250
255
|
stub_patch("/repos/#{user}/#{repo}/git/refs/#{ref}").with(inputs).
|
251
256
|
to_return(:body => fixture('git_data/reference.json'), :status => 404, :headers => {:content_type => "application/json; charset=utf-8"})
|
@@ -1,9 +1,15 @@
|
|
1
|
-
|
1
|
+
# encoding: utf-8
|
2
2
|
|
3
|
-
|
3
|
+
require 'spec_helper'
|
4
4
|
|
5
|
+
describe Github::GitData::Tags do
|
6
|
+
let(:github) { Github.new }
|
7
|
+
let(:user) { 'peter-murach' }
|
8
|
+
let(:repo) { 'github' }
|
5
9
|
let(:sha) { "940bd336248efae0f9ee5bc7b2d5c985887b16ac" }
|
6
10
|
|
11
|
+
after { github.user, github.repo, github.oauth_token = nil, nil, nil }
|
12
|
+
|
7
13
|
it { described_class::VALID_TAG_PARAM_NAMES.should_not be_nil }
|
8
14
|
|
9
15
|
describe "tag" do
|
@@ -97,7 +103,6 @@ describe Github::GitData::Tags, :type => :base do
|
|
97
103
|
stub_post("/repos/#{user}/#{repo}/git/tags").
|
98
104
|
with(inputs).
|
99
105
|
to_return(:body => fixture('git_data/tag.json'), :status => 404, :headers => {:content_type => "application/json; charset=utf-8"})
|
100
|
-
|
101
106
|
end
|
102
107
|
|
103
108
|
it "should faile to retrieve resource" do
|
@@ -1,9 +1,15 @@
|
|
1
|
-
|
1
|
+
# encoding: utf-8
|
2
2
|
|
3
|
-
|
3
|
+
require 'spec_helper'
|
4
4
|
|
5
|
+
describe Github::GitData::Trees do
|
6
|
+
let(:github) { Github.new }
|
7
|
+
let(:user) { 'peter-murach' }
|
8
|
+
let(:repo) { 'github' }
|
5
9
|
let(:sha) { "9fb037999f264ba9a7fc6274d15fa3ae2ab98312" }
|
6
10
|
|
11
|
+
after { github.user, github.repo, github.oauth_token = nil, nil, nil }
|
12
|
+
|
7
13
|
it { described_class::VALID_TREE_PARAM_NAMES.should_not be_nil }
|
8
14
|
|
9
15
|
describe "tree" do
|
@@ -96,7 +102,7 @@ describe Github::GitData::Trees, :type => :base do
|
|
96
102
|
it "should fail to create resource if 'content' input is missing" do
|
97
103
|
expect {
|
98
104
|
github.git_data.create_tree user, repo, inputs.except('tree')
|
99
|
-
}.to raise_error(
|
105
|
+
}.to raise_error(Github::Error::RequiredParams)
|
100
106
|
end
|
101
107
|
|
102
108
|
it "should create resource successfully" do
|
@@ -1,9 +1,16 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
|
-
describe Github::Issues::Comments
|
5
|
+
describe Github::Issues::Comments do
|
6
|
+
let(:github) { Github.new }
|
7
|
+
let(:user) { 'peter-murach' }
|
8
|
+
let(:repo) { 'github' }
|
4
9
|
let!(:comment_id) { 1 }
|
5
10
|
let!(:issue_id) { 1 }
|
6
11
|
|
12
|
+
after { github.user, github.repo, github.oauth_token = nil, nil, nil }
|
13
|
+
|
7
14
|
it { described_class::VALID_ISSUE_COMMENT_PARAM_NAME.should_not be_nil }
|
8
15
|
|
9
16
|
describe 'comments' do
|
@@ -128,7 +135,7 @@ describe Github::Issues::Comments, :type => :base do
|
|
128
135
|
it "should fail to create resource if 'body' input is missing" do
|
129
136
|
expect {
|
130
137
|
github.issues.create_comment user, repo, issue_id, inputs.except('body')
|
131
|
-
}.to raise_error(
|
138
|
+
}.to raise_error(Github::Error::RequiredParams)
|
132
139
|
end
|
133
140
|
|
134
141
|
it "should create resource successfully" do
|
@@ -177,7 +184,7 @@ describe Github::Issues::Comments, :type => :base do
|
|
177
184
|
it "should fail to create resource if 'body' input is missing" do
|
178
185
|
expect {
|
179
186
|
github.issues.edit_comment user, repo, comment_id, inputs.except('body')
|
180
|
-
}.to raise_error(
|
187
|
+
}.to raise_error(Github::Error::RequiredParams)
|
181
188
|
end
|
182
189
|
|
183
190
|
it "should create resource successfully" do
|
@@ -1,8 +1,15 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
|
-
describe Github::Issues::Events
|
5
|
+
describe Github::Issues::Events do
|
6
|
+
let(:github) { Github.new }
|
7
|
+
let(:user) { 'peter-murach' }
|
8
|
+
let(:repo) { 'github' }
|
4
9
|
let(:issue_id) { 1 }
|
5
10
|
|
11
|
+
after { github.user, github.repo, github.oauth_token = nil, nil, nil }
|
12
|
+
|
6
13
|
describe 'events' do
|
7
14
|
it { github.issues.should respond_to :events }
|
8
15
|
it { github.issues.should respond_to :list_events }
|
@@ -17,7 +24,6 @@ describe Github::Issues::Events, :type => :base do
|
|
17
24
|
end
|
18
25
|
|
19
26
|
it "should fail to get resource without username" do
|
20
|
-
github.user, github.repo = nil, nil
|
21
27
|
expect { github.issues.events }.to raise_error(ArgumentError)
|
22
28
|
end
|
23
29
|
|
@@ -60,7 +66,6 @@ describe Github::Issues::Events, :type => :base do
|
|
60
66
|
}.to raise_error(Github::Error::NotFound)
|
61
67
|
end
|
62
68
|
end
|
63
|
-
|
64
69
|
end # without issue_id
|
65
70
|
|
66
71
|
context 'with issue_id' do
|
@@ -1,6 +1,11 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe Github::Issues::Labels
|
3
|
+
describe Github::Issues::Labels do
|
4
|
+
let(:github) { Github.new }
|
5
|
+
let(:user) { 'peter-murach' }
|
6
|
+
let(:repo) { 'github' }
|
7
|
+
|
8
|
+
after { github.user, github.repo, github.oauth_token = nil, nil, nil }
|
4
9
|
|
5
10
|
it { described_class::VALID_LABEL_INPUTS.should_not be_nil }
|
6
11
|
|
@@ -123,13 +128,13 @@ describe Github::Issues::Labels, :type => :base do
|
|
123
128
|
it "should fail to create resource if 'name' input is missing" do
|
124
129
|
expect {
|
125
130
|
github.issues.create_label user, repo, inputs.except('name')
|
126
|
-
}.to raise_error(
|
131
|
+
}.to raise_error(Github::Error::RequiredParams)
|
127
132
|
end
|
128
133
|
|
129
134
|
it "should fail to create resource if 'color' input is missing" do
|
130
135
|
expect {
|
131
136
|
github.issues.create_label user, repo, inputs.except('color')
|
132
|
-
}.to raise_error(
|
137
|
+
}.to raise_error(Github::Error::RequiredParams)
|
133
138
|
end
|
134
139
|
|
135
140
|
it "should create resource successfully" do
|
@@ -181,13 +186,13 @@ describe Github::Issues::Labels, :type => :base do
|
|
181
186
|
it "should fail to create resource if 'name' input is missing" do
|
182
187
|
expect {
|
183
188
|
github.issues.update_label user, repo, label_id, inputs.except('name')
|
184
|
-
}.to raise_error(
|
189
|
+
}.to raise_error(Github::Error::RequiredParams)
|
185
190
|
end
|
186
191
|
|
187
192
|
it "should fail to create resource if 'color' input is missing" do
|
188
193
|
expect {
|
189
194
|
github.issues.update_label user, repo, label_id, inputs.except('color')
|
190
|
-
}.to raise_error(
|
195
|
+
}.to raise_error(Github::Error::RequiredParams)
|
191
196
|
end
|
192
197
|
|
193
198
|
it "should update resource successfully" do
|
@@ -274,13 +279,14 @@ describe Github::Issues::Labels, :type => :base do
|
|
274
279
|
|
275
280
|
it "should fail to get resource without issue_id" do
|
276
281
|
expect {
|
277
|
-
github.issues.labels_for user, repo, nil
|
282
|
+
github.issues.labels_for user, repo, nil
|
278
283
|
}.to raise_error(ArgumentError)
|
279
284
|
end
|
280
285
|
|
281
286
|
it "should get the resources" do
|
282
287
|
github.issues.labels_for user, repo, issue_id
|
283
|
-
a_get("/repos/#{user}/#{repo}/issues/#{issue_id}/labels").
|
288
|
+
a_get("/repos/#{user}/#{repo}/issues/#{issue_id}/labels").
|
289
|
+
should have_been_made
|
284
290
|
end
|
285
291
|
|
286
292
|
it "should return array of resources" do
|
@@ -1,6 +1,13 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
|
-
describe Github::Issues::Milestones
|
5
|
+
describe Github::Issues::Milestones do
|
6
|
+
let(:github) { Github.new }
|
7
|
+
let(:user) { 'peter-murach' }
|
8
|
+
let(:repo) { 'github' }
|
9
|
+
|
10
|
+
after { github.user, github.repo, github.oauth_token = nil, nil, nil }
|
4
11
|
|
5
12
|
it { described_class::VALID_MILESTONE_OPTIONS.should_not be_nil }
|
6
13
|
it { described_class::VALID_MILESTONE_INPUTS.should_not be_nil }
|
@@ -127,7 +134,7 @@ describe Github::Issues::Milestones, :type => :base do
|
|
127
134
|
it "should fail to create resource if 'title' input is missing" do
|
128
135
|
expect {
|
129
136
|
github.issues.create_milestone user, repo, inputs.except('title')
|
130
|
-
}.to raise_error(
|
137
|
+
}.to raise_error(Github::Error::RequiredParams)
|
131
138
|
end
|
132
139
|
|
133
140
|
it "should create resource successfully" do
|
@@ -181,7 +188,7 @@ describe Github::Issues::Milestones, :type => :base do
|
|
181
188
|
it "should fail to create resource if 'title' input is missing" do
|
182
189
|
expect {
|
183
190
|
github.issues.update_milestone user, repo, milestone_id, inputs.except('title')
|
184
|
-
}.to raise_error(
|
191
|
+
}.to raise_error(Github::Error::RequiredParams)
|
185
192
|
end
|
186
193
|
|
187
194
|
it "should update resource successfully" do
|
data/spec/github/issues_spec.rb
CHANGED
@@ -3,12 +3,13 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
describe Github::Issues do
|
6
|
-
|
7
6
|
let(:issues_api) { Github::Issues }
|
8
7
|
let(:github) { Github.new }
|
9
8
|
let(:user) { 'peter-murach' }
|
10
9
|
let(:repo) { 'github' }
|
11
10
|
|
11
|
+
after { github.user, github.repo, github.oauth_token = nil, nil, nil }
|
12
|
+
|
12
13
|
describe 'modules inclusion' do
|
13
14
|
it { issues_api.included_modules.should include Github::Issues::Comments }
|
14
15
|
it { issues_api.included_modules.should include Github::Issues::Events }
|
@@ -193,7 +194,7 @@ describe Github::Issues do
|
|
193
194
|
it "should fail to create resource if 'title' input is missing" do
|
194
195
|
expect {
|
195
196
|
github.issues.create_issue user, repo, inputs.except('title')
|
196
|
-
}.to raise_error(
|
197
|
+
}.to raise_error(Github::Error::RequiredParams)
|
197
198
|
end
|
198
199
|
|
199
200
|
it "should create resource successfully" do
|
@@ -248,7 +249,6 @@ describe Github::Issues do
|
|
248
249
|
end
|
249
250
|
|
250
251
|
it "should fail to edit without 'user/repo' parameters" do
|
251
|
-
github.user, github.repo = nil, nil
|
252
252
|
expect {
|
253
253
|
github.issues.edit_issue nil, repo, issue_id
|
254
254
|
}.to raise_error(ArgumentError)
|
@@ -2,69 +2,69 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Github::MimeType do
|
4
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
|
-
|
5
|
+
# let(:github) { Github.new }
|
6
|
+
#
|
7
|
+
# it "should lookup mime type for :full" do
|
8
|
+
# github.lookup_mime(:full).should == 'full+json'
|
9
|
+
# end
|
10
|
+
#
|
11
|
+
# it "should lookup mime type for :html" do
|
12
|
+
# github.lookup_mime(:html).should == 'html+json'
|
13
|
+
# end
|
14
|
+
#
|
15
|
+
# it "should lookup mime type for :html" do
|
16
|
+
# github.lookup_mime(:text).should == 'text+json'
|
17
|
+
# end
|
18
|
+
#
|
19
|
+
# it "should lookup mime type for :raw" do
|
20
|
+
# github.lookup_mime(:raw).should == 'raw+json'
|
21
|
+
# end
|
22
|
+
#
|
23
|
+
# it "should default to json if no parameters given" do
|
24
|
+
# Github.should_receive(:parse).and_return 'application/json'
|
25
|
+
# Github.parse.should == 'application/json'
|
26
|
+
# end
|
27
|
+
#
|
28
|
+
# it "should accept header for 'issue' request" do
|
29
|
+
# Github.should_receive(:parse).with(:issue, :full).
|
30
|
+
# and_return 'application/vnd.github-issue.full+json'
|
31
|
+
# Github.parse(:issue, :full).should == 'application/vnd.github-issue.full+json'
|
32
|
+
# end
|
33
|
+
#
|
34
|
+
# it "should accept header for 'isssue comment' request" do
|
35
|
+
# Github.should_receive(:parse).with(:issue_comment, :full).
|
36
|
+
# and_return 'application/vnd.github-issuecomment.full+json'
|
37
|
+
# Github.parse(:issue_comment, :full).should == 'application/vnd.github-issuecomment.full+json'
|
38
|
+
# end
|
39
|
+
#
|
40
|
+
# it "should accept header for 'commit comment' request" do
|
41
|
+
# Github.should_receive(:parse).with(:commit_comment, :full).
|
42
|
+
# and_return 'application/vnd.github-commitcomment.full+json'
|
43
|
+
# Github.parse(:commit_comment, :full).should == 'application/vnd.github-commitcomment.full+json'
|
44
|
+
# end
|
45
|
+
#
|
46
|
+
# it "should accept header for 'pull requst' request" do
|
47
|
+
# Github.should_receive(:parse).with(:pull_request, :full).
|
48
|
+
# and_return 'application/vnd.github-pull.full+json'
|
49
|
+
# Github.parse(:pull_request, :full).should == 'application/vnd.github-pull.full+json'
|
50
|
+
# end
|
51
|
+
#
|
52
|
+
# it "should accept header for 'pull comment' request" do
|
53
|
+
# Github.should_receive(:parse).with(:pull_comment, :full).
|
54
|
+
# and_return 'application/vnd.github-pullcomment.full+json'
|
55
|
+
# Github.parse(:pull_comment, :full).should == 'application/vnd.github-pullcomment.full+json'
|
56
|
+
# end
|
57
|
+
#
|
58
|
+
# it "should accept header for 'gist comment' request" do
|
59
|
+
# Github.should_receive(:parse).with(:gist_comment, :full).
|
60
|
+
# and_return 'application/vnd.github-gistcomment.full+json'
|
61
|
+
# Github.parse(:gist_comment, :full).should == 'application/vnd.github-gistcomment.full+json'
|
62
|
+
# end
|
63
|
+
#
|
64
|
+
# it "should accept header for 'blog' request" do
|
65
|
+
# Github.should_receive(:parse).with(:blob, :blob).
|
66
|
+
# and_return 'application/vnd.github-blob.raw'
|
67
|
+
# Github.parse(:blob, :blob).should == 'application/vnd.github-blob.raw'
|
68
|
+
# end
|
69
69
|
|
70
70
|
end # Github::MimeType
|
@@ -1,11 +1,12 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Github::Orgs::Members do
|
4
|
-
|
5
4
|
let(:github) { Github.new }
|
6
5
|
let(:member) { 'peter-murach' }
|
7
6
|
let(:org) { 'github' }
|
8
7
|
|
8
|
+
after { github.user, github.repo, github.oauth_token = nil, nil, nil }
|
9
|
+
|
9
10
|
describe "members" do
|
10
11
|
context "resource found" do
|
11
12
|
before do
|
@@ -59,13 +60,9 @@ describe Github::Orgs::Members do
|
|
59
60
|
end # members
|
60
61
|
|
61
62
|
describe "member?" do
|
62
|
-
|
63
63
|
context "with username ane reponame passed" do
|
64
|
-
|
65
64
|
context "this repo is being watched by the user"
|
66
65
|
before do
|
67
|
-
github.oauth_token = nil
|
68
|
-
github.user = nil
|
69
66
|
stub_get("/orgs/#{org}/members/#{member}").
|
70
67
|
to_return(:body => "", :status => 404, :headers => {:user_agent => github.user_agent})
|
71
68
|
end
|
@@ -81,7 +78,6 @@ describe Github::Orgs::Members do
|
|
81
78
|
membership = github.orgs.member? org, member
|
82
79
|
membership.should be_true
|
83
80
|
end
|
84
|
-
|
85
81
|
end
|
86
82
|
|
87
83
|
context "without org name and member name passed" do
|
@@ -144,13 +140,9 @@ describe Github::Orgs::Members do
|
|
144
140
|
end # public_members
|
145
141
|
|
146
142
|
describe "public_member?" do
|
147
|
-
|
148
143
|
context "with username ane reponame passed" do
|
149
|
-
|
150
144
|
context "this repo is being watched by the user"
|
151
145
|
before do
|
152
|
-
github.oauth_token = nil
|
153
|
-
github.user = nil
|
154
146
|
stub_get("/orgs/#{org}/public_members/#{member}").
|
155
147
|
to_return(:body => "", :status => 404, :headers => {:user_agent => github.user_agent})
|
156
148
|
end
|
@@ -166,7 +158,6 @@ describe Github::Orgs::Members do
|
|
166
158
|
public_member = github.orgs.public_member? org, member
|
167
159
|
public_member.should be_true
|
168
160
|
end
|
169
|
-
|
170
161
|
end
|
171
162
|
|
172
163
|
context "without org name and member name passed" do
|