github_api 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (163) hide show
  1. data/README.md +50 -5
  2. data/features/cassettes/git_data/commits/get.yml +69 -0
  3. data/features/git_data/commmits.feature +14 -0
  4. data/lib/github_api.rb +1 -0
  5. data/lib/github_api/activity/events.rb +42 -33
  6. data/lib/github_api/activity/notifications.rb +22 -22
  7. data/lib/github_api/activity/starring.rb +16 -21
  8. data/lib/github_api/activity/watching.rb +16 -19
  9. data/lib/github_api/api.rb +51 -8
  10. data/lib/github_api/arguments.rb +155 -0
  11. data/lib/github_api/authorizations.rb +19 -20
  12. data/lib/github_api/configuration.rb +5 -0
  13. data/lib/github_api/emojis.rb +3 -3
  14. data/lib/github_api/error/validations.rb +2 -2
  15. data/lib/github_api/gists.rb +32 -42
  16. data/lib/github_api/gists/comments.rb +21 -23
  17. data/lib/github_api/git_data/blobs.rb +13 -16
  18. data/lib/github_api/git_data/commits.rb +12 -10
  19. data/lib/github_api/git_data/references.rb +24 -28
  20. data/lib/github_api/git_data/tags.rb +9 -11
  21. data/lib/github_api/git_data/trees.rb +10 -13
  22. data/lib/github_api/gitignore.rb +4 -6
  23. data/lib/github_api/issues.rb +24 -32
  24. data/lib/github_api/issues/assignees.rb +11 -8
  25. data/lib/github_api/issues/comments.rb +21 -26
  26. data/lib/github_api/issues/events.rb +7 -9
  27. data/lib/github_api/issues/labels.rb +39 -53
  28. data/lib/github_api/issues/milestones.rb +26 -33
  29. data/lib/github_api/markdown.rb +5 -6
  30. data/lib/github_api/meta.rb +3 -3
  31. data/lib/github_api/orgs.rb +10 -11
  32. data/lib/github_api/orgs/members.rb +18 -20
  33. data/lib/github_api/orgs/teams.rb +54 -58
  34. data/lib/github_api/pull_requests.rb +40 -54
  35. data/lib/github_api/pull_requests/comments.rb +19 -26
  36. data/lib/github_api/repos.rb +146 -101
  37. data/lib/github_api/repos/collaborators.rb +29 -30
  38. data/lib/github_api/repos/comments.rb +20 -25
  39. data/lib/github_api/repos/commits.rb +12 -14
  40. data/lib/github_api/repos/contents.rb +22 -14
  41. data/lib/github_api/repos/downloads.rb +19 -23
  42. data/lib/github_api/repos/forks.rb +6 -11
  43. data/lib/github_api/repos/hooks.rb +25 -34
  44. data/lib/github_api/repos/keys.rb +25 -27
  45. data/lib/github_api/repos/merging.rb +7 -6
  46. data/lib/github_api/repos/pub_sub_hubbub.rb +14 -18
  47. data/lib/github_api/repos/statuses.rb +13 -14
  48. data/lib/github_api/say.rb +1 -3
  49. data/lib/github_api/search.rb +12 -21
  50. data/lib/github_api/users.rb +10 -9
  51. data/lib/github_api/users/emails.rb +11 -9
  52. data/lib/github_api/users/followers.rb +25 -23
  53. data/lib/github_api/users/keys.rb +27 -29
  54. data/lib/github_api/version.rb +1 -1
  55. data/spec/github/activity/events/org_spec.rb +6 -6
  56. data/spec/github/activity/events/performed_spec.rb +1 -1
  57. data/spec/github/activity/events/received_spec.rb +1 -1
  58. data/spec/github/activity/events/user_org_spec.rb +4 -2
  59. data/spec/github/activity/notifications/create_spec.rb +1 -1
  60. data/spec/github/activity/notifications/delete_spec.rb +1 -1
  61. data/spec/github/activity/notifications/get_spec.rb +1 -1
  62. data/spec/github/activity/notifications/subscribed_spec.rb +1 -1
  63. data/spec/github/activity/starring/list_spec.rb +2 -0
  64. data/spec/github/activity/starring/starring_spec.rb +1 -1
  65. data/spec/github/activity/watching/list_spec.rb +2 -0
  66. data/spec/github/activity/watching/watching_spec.rb +1 -3
  67. data/spec/github/api/set_spec.rb +18 -4
  68. data/spec/github/api/with_spec.rb +28 -0
  69. data/spec/github/api_spec.rb +11 -33
  70. data/spec/github/arguments/parse_spec.rb +68 -0
  71. data/spec/github/authorizations/delete_spec.rb +1 -1
  72. data/spec/github/authorizations/get_spec.rb +1 -1
  73. data/spec/github/error/validations_spec.rb +3 -3
  74. data/spec/github/gists/comments/list_spec.rb +1 -1
  75. data/spec/github/gists/delete_spec.rb +1 -1
  76. data/spec/github/gists/fork_spec.rb +1 -1
  77. data/spec/github/gists/get_spec.rb +1 -1
  78. data/spec/github/gists/is_starred_spec.rb +2 -0
  79. data/spec/github/gists/star_spec.rb +1 -1
  80. data/spec/github/gists/unstar_spec.rb +1 -1
  81. data/spec/github/git_data/blobs/create_spec.rb +2 -0
  82. data/spec/github/git_data/blobs/get_spec.rb +1 -1
  83. data/spec/github/git_data/commits/create_spec.rb +2 -0
  84. data/spec/github/git_data/commits/get_spec.rb +3 -3
  85. data/spec/github/git_data/references/create_spec.rb +1 -1
  86. data/spec/github/git_data/references/delete_spec.rb +3 -1
  87. data/spec/github/git_data/tags/create_spec.rb +2 -0
  88. data/spec/github/gitignore/get_spec.rb +1 -1
  89. data/spec/github/issues/events/get_spec.rb +3 -1
  90. data/spec/github/issues/events/list_spec.rb +3 -1
  91. data/spec/github/issues/labels/add_spec.rb +6 -6
  92. data/spec/github/issues/labels/list_spec.rb +3 -1
  93. data/spec/github/issues/labels/replace_spec.rb +6 -7
  94. data/spec/github/issues/milestones/get_spec.rb +2 -0
  95. data/spec/github/normalizer_spec.rb +18 -6
  96. data/spec/github/orgs/members/conceal_spec.rb +6 -4
  97. data/spec/github/orgs/members/delete_spec.rb +2 -0
  98. data/spec/github/orgs/members/list_spec.rb +1 -1
  99. data/spec/github/orgs/members/member_spec.rb +3 -1
  100. data/spec/github/orgs/members/publicize_spec.rb +2 -0
  101. data/spec/github/orgs/teams/add_member_spec.rb +2 -0
  102. data/spec/github/orgs/teams/create_spec.rb +1 -1
  103. data/spec/github/orgs/teams/delete_spec.rb +1 -1
  104. data/spec/github/orgs/teams/edit_spec.rb +1 -1
  105. data/spec/github/orgs/teams/get_spec.rb +1 -1
  106. data/spec/github/orgs/teams/list_spec.rb +1 -1
  107. data/spec/github/orgs/teams/team_member_spec.rb +3 -1
  108. data/spec/github/parameter_filter_spec.rb +19 -58
  109. data/spec/github/pull_requests/comments/create_spec.rb +3 -1
  110. data/spec/github/pull_requests/comments/delete_spec.rb +1 -1
  111. data/spec/github/pull_requests/comments/edit_spec.rb +2 -0
  112. data/spec/github/pull_requests/comments/get_spec.rb +3 -1
  113. data/spec/github/pull_requests/comments/list_spec.rb +3 -1
  114. data/spec/github/pull_requests/commits_spec.rb +3 -3
  115. data/spec/github/pull_requests/create_spec.rb +4 -0
  116. data/spec/github/pull_requests/files_spec.rb +4 -0
  117. data/spec/github/pull_requests/get_spec.rb +3 -3
  118. data/spec/github/pull_requests/list_spec.rb +3 -3
  119. data/spec/github/pull_requests/merge_spec.rb +2 -0
  120. data/spec/github/pull_requests/merged_spec.rb +3 -1
  121. data/spec/github/pull_requests/update_spec.rb +4 -0
  122. data/spec/github/repos/collaborators/add_spec.rb +3 -1
  123. data/spec/github/repos/collaborators/get_spec.rb +1 -3
  124. data/spec/github/repos/collaborators/list_spec.rb +5 -1
  125. data/spec/github/repos/collaborators/remove_spec.rb +3 -1
  126. data/spec/github/repos/comments/create_spec.rb +4 -0
  127. data/spec/github/repos/comments/delete_spec.rb +2 -2
  128. data/spec/github/repos/comments/get_spec.rb +6 -2
  129. data/spec/github/repos/commits/compare_spec.rb +3 -3
  130. data/spec/github/repos/commits/get_spec.rb +3 -3
  131. data/spec/github/repos/commits/list_spec.rb +3 -3
  132. data/spec/github/repos/contents/archive_spec.rb +12 -0
  133. data/spec/github/repos/contents/get_spec.rb +5 -0
  134. data/spec/github/repos/contributors_spec.rb +7 -2
  135. data/spec/github/repos/downloads/create_spec.rb +4 -0
  136. data/spec/github/repos/downloads/delete_spec.rb +5 -1
  137. data/spec/github/repos/downloads/get_spec.rb +3 -1
  138. data/spec/github/repos/downloads/list_spec.rb +3 -1
  139. data/spec/github/repos/forks/create_spec.rb +2 -0
  140. data/spec/github/repos/forks/list_spec.rb +3 -1
  141. data/spec/github/repos/hooks/edit_spec.rb +1 -1
  142. data/spec/github/repos/keys/delete_spec.rb +1 -1
  143. data/spec/github/repos/keys/edit_spec.rb +2 -0
  144. data/spec/github/repos/keys/get_spec.rb +3 -1
  145. data/spec/github/repos/keys/list_spec.rb +4 -2
  146. data/spec/github/repos/list_spec.rb +6 -1
  147. data/spec/github/repos/pub_sub_hubbub/subscribe_service_spec.rb +27 -0
  148. data/spec/github/repos/pub_sub_hubbub/subscribe_spec.rb +51 -0
  149. data/spec/github/repos/pub_sub_hubbub/unsubscribe_service_spec.rb +21 -0
  150. data/spec/github/repos/pub_sub_hubbub/unsubscribe_spec.rb +58 -0
  151. data/spec/github/repos/statuses/create_spec.rb +2 -0
  152. data/spec/github/search_spec.rb +25 -10
  153. data/spec/github/users/followers/follow_spec.rb +1 -1
  154. data/spec/github/users/followers/is_following_spec.rb +1 -1
  155. data/spec/github/users/followers/unfollow_spec.rb +1 -1
  156. data/spec/github/users/keys/delete_spec.rb +1 -1
  157. data/spec/github/users/keys/get_spec.rb +1 -1
  158. data/spec/github/users/keys/update_spec.rb +1 -1
  159. data/spec/github/users/update_spec.rb +1 -1
  160. data/spec/integration/arguments_spec.rb +76 -0
  161. data/spec/{github → integration}/authorizations_spec.rb +0 -0
  162. metadata +44 -35
  163. data/spec/github/repos/pub_sub_hubbub_spec.rb +0 -78
