github_api 0.4.6 → 0.4.7

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.
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,15 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Github::Orgs::Teams, :type => :base do
4
-
3
+ describe Github::Orgs::Teams do
4
+ let(:github) { Github.new }
5
+ let(:user) { 'peter-murach' }
6
+ let(:org) { 'github' }
7
+ let(:repo) { 'github' }
5
8
  let(:team) { 'github' }
6
9
  let(:member) { 'github' }
7
10
 
11
+ after { github.user, github.repo, github.oauth_token = nil, nil, nil }
12
+
8
13
  describe "teams" do
9
14
  context "resource found" do
10
15
  before do
@@ -106,7 +111,6 @@ describe Github::Orgs::Teams, :type => :base do
106
111
  before do
107
112
  stub_post("/orgs/#{org}/teams").with(inputs).
108
113
  to_return(:body => fixture('orgs/team.json'), :status => 201, :headers => {:content_type => "application/json; charset=utf-8"})
109
-
110
114
  end
111
115
 
112
116
  it "should fail to create resource if 'org_name' param is missing" do
@@ -116,7 +120,7 @@ describe Github::Orgs::Teams, :type => :base do
116
120
  it "should failt to create resource if 'name' input is missing" do
117
121
  expect {
118
122
  github.orgs.create_team org, inputs.except(:name)
119
- }.to raise_error(ArgumentError)
123
+ }.to raise_error(Github::Error::RequiredParams)
120
124
  end
121
125
 
122
126
  it "should create resource successfully" do
@@ -139,7 +143,6 @@ describe Github::Orgs::Teams, :type => :base do
139
143
  before do
140
144
  stub_post("/orgs/#{org}/teams").with(inputs).
141
145
  to_return(:body => fixture('orgs/team.json'), :status => 404, :headers => {:content_type => "application/json; charset=utf-8"})
142
-
143
146
  end
144
147
 
145
148
  it "should faile to retrieve resource" do
@@ -167,7 +170,7 @@ describe Github::Orgs::Teams, :type => :base do
167
170
  it "should failt to create resource if 'name' input is missing" do
168
171
  expect {
169
172
  github.orgs.edit_team team, inputs.except(:name)
170
- }.to raise_error(ArgumentError)
173
+ }.to raise_error(Github::Error::RequiredParams)
171
174
  end
172
175
 
173
176
  it "should create resource successfully" do
@@ -190,7 +193,6 @@ describe Github::Orgs::Teams, :type => :base do
190
193
  before do
191
194
  stub_patch("/teams/#{team}").with(inputs).
192
195
  to_return(:body => fixture('orgs/team.json'), :status => 404, :headers => {:content_type => "application/json; charset=utf-8"})
193
-
194
196
  end
195
197
 
196
198
  it "should faile to retrieve resource" do
@@ -290,8 +292,6 @@ describe Github::Orgs::Teams, :type => :base do
290
292
 
291
293
  context "this repo is being watched by the user"
292
294
  before do
293
- github.oauth_token = nil
294
- github.user = nil
295
295
  stub_get("/teams/#{team}/members/#{member}").
296
296
  to_return(:body => "", :status => 404, :headers => {:user_agent => github.user_agent})
297
297
  end
@@ -1,6 +1,14 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'spec_helper'
2
4
 
3
- describe Github::Orgs, :type => :base do
5
+ describe Github::Orgs do
6
+ let(:github) { Github.new }
7
+ let(:user) { 'peter-murach' }
8
+ let(:repo) { 'github' }
9
+ let(:org) { 'github' }
10
+
11
+ after { github.user, github.repo, github.oauth_token = nil, nil, nil }
4
12
 
5
13
  describe "orgs" do
6
14
  context "resource found for a user" do
@@ -38,19 +46,18 @@ describe Github::Orgs, :type => :base do
38
46
 
39
47
  context "resource found for an au user" do
40
48
  before do
41
- github.user = nil
42
49
  github.oauth_token = OAUTH_TOKEN
