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.
Files changed (97) hide show
  1. data/features/cassettes/errors/repos/create.yml +33 -23
  2. data/features/cassettes/gists/comments/all.yml +116 -106
  3. data/features/cassettes/gists/comments/first.yml +41 -31
  4. data/features/cassettes/gists/gist.yml +61 -50
  5. data/features/cassettes/gists/gists/public_all.yml +31 -58
  6. data/features/cassettes/gists/gists/user_all.yml +44 -34
  7. data/features/cassettes/pagination/repos.yml +161 -287
  8. data/features/cassettes/pagination/repos/commits.yml +174 -299
  9. data/features/cassettes/pagination/repos/commits/next.yml +166 -161
  10. data/features/cassettes/pagination/repos/commits/sha.yml +127 -121
  11. data/features/cassettes/pagination/repos/commits/sha/next.yml +130 -250
  12. data/features/cassettes/pagination/repos/diff.yml +126 -154
  13. data/features/cassettes/pagination/repos/diff/next.yml +123 -246
  14. data/features/cassettes/pagination/repos/next.yml +162 -157
  15. data/features/cassettes/pagination/repos/per_page/each_page.yml +370 -352
  16. data/features/cassettes/pagination/repos/per_page/first.yml +127 -121
  17. data/features/cassettes/repos/branches.yml +38 -65
  18. data/features/cassettes/repos/tags.yml +127 -175
  19. data/features/support/vcr.rb +2 -2
  20. data/lib/github_api/authorization.rb +3 -3
  21. data/lib/github_api/error.rb +3 -0
  22. data/lib/github_api/error/client_error.rb +20 -0
  23. data/lib/github_api/error/invalid_options.rb +18 -0
  24. data/lib/github_api/error/required_params.rb +18 -0
  25. data/lib/github_api/error/service_error.rb +1 -1
  26. data/lib/github_api/error/validations.rb +18 -0
  27. data/lib/github_api/gists.rb +1 -5
  28. data/lib/github_api/gists/comments.rb +2 -8
  29. data/lib/github_api/git_data/blobs.rb +1 -2
  30. data/lib/github_api/git_data/commits.rb +1 -2
  31. data/lib/github_api/git_data/references.rb +2 -4
  32. data/lib/github_api/git_data/trees.rb +1 -1
  33. data/lib/github_api/issues.rb +1 -2
  34. data/lib/github_api/issues/comments.rb +2 -2
  35. data/lib/github_api/issues/labels.rb +2 -4
  36. data/lib/github_api/issues/milestones.rb +2 -4
  37. data/lib/github_api/orgs/teams.rb +3 -4
  38. data/lib/github_api/repos.rb +9 -3
  39. data/lib/github_api/repos/commits.rb +2 -2
  40. data/lib/github_api/repos/downloads.rb +1 -2
  41. data/lib/github_api/repos/hooks.rb +2 -8
  42. data/lib/github_api/repos/keys.rb +2 -3
  43. data/lib/github_api/validation.rb +5 -1
  44. data/lib/github_api/version.rb +1 -1
  45. data/spec/github/api_factory_spec.rb +2 -1
  46. data/spec/github/api_spec.rb +4 -2
  47. data/spec/github/authorization_spec.rb +19 -28
  48. data/spec/github/authorizations_spec.rb +2 -1
  49. data/spec/github/client_spec.rb +4 -1
  50. data/spec/github/deprecation_spec.rb +2 -1
  51. data/spec/github/error/client_error_spec.rb +28 -0
  52. data/spec/github/error/invalid_options_spec.rb +21 -0
  53. data/spec/github/error/required_params_spec.rb +21 -0
  54. data/spec/github/events_spec.rb +4 -4
  55. data/spec/github/filter_spec.rb +2 -2
  56. data/spec/github/gists/comments_spec.rb +8 -4
  57. data/spec/github/gists_spec.rb +19 -14
  58. data/spec/github/git_data/blobs_spec.rb +10 -4
  59. data/spec/github/git_data/commits_spec.rb +13 -6
  60. data/spec/github/git_data/references_spec.rb +13 -8
  61. data/spec/github/git_data/tags_spec.rb +8 -3
  62. data/spec/github/git_data/trees_spec.rb +9 -3
  63. data/spec/github/issues/comments_spec.rb +10 -3
  64. data/spec/github/issues/events_spec.rb +8 -3
  65. data/spec/github/issues/labels_spec.rb +13 -7
  66. data/spec/github/issues/milestones_spec.rb +10 -3
  67. data/spec/github/issues_spec.rb +3 -3
  68. data/spec/github/mime_type_spec.rb +64 -64
  69. data/spec/github/orgs/members_spec.rb +2 -11
  70. data/spec/github/orgs/teams_spec.rb +9 -9
  71. data/spec/github/orgs_spec.rb +22 -8
  72. data/spec/github/page_iterator_spec.rb +2 -1
  73. data/spec/github/page_links_spec.rb +2 -1
  74. data/spec/github/paged_request_spec.rb +2 -1
  75. data/spec/github/pull_requests/comments_spec.rb +9 -3
  76. data/spec/github/pull_requests_spec.rb +6 -2
  77. data/spec/github/repos/collaborators_spec.rb +12 -7
  78. data/spec/github/repos/commits_spec.rb +20 -14
  79. data/spec/github/repos/downloads_spec.rb +19 -8
  80. data/spec/github/repos/forks_spec.rb +6 -3
  81. data/spec/github/repos/hooks_spec.rb +14 -8
  82. data/spec/github/repos/keys_spec.rb +8 -6
  83. data/spec/github/repos/pub_sub_hubbub_spec.rb +4 -11
  84. data/spec/github/repos/watching_spec.rb +15 -38
  85. data/spec/github/repos_spec.rb +35 -39
  86. data/spec/github/request_spec.rb +4 -0
  87. data/spec/github/response/helpers_spec.rb +0 -2
  88. data/spec/github/result_spec.rb +2 -3
  89. data/spec/github/users/followers_spec.rb +6 -8
  90. data/spec/github/users_spec.rb +123 -123
  91. data/spec/github/validation_spec.rb +8 -7
  92. data/spec/github_spec.rb +6 -7
  93. data/spec/spec_helper.rb +2 -2
  94. metadata +36 -21
  95. data/features/cassettes/gists/star.yml +0 -34
  96. data/features/cassettes/pagination/repos/per_page/1.yml +0 -134
  97. data/features/cassettes/repos/teams.yml +0 -38
@@ -1,10 +1,16 @@
1
- require 'spec_helper'
1
+ # encoding: utf-8
2
2
 
3
- describe Github::GitData::References, :type => :base do
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(ArgumentError)
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 create resource if 'sha' input is missing" do
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(ArgumentError)
228
+ }.to raise_error(Github::Error::RequiredParams)
224
229
  end
225
230
 
226
- it "should fail to create resource if 'ref' is wrong" do
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 create resource" do
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
- require 'spec_helper'
1
+ # encoding: utf-8
2
2
 
3
- describe Github::GitData::Tags, :type => :base do
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
- require 'spec_helper'
1
+ # encoding: utf-8
2
2
 
3
- describe Github::GitData::Trees, :type => :base do
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(ArgumentError)
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, :type => :base do
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(ArgumentError)
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(ArgumentError)
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, :type => :base do
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, :type => :base do
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(ArgumentError)
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(ArgumentError)
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(ArgumentError)
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(ArgumentError)
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").should have_been_made
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, :type => :base do
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(ArgumentError)
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(ArgumentError)
191
+ }.to raise_error(Github::Error::RequiredParams)
185
192
  end
186
193
 
187
194
  it "should update resource successfully" do
@@ -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(ArgumentError)
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
- 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
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