@@ -22,6 +22,8 @@ describe Github::Orgs::Members, '#publicize' do
22
22
  expect { subject.publicize }.to raise_error(ArgumentError)
23
23
  end
24
24
 
25
+ it { expect { subject.publicize org }.to raise_error(ArgumentError) }
26
+
25
27
  it "should get the resources" do
26
28
  subject.publicize org, member
27
29
  a_put(request_path).should have_been_made
@@ -18,6 +18,8 @@ describe Github::Orgs::Teams, '#add_member' do
18
18
  let(:body) { '' }
19
19
  let(:status) { 204 }
20
20
 
21
+ it { expect { subject.add_member }.to raise_error(ArgumentError)}
22
+
21
23
  it "should fail to add resource if 'team_id' input is nil" do
22
24
  expect { subject.add_member nil, user }.to raise_error(ArgumentError)
23
25
  end
@@ -26,7 +26,7 @@ describe Github::Orgs::Teams, '#create' do
26
26
  let(:status) { 201 }
27
27
 
28
28
  it "should fail to create resource if 'org_name' param is missing" do
29
- expect { subject.create nil, inputs }.to raise_error(ArgumentError)
29
+ expect { subject.create }.to raise_error(ArgumentError)
30
30
  end
31
31
 
32
32
  it "should failt to create resource if 'name' input is missing" do