43
- stub_get("/user/orgs?access_token=#{OAUTH_TOKEN}").
50
+ stub_get("/user/orgs").
51
+ with(:query => { :access_token => OAUTH_TOKEN }).
44
52
  to_return(:body => fixture('orgs/orgs.json'), :status => 200, :headers => {:content_type => "application/json; charset=utf-8"})
45
53
  end
46
54
 
47
- after do
48
- github.user, github.oauth_token = nil, nil
49
- end
55
+ after { github.oauth_token = nil }
50
56
 
51
57
  it "should get the resources" do
52
58
  github.orgs.orgs
53
- a_get("/user/orgs?access_token=#{OAUTH_TOKEN}").should have_been_made
59
+ a_get("/user/orgs").with(:query => { :access_token => OAUTH_TOKEN }).
60
+ should have_been_made
54
61
  end
55
62
  end
56
63
 
@@ -111,7 +118,14 @@ describe Github::Orgs, :type => :base do
111
118
  end # org
112
119
 
113
120
  describe "edit_org" do
114
- let(:inputs) { { :billing_email => 'support@github.com', :blog => "https://github.com/blog", :company => "GitHub", :email => "support@github.com", :location => "San Francisco", :name => "github" } }
121
+ let(:inputs) do
122
+ { :billing_email => 'support@github.com',
123
+ :blog => "https://github.com/blog",
124
+ :company => "GitHub",
125
+ :email => "support@github.com",
126
+ :location => "San Francisco",
127
+ :name => "github" }
128
+ end
115
129
 
116
130
  context "resource edited successfully" do
117
131
  before do
@@ -1,7 +1,8 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Github::PageIterator do
4
-
5
6
  let(:link) {
6
7
  "<https://api.github.com/users/wycats/repos?page=4&per_page=20>; rel=\"next\", <https://api.github.com/users/wycats/repos?page=6&per_page=20>; rel=\"last\", <https://api.github.com/users/wycats/repos?page=1&per_page=20>; rel=\"first\", <https://api.github.com/users/wycats/repos?page=2&per_page=20>; rel=\"prev\""
7
8
  }
@@ -1,7 +1,8 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Github::PageLinks do
4
-
5
6
  let(:link) {
6
7
  "<https://api.github.com/users/wycats/repos?page=4&per_page=20>; rel=\"next\", <https://api.github.com/users/wycats/repos?page=6&per_page=20>; rel=\"last\", <https://api.github.com/users/wycats/repos?page=1&per_page=20>; rel=\"first\", <https://api.github.com/users/wycats/repos?page=2&per_page=20>; rel=\"prev\""
7
8
  }
@@ -1,7 +1,8 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Github::PagedRequest do
4
-
5
6
  it { described_class.constants.should include :FIRST_PAGE }
6
7
  it { described_class.constants.should include :PER_PAGE }
7
8
 
@@ -1,10 +1,16 @@
1
- require 'spec_helper'
1
+ # encoding: utf-8
2
2
 
3
- describe Github::PullRequests::Comments, :type => :base do
3
+ require 'spec_helper'
4
4
 
5
+ describe Github::PullRequests::Comments do
6
+ let(:github) { Github.new }
7
+ let(:user) { 'peter-murach' }
8
+ let(:repo) { 'github' }
5
9
  let(:pull_request_id) { 1 }
6
10
  let(:comment_id) { 1 }
7
11
 
12
+ after { reset_authentication_for github }
13
+
8
14
  describe "#comments" do
9
15
  context 'check aliases' do
10
16
  it { github.pull_requests.should respond_to :comments }
@@ -260,6 +266,6 @@ describe Github::PullRequests::Comments, :type => :base do
260
266
  github.pull_requests.delete_comment user, repo, comment_id
261
267
  }.to raise_error(Github::Error::NotFound)
262
268
  end
263
- end # delete_gist
269
+ end # delete_comment
264
270
 
265
271
  end # Github::PullRequests::Comments
@@ -1,9 +1,13 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Github::PullRequests, :type => :base do
4
-
3
+ describe Github::PullRequests do
4
+ let(:github) { Github.new }
5
+ let(:user) { 'peter-murach' }
6
+ let(:repo) { 'github' }
5
7
  let(:pull_request_id) { 1 }
6
8
 
9
+ after { reset_authentication_for github }
10
+
7
11
  describe "#pull_requests" do
8
12
  context 'check aliases' do
9
13
  it { github.pull_requests.should respond_to :pulls }
@@ -1,6 +1,12 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Github::Repos::Collaborators, :type => :base do
3
+ describe Github::Repos::Collaborators do
4
+ let(:github) { Github.new }
5
+ let(:user) { 'peter-murach' }
6
+ let(:repo) { 'github' }
7
+ let(:collaborator) { 'octocat' }
8
+
9
+ after { github.user, github.repo, github.oauth_token = nil, nil, nil }
4
10
 
5
11
  describe "collaborators" do
6
12
  context "resource found" do
@@ -10,7 +16,6 @@ describe Github::Repos::Collaborators, :type => :base do
10
16
  end
11
17
 
12
18
  it "should fail to get resource without username" do
13
- github.user, github.repo = nil, nil
14
19
  expect { github.repos.collaborators }.to raise_error(ArgumentError)
15
20
  end
16
21
 
@@ -65,7 +70,7 @@ describe Github::Repos::Collaborators, :type => :base do
65
70
 
66
71
  it "should fail to get resource without collaborator name" do
67
72
  expect {
68
- github.repos.collaborator?(user, repo, nil)
73
+ github.repos.collaborator? user, repo, nil
69
74
  }.to raise_error(ArgumentError)
70
75
  end
71
76
 
@@ -75,7 +80,8 @@ describe Github::Repos::Collaborators, :type => :base do
75
80
  end
76
81
 
77
82
  it "should find collaborator" do
78
- github.repos.should_receive(:collaborator?).with(user, repo, collaborator).and_return true
83
+ github.repos.should_receive(:collaborator?).
84
+ with(user, repo, collaborator) { true }
79
85
  github.repos.collaborator? user, repo, collaborator
80
86
  end
81
87
  end
@@ -87,14 +93,14 @@ describe Github::Repos::Collaborators, :type => :base do
87
93
  end
88
94
 
89
95
  it "should fail to retrieve resource" do
90
- github.repos.should_receive(:collaborator?).with(user, repo, collaborator).and_return false
96
+ github.repos.should_receive(:collaborator?).
97
+ with(user, repo, collaborator) { false }
91
98
  github.repos.collaborator? user, repo, collaborator
92
99
  end
93
100
  end
94
101
  end # collaborator?
95
102
 
96
103
  describe "add_collaborator" do
97
-
98
104
  context "resouce added" do
99
105
  before do
100
106
  stub_put("/repos/#{user}/#{repo}/collaborators/#{collaborator}").
@@ -128,7 +134,6 @@ describe Github::Repos::Collaborators, :type => :base do
128
134
  end # add_collaborator
129
135
 
130
136
  describe "remove_collaborator" do
131
-
132
137
  context "resouce added" do
133
138
  before do
134
139
  stub_delete("/repos/#{user}/#{repo}/collaborators/#{collaborator}").
@@ -1,6 +1,10 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Github::Repos::Commits, :type => :base do
3
+ describe Github::Repos::Commits do
4
+ let(:github) { Github.new }
5
+ let(:user) { 'peter-murach' }
6
+ let(:repo) { 'github' }
7
+ after { github.user, github.repo = nil, nil }
4
8
 
5
9
  describe "commits" do
6
10
  context "resource found" do
@@ -10,7 +14,6 @@ describe Github::Repos::Commits, :type => :base do
10
14
  end
11
15
 
12
16
  it "should fail to get resource without username" do