@@ -20,7 +20,7 @@ describe Github::Orgs::Teams, '#delete' do
20
20
  it { should respond_to :remove }
21
21
 
22
22
  it "should fail to delete without 'team_id' parameter" do
23
- expect { subject.delete nil }.to raise_error(ArgumentError)
23
+ expect { subject.delete }.to raise_error(ArgumentError)
24
24
  end
25
25
 
26
26
  it "should delete the resource" do
@@ -25,7 +25,7 @@ describe Github::Orgs::Teams, '#edit' do
25
25
  let(:status) { 200 }
26
26
 
27
27
  it "should fail to create resource if 'team name' param is missing" do
28
- expect { subject.edit nil, inputs }.to raise_error(ArgumentError)
28
+ expect { subject.edit }.to raise_error(ArgumentError)
29
29
  end
30
30
 
31
31
  it "should failt to create resource if 'name' input is missing" do
@@ -18,7 +18,7 @@ describe Github::Orgs::Teams, '#get' do
18
18
  let(:status) { 200 }
19
19
 
20
20
  it "should fail to get resource without org name" do
21
- expect { subject.get nil }.to raise_error(ArgumentError)
21
+ expect { subject.get }.to raise_error(ArgumentError)
22
22
  end
23
23
 
24
24
  it "should get the resource" do