13
- github.user, github.repo = nil, nil
14
17
  expect { github.repos.commits }.to raise_error(ArgumentError)
15
18
  end
16
19
 
@@ -84,7 +87,6 @@ describe Github::Repos::Commits, :type => :base do
84
87
  commit = github.repos.commit user, repo, sha
85
88
  commit.should be_a Hashie::Mash
86
89
  end
87
-
88
90
  end
89
91
 
90
92
  context "resource not found" do
@@ -109,7 +111,6 @@ describe Github::Repos::Commits, :type => :base do
109
111
  end
110
112
 
111
113
  it "should fail to get resource without username" do
112
- github.user, github.repo = nil, nil
113
114
  expect { github.repos.repo_comments }.to raise_error(ArgumentError)
114
115
  end
115
116
 
@@ -171,7 +172,8 @@ describe Github::Repos::Commits, :type => :base do
171
172
 
172
173
  it "should get the resource" do
173
174
  github.repos.commit_comments user, repo, sha
174
- a_get("/repos/#{user}/#{repo}/commits/#{sha}/comments").should have_been_made
175
+ a_get("/repos/#{user}/#{repo}/commits/#{sha}/comments").
176
+ should have_been_made
175
177
  end
176
178
 
177
179
  it "should return array of resources" do
@@ -239,7 +241,6 @@ describe Github::Repos::Commits, :type => :base do
239
241
  commit_comment = github.repos.commit_comment user, repo, comment_id
240
242
  commit_comment.should be_a Hashie::Mash
241
243
  end
242
-
243
244
  end
244
245
 
245
246
  context "resource not found" do
@@ -258,43 +259,48 @@ describe Github::Repos::Commits, :type => :base do
258
259
 
259
260
  describe "create_comment" do
260
261
  let(:sha) { '23432dfosfsufd' }
261
- let(:inputs) { {'body'=> 'web', :commit_id => 1, :line => 1, :path => 'file1.txt', :position => 4 } }
262
+ let(:inputs) do
263
+ { 'body' => 'web',
264
+ :commit_id => 1,
265
+ :line => 1,
266
+ :path => 'file1.txt',
267
+ :position => 4 }
268
+ end
262
269
 
263
270
  context "resouce created" do
264
271
  before do
265
272
  stub_post("/repos/#{user}/#{repo}/commits/#{sha}/comments").with(inputs).
266
273
  to_return(:body => fixture('repos/commit_comment.json'), :status => 201, :headers => {:content_type => "application/json; charset=utf-8"})
267
-
268
274
  end
269
275
 
270
276
  it "should fail to create resource if 'body' input is missing" do
271
277
  expect {
272
278
  github.repos.create_comment user, repo, sha, inputs.except('body')
273
- }.to raise_error(ArgumentError)
279
+ }.to raise_error(Github::Error::RequiredParams)
274
280
  end
275
281
 
276
282
  it "should fail to create resource if 'commit_id' input is missing" do
277
283
  expect {
278
284
  github.repos.create_comment user, repo, sha, inputs.except(:commit_id)
279
- }.to raise_error(ArgumentError)
285
+ }.to raise_error(Github::Error::RequiredParams)
280
286
  end
281
287
 
282
288
  it "should fail to create resource if 'line' input is missing" do
283
289
  expect {
284
290
  github.repos.create_comment user, repo, sha, inputs.except(:line)
285
- }.to raise_error(ArgumentError)
291
+ }.to raise_error(Github::Error::RequiredParams)
286
292
  end
287
293
 
288
294
  it "should fail to create resource if 'path' input is missing" do
289
295
  expect {
290
296
  github.repos.create_comment user, repo, sha, inputs.except(:path)
291
- }.to raise_error(ArgumentError)
297
+ }.to raise_error(Github::Error::RequiredParams)
292
298
  end
293
299
 
294
300
  it "should fail to create resource if 'position' input is missing" do
295
301
  expect {
296
302
  github.repos.create_comment user, repo, sha, inputs.except(:position)
297
- }.to raise_error(ArgumentError)
303
+ }.to raise_error(Github::Error::RequiredParams)
298
304
  end
299
305
 
300
306
  it "should create resource successfully" do
@@ -383,7 +389,7 @@ describe Github::Repos::Commits, :type => :base do
383
389
  it "should fail to create resource if 'body' input is missing" do
384
390
  expect {
385
391
  github.repos.update_comment user, repo, comment_id, inputs.except('body')
386
- }.to raise_error(ArgumentError)
392
+ }.to raise_error(Github::Error::RequiredParams)
387
393
  end
388
394
 
389
395
  it "should create resource successfully" do
@@ -1,6 +1,13 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'spec_helper'
2
4
 
3
- describe Github::Repos::Downloads, :type => :base do
5
+ describe Github::Repos::Downloads 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_DOWNLOAD_PARAM_NAMES.should_not be_nil }
6
13
  it { described_class::REQUIRED_PARAMS.should_not be_nil }
@@ -18,7 +25,6 @@ describe Github::Repos::Downloads, :type => :base do
18
25
  end
19
26
 
20
27
  it "should fail to get resource without username" do
21
- github.user, github.repo = nil, nil
22
28
  expect { github.repos.downloads }.to raise_error(ArgumentError)
23
29
  end
24
30
 
@@ -76,7 +82,9 @@ describe Github::Repos::Downloads, :type => :base do
76
82
  end
77
83
 
78
84
  it "should fail to get resource without download id" do
79
- expect { github.repos.download(user, repo, nil)}.to raise_error(ArgumentError)
85
+ expect {
86
+ github.repos.download(user, repo, nil)
87
+ }.to raise_error(ArgumentError)
80
88
  end
81
89
 
82
90
  it "should get the resource" do
@@ -164,13 +172,13 @@ describe Github::Repos::Downloads, :type => :base do
164
172
  it "should fail to create resource if 'name' input is missing" do
165
173
  expect {
166
174
  github.repos.create_download user, repo, inputs.except(:name)
167
- }.to raise_error(ArgumentError)
175
+ }.to raise_error(Github::Error::RequiredParams)
168
176
  end
169
177
 
170
178
  it "should failt to create resource if 'size' input is missing" do
171
179
  expect {
172
180
  github.repos.create_download user, repo, inputs.except(:size)
173
- }.to raise_error(ArgumentError)
181
+ }.to raise_error(Github::Error::RequiredParams)
174
182
  end
175
183
 
176
184
  it "should create resource successfully" do
@@ -193,7 +201,6 @@ describe Github::Repos::Downloads, :type => :base do
193
201
  before do
194
202
  stub_post("/repos/#{user}/#{repo}/downloads").with(inputs).
195
203
  to_return(:body => fixture('repos/download_s3.json'), :status => 404, :headers => {:content_type => "application/json; charset=utf-8"})
196
-
197
204
  end
198
205
 
199
206
  it "should faile to retrieve resource" do
@@ -205,7 +212,12 @@ describe Github::Repos::Downloads, :type => :base do
205
212
  end # create_download
206
213
 
207
214
  describe 'upload' do
208
- let(:inputs) { {:name => 'new_file.jpg', :size => 114034, :description => "Latest release", :content_type => 'text/plain'} }
215
+ let(:inputs) do
216
+ { :name => 'new_file.jpg',
217
+ :size => 114034,
218
+ :description => "Latest release",
219
+ :content_type => 'text/plain' }
220
+ end
209
221
  let(:resource) { Hashie::Mash.new ::JSON.parse(fixture('repos/download_s3.json').read) }
210
222
  let(:file) { 'filename' }
211
223
 
@@ -236,7 +248,6 @@ describe Github::Repos::Downloads, :type => :base do
236
248
  github.repos.upload resource, file
237
249
  }.to raise_error(Github::Error::NotFound)
238
250
  end
239
-
240
251
  end
241
252
  end # upload
242
253