@@ -18,7 +18,7 @@ describe Github::Orgs::Teams, '#list' do
18
18
  let(:status) { 200 }
19
19
 
20
20
  it "should fail to get resource without org name" do
21
- expect { subject.list nil }.to raise_error(ArgumentError)
21
+ expect { subject.list }.to raise_error(ArgumentError)
22
22
  end
23
23
 
24
24
  it "should get the resources" do
@@ -18,8 +18,10 @@ describe Github::Orgs::Teams, '#team_member?' do
18
18
  context 'when user is a member' do
19
19
  let(:status) { 204 }
20
20
 
21
+ it { expect { subject.team_member?(team_id, nil)}.to raise_error(ArgumentError)}
22
+
21
23
  it "should fail validation " do
22
- expect { subject.team_member?(nil, nil) }.to raise_error(ArgumentError)
24
+ expect { subject.team_member? }.to raise_error(ArgumentError)
23
25
  end
24
26
 
25
27
  it "should return true if resoure found" do
@@ -1,71 +1,32 @@
1
1
  require 'spec_helper'
2
2
  require 'github_api/core_ext/hash'
3
3
 
4
- describe Github::ParameterFilter do
5
- let(:github) { Github.new }
6
- let(:repos_instance) { Github::Repos.new }
7
- let(:block) {
8
- Proc.new do |repo|
9
- repo = repos_instance
10
- end
11
- }
4
+ describe Github::ParameterFilter, '#filter!' do
12
5
  let(:hash) { { :a => { :b => { :c => 1 } } } }
13
6
 
14
- context '#filter!' do
15
- it 'removes unwanted keys from hash' do
16
- github.repos.filter!([:a], hash)
17
- hash.all_keys.should include :a
18
- hash.all_keys.should_not include :b
19
- hash.all_keys.should_not include :c
7
+ let(:klass) {
8
+ Class.new do
9
+ include Github::ParameterFilter
20
10
  end
11
+ }
21
12
 
22
- it 'recursively filters inputs tree' do
23
- github.repos.filter!([:a, :b], hash)
24
- hash.all_keys.should_not include :c
25
- end
13
+ subject(:instance) { klass.new }
26
14
 
27
- it 'filters inputs tree only on top level' do
28
- github.repos.filter!([:a, :b], hash, :recursive => false)
29
- hash.all_keys.should include :c
30
- end
15
+ it 'removes unwanted keys from hash' do
16
+ instance.filter!([:a], hash)
17
+ hash.all_keys.should include :a
18
+ hash.all_keys.should_not include :b
19
+ hash.all_keys.should_not include :c
31
20
  end
32
21
 
33
- # context '#process_params' do
34
- #
35
- # it 'correctly yields current api instance' do
36
- # github.repos.should_receive(:process_params).and_yield repos_instance
37
- # github.repos.process_params(&block).should eq repos_instance
38
- # end
39
- # end
40
-
41
- # context '#normalize' do
42
- # it 'should call normalize on passed block' do
43
- # github.repos.process_params(&block).should respond_to :normalize
44
- # end
45
- #
46
- # it 'should normalize params inside block' do
47
- # github.repos.stub(:process_params).and_yield repos_instance
48
- # github.repos.process_params do |repo|
49
- # repo.normalize hash
50
- # end
51
- # hash.all_keys.should include 'a'
52
- # hash.all_keys.should_not include :a
53
- # end
54
- # end
22
+ it 'recursively filters inputs tree' do
23
+ instance.filter!([:a, :b], hash)
24
+ hash.all_keys.should_not include :c
25
+ end
55
26
 
56
- # context '#filter' do
57
- # it 'should call filter on passed block' do
58
- # github.repos.process_params(&block).should respond_to :filter
59
- # end
60
- #
61
- # it 'should filter params inside block' do
62
- # github.repos.stub(:process_params).and_yield repos_instance
63
- # github.repos.process_params do |repo|
64
- # repo.filter [:a], hash
65
- # end
66
- # hash.all_keys.should include :a
67
- # hash.all_keys.should_not include :b
68
- # end
69
- # end
27
+ it 'filters inputs tree only on top level' do
28
+ instance.filter!([:a, :b], hash, :recursive => false)
29
+ hash.all_keys.should include :c
30
+ end
70
31
 
71
32
  end # Github::ParameterFilter
@@ -30,8 +30,10 @@ describe Github::PullRequests::Comments, '#create' do
30
30
  let(:body) { fixture('pull_requests/comment.json') }
31
31
  let(:status) { 201 }
32
32
 
33
+ it { expect { subject.create }.to raise_error(ArgumentError) }
34
+
33
35
  it 'raises error when pull_request_id is missing' do
34
- expect { subject.create user, repo, nil }.to raise_error(ArgumentError)
36
+ expect { subject.create user, repo }.to raise_error(ArgumentError)
35
37
  end
36
38
 
37
39
  it "should create resource successfully" do
@@ -20,7 +20,7 @@ describe Github::PullRequests::Comments, '#delete' do
20
20
 
21
21
  context 'resource removed' do
22
22
  it 'should raise error if comment_id not present' do
23
- expect { subject.delete user, repo, nil }.to raise_error(ArgumentError)
23
+ expect { subject.delete user, repo }.to raise_error(ArgumentError)
24
24
  end
25
25
 
26
26
  it "should remove resource successfully" do
@@ -26,6 +26,8 @@ describe Github::PullRequests::Comments, '#edit' do
26
26
  let(:body) { fixture('pull_requests/comment.json') }
27
27
  let(:status) { 200 }
28
28
 
29
+ it { expect { subject.edit }.to raise_error(ArgumentError) }
30
+
29
31
  it "should edit resource successfully" do
30
32
  subject.edit user, repo, comment_id, inputs
31
33
  a_patch(request_path).with(inputs).should have_been_made
@@ -22,8 +22,10 @@ describe Github::PullRequests::Comments, '#get' do
22
22
 
23
23
  it { should respond_to :find }
24
24
 
25
+ it { expect { subject.get }.to raise_error(ArgumentError) }
26
+
25
27
  it "should fail to get resource without comment id" do
26
- expect { subject.get user, repo, nil }.to raise_error(ArgumentError)
28
+ expect { subject.get user, repo }.to raise_error(ArgumentError)
27
29
  end
28
30
 
29
31
  it "should get the resource" do
@@ -21,8 +21,10 @@ describe Github::PullRequests::Comments, '#list' do
21
21
 
22
22
  it { should respond_to :all }
23
23
 
24
+ it { expect { subject.list }.to raise_error(ArgumentError) }
25
+
24
26
  it "throws error if comment id not provided" do
25
- expect { subject.list user, nil }.to raise_error(ArgumentError)
27
+ expect { subject.list user }.to raise_error(ArgumentError)
26
28
  end
27
29
 
28
30
  it "should get the resources" do
@@ -19,9 +19,9 @@ describe Github::PullRequests, '#commits' do
19
19
  let(:body) { fixture('pull_requests/commits.json') }
20
20
  let(:status) { 200 }
21
21
 
22
- it "throws error if pull_request_id not provided" do
23
- expect { subject.commits user, repo, nil }.to raise_error(ArgumentError)
24
- end
22
+ it { expect { subject.commits user, repo }.to raise_error(ArgumentError) }
23
+
24
+ it { expect { subject.commits }.to raise_error(ArgumentError) }
25
25
 
26
26
  it "should get the resources" do
27
27
  subject.commits user, repo, number
@@ -29,6 +29,10 @@ describe Github::PullRequests, '#create' do
29
29
  let(:body) { fixture('pull_requests/pull_request.json') }
30
30
  let(:status) { 201 }
31
31
 
32
+ it { expect { subject.create }.to raise_error(ArgumentError) }
33
+
34
+ it { expect { subject.create user }.to raise_error(ArgumentError) }
35
+
32
36
  it "should create resource successfully" do
33
37
  subject.create user, repo, inputs
34
38
  a_post(request_path).with(inputs).should have_been_made
@@ -19,6 +19,10 @@ describe Github::PullRequests, '#files' do
19
19
  let(:body) { fixture('pull_requests/files.json') }
20
20
  let(:status) { 200 }
21
21
 
22
+ it { expect { subject.files }.to raise_error(ArgumentError) }
23
+
24
+ it { expect { subject.files user }.to raise_error(ArgumentError) }
25
+
22
26
  it "should get the resources" do
23
27
  subject.files user, repo, number
24
28
  a_get(request_path).should have_been_made
@@ -21,9 +21,9 @@ describe Github::PullRequests, '#get' do
21
21
 
22
22
  it { should respond_to :find }
23
23
 
24
- it "should fail to get resource without pull_request id" do
25
- expect { subject.get nil }.to raise_error(ArgumentError)
26
- end
24
+ it { expect { subject.get }.to raise_error(ArgumentError) }
25
+
26
+ it { expect { subject.get user }.to raise_error(ArgumentError) }
27
27
 
28
28
  it "should get the resource" do
29
29
  subject.get user, repo, number
@@ -22,9 +22,9 @@ describe Github::PullRequests, '#list' do
22
22
 
23
23
  it { should respond_to :all }
24
24
 
25
- it "throws error if pull_request id not provided" do
26
- expect { subject.list nil }.to raise_error(ArgumentError)
27
- end
25
+ it { expect { subject.list }.to raise_error(ArgumentError) }
26
+
27
+ it { expect { subject.list user }.to raise_error(ArgumentError) }
28
28
 
29
29
  it "should get the resources" do
30
30
  subject.list user, repo, inputs
@@ -19,6 +19,8 @@ describe Github::PullRequests, '#merge' do
19
19
  let(:body) { fixture('pull_requests/merge_success.json') }
20
20
  let(:status) { 200 }
21
21
 
22
+ it { expect { subject.merge }.to raise_error(ArgumentError) }
23
+
22
24
  it 'performs request' do
23
25
  subject.merge user, repo, number
24
26
  a_put(request_path).should have_been_made
@@ -18,8 +18,10 @@ describe Github::PullRequests, '#merged?' do
18
18
  :headers => {:user_agent => subject.user_agent})
19
19
  }
20
20
 
21
+ it { expect { subject.merged? }.to raise_error(ArgumentError) }
22
+
21
23
  it "should fail validation " do
22
- expect { subject.merged?(nil, nil, number) }.to raise_error(ArgumentError)
24
+ expect { subject.merged?(user, repo) }.to raise_error(ArgumentError)
23
25
  end
24
26
 
25
27
  it "should return false if resource not found" do
@@ -28,6 +28,10 @@ describe Github::PullRequests, '#update' do
28
28
  let(:body) { fixture('pull_requests/pull_request.json') }
29
29
  let(:status) { 201 }
30
30
 
31
+ it { expect { subject.update }.to raise_error(ArgumentError) }
32
+
33
+ it { expect { subject.update user }.to raise_error(ArgumentError) }
34
+
31
35
  it "should create resource successfully" do
32
36
  subject.update user, repo, number, inputs
33
37
  a_patch(request_path).with(inputs).should have_been_made
@@ -20,8 +20,10 @@ describe Github::Repos::Collaborators, '#add' do
20
20
  let(:body) { '' }
21
21
  let(:status) { 204 }
22
22
 
23
+ it { expect { subject.add }.to raise_error(ArgumentError) }
24
+
23
25
  it "should fail to add resource if 'collaborator' input is missing" do
24
- expect { subject.add user, repo, nil }.to raise_error(ArgumentError)
26
+ expect { subject.add user, repo }.to raise_error(ArgumentError)
25
27
  end
26
28
 
27
29
  it "should add resource successfully" do
@@ -21,9 +21,7 @@ describe Github::Repos::Collaborators, '#collaborator?' do
21
21
  let(:status) { 204 }
22
22
 
23
23
  it "should fail to get resource without collaborator name" do
24
- expect {
25
- subject.collaborator? user, repo, nil
26
- }.to raise_error(ArgumentError)
24
+ expect { subject.collaborator? user, repo }.to raise_error(ArgumentError)
27
25
  end
28
26
 
29
27
  it "should get the resource" do
@@ -19,10 +19,14 @@ describe Github::Repos::Collaborators, '#list' do
19
19
  let(:body) { fixture('repos/collaborators.json') }
20
20
  let(:status) { 200 }
21
21
 
22
- it "should fail to get resource without username" do
22
+ it "should fail to get resource without arguments" do
23
23
  expect { subject.list }.to raise_error(ArgumentError)
24
24
  end
25
25
 
26
+ it "failse to get resource with missing arguments" do
27
+ expect { subject.list user }.to raise_error(ArgumentError)
28
+ end
29
+
26
30
  it "should get the resources" do
27
31
  subject.list user, repo
28
32
  a_get(request_path).should have_been_made
@@ -20,8 +20,10 @@ describe Github::Repos::Collaborators, '#remove' do
20
20
  let(:body) { '' }
21
21
  let(:status) { 204 }
22
22
 
23
+ it { expect { subject.remove }.to raise_error(ArgumentError) }
24
+
23
25
  it "should fail to add resource if 'collaborator' input is missing" do
24
- expect { subject.remove user, repo, nil }.to raise_error(ArgumentError)
26
+ expect { subject.remove user, repo }.to raise_error(ArgumentError)
25
27
  end
26
28
 
27
29
  it "should add resource successfully" do
@@ -27,6 +27,10 @@ describe Github::Repos::Comments, '#create' do
27
27
  let(:body) { fixture('repos/commit_comment.json') }
28
28
  let(:status) { 201 }
29
29
 
30
+ it { expect { subject.create user }.to raise_error(ArgumentError) }
31
+
32
+ it { expect { subject.create }.to raise_error(ArgumentError) }
33
+
30
34
  it "should fail to create resource if 'body' input is missing" do
31
35
  expect {
32
36
  subject.create user, repo, sha, inputs.except('body')
@@ -20,13 +20,13 @@ describe Github::Repos::Comments, '#delete' do
20
20
  let(:body) { '' }
21
21
  let(:status) { 204 }
22
22
 
23
- it "should fail to delete without 'user/repo' parameters" do
23
+ it "should fail to delete without required arguments" do
24
24
  expect { subject.delete }.to raise_error(ArgumentError)
25
25
  end
26
26
 
27
27
  it "should fail to delete resource without 'comment_id'" do
28
28
  expect {
29
- subject.delete user, repo, nil
29
+ subject.delete user, repo
30
30
  }.to raise_error(ArgumentError)
31
31
  end
32
32
 
@@ -21,8 +21,12 @@ describe Github::Repos::Comments, '#get' do
21
21
 
22
22
  it { should respond_to(:find) }
23
23
 
24
- it "should fail to get resource without comment id" do
25
- expect { subject.get user, repo, nil }.to raise_error(ArgumentError)
24
+ it 'failse to get resource without required arguments' do
25
+ expect { subject.get }.to raise_error(ArgumentError)
26
+ end
27
+
28
+ it 'fails to get resource without all required arguments' do
29
+ expect { subject.get user }.to raise_error(ArgumentError)
26
30
  end
27
31
 
28
32
  it "should get the resource" do
@@ -18,10 +18,10 @@ describe Github::Repos::Commits, '#compare' do
18
18
 
19
19
  after { reset_authentication_for(subject) }
20
20
 
21
+ it { expect { subject.compare }.to raise_error(ArgumentError) }
22
+
21
23
  it "should fail to get resource without base" do
22
- expect {
23
- subject.compare user, repo, nil, head
24
- }.to raise_error(ArgumentError)
24
+ expect { subject.compare user, repo, nil, head }.to raise_error(ArgumentError)
25
25
  end
26
26
 
27
27
  it "should compare successfully" do