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.
- data/README.md +50 -5
- data/features/cassettes/git_data/commits/get.yml +69 -0
- data/features/git_data/commmits.feature +14 -0
- data/lib/github_api.rb +1 -0
- data/lib/github_api/activity/events.rb +42 -33
- data/lib/github_api/activity/notifications.rb +22 -22
- data/lib/github_api/activity/starring.rb +16 -21
- data/lib/github_api/activity/watching.rb +16 -19
- data/lib/github_api/api.rb +51 -8
- data/lib/github_api/arguments.rb +155 -0
- data/lib/github_api/authorizations.rb +19 -20
- data/lib/github_api/configuration.rb +5 -0
- data/lib/github_api/emojis.rb +3 -3
- data/lib/github_api/error/validations.rb +2 -2
- data/lib/github_api/gists.rb +32 -42
- data/lib/github_api/gists/comments.rb +21 -23
- data/lib/github_api/git_data/blobs.rb +13 -16
- data/lib/github_api/git_data/commits.rb +12 -10
- data/lib/github_api/git_data/references.rb +24 -28
- data/lib/github_api/git_data/tags.rb +9 -11
- data/lib/github_api/git_data/trees.rb +10 -13
- data/lib/github_api/gitignore.rb +4 -6
- data/lib/github_api/issues.rb +24 -32
- data/lib/github_api/issues/assignees.rb +11 -8
- data/lib/github_api/issues/comments.rb +21 -26
- data/lib/github_api/issues/events.rb +7 -9
- data/lib/github_api/issues/labels.rb +39 -53
- data/lib/github_api/issues/milestones.rb +26 -33
- data/lib/github_api/markdown.rb +5 -6
- data/lib/github_api/meta.rb +3 -3
- data/lib/github_api/orgs.rb +10 -11
- data/lib/github_api/orgs/members.rb +18 -20
- data/lib/github_api/orgs/teams.rb +54 -58
- data/lib/github_api/pull_requests.rb +40 -54
- data/lib/github_api/pull_requests/comments.rb +19 -26
- data/lib/github_api/repos.rb +146 -101
- data/lib/github_api/repos/collaborators.rb +29 -30
- data/lib/github_api/repos/comments.rb +20 -25
- data/lib/github_api/repos/commits.rb +12 -14
- data/lib/github_api/repos/contents.rb +22 -14
- data/lib/github_api/repos/downloads.rb +19 -23
- data/lib/github_api/repos/forks.rb +6 -11
- data/lib/github_api/repos/hooks.rb +25 -34
- data/lib/github_api/repos/keys.rb +25 -27
- data/lib/github_api/repos/merging.rb +7 -6
- data/lib/github_api/repos/pub_sub_hubbub.rb +14 -18
- data/lib/github_api/repos/statuses.rb +13 -14
- data/lib/github_api/say.rb +1 -3
- data/lib/github_api/search.rb +12 -21
- data/lib/github_api/users.rb +10 -9
- data/lib/github_api/users/emails.rb +11 -9
- data/lib/github_api/users/followers.rb +25 -23
- data/lib/github_api/users/keys.rb +27 -29
- data/lib/github_api/version.rb +1 -1
- data/spec/github/activity/events/org_spec.rb +6 -6
- data/spec/github/activity/events/performed_spec.rb +1 -1
- data/spec/github/activity/events/received_spec.rb +1 -1
- data/spec/github/activity/events/user_org_spec.rb +4 -2
- data/spec/github/activity/notifications/create_spec.rb +1 -1
- data/spec/github/activity/notifications/delete_spec.rb +1 -1
- data/spec/github/activity/notifications/get_spec.rb +1 -1
- data/spec/github/activity/notifications/subscribed_spec.rb +1 -1
- data/spec/github/activity/starring/list_spec.rb +2 -0
- data/spec/github/activity/starring/starring_spec.rb +1 -1
- data/spec/github/activity/watching/list_spec.rb +2 -0
- data/spec/github/activity/watching/watching_spec.rb +1 -3
- data/spec/github/api/set_spec.rb +18 -4
- data/spec/github/api/with_spec.rb +28 -0
- data/spec/github/api_spec.rb +11 -33
- data/spec/github/arguments/parse_spec.rb +68 -0
- data/spec/github/authorizations/delete_spec.rb +1 -1
- data/spec/github/authorizations/get_spec.rb +1 -1
- data/spec/github/error/validations_spec.rb +3 -3
- data/spec/github/gists/comments/list_spec.rb +1 -1
- data/spec/github/gists/delete_spec.rb +1 -1
- data/spec/github/gists/fork_spec.rb +1 -1
- data/spec/github/gists/get_spec.rb +1 -1
- data/spec/github/gists/is_starred_spec.rb +2 -0
- data/spec/github/gists/star_spec.rb +1 -1
- data/spec/github/gists/unstar_spec.rb +1 -1
- data/spec/github/git_data/blobs/create_spec.rb +2 -0
- data/spec/github/git_data/blobs/get_spec.rb +1 -1
- data/spec/github/git_data/commits/create_spec.rb +2 -0
- data/spec/github/git_data/commits/get_spec.rb +3 -3
- data/spec/github/git_data/references/create_spec.rb +1 -1
- data/spec/github/git_data/references/delete_spec.rb +3 -1
- data/spec/github/git_data/tags/create_spec.rb +2 -0
- data/spec/github/gitignore/get_spec.rb +1 -1
- data/spec/github/issues/events/get_spec.rb +3 -1
- data/spec/github/issues/events/list_spec.rb +3 -1
- data/spec/github/issues/labels/add_spec.rb +6 -6
- data/spec/github/issues/labels/list_spec.rb +3 -1
- data/spec/github/issues/labels/replace_spec.rb +6 -7
- data/spec/github/issues/milestones/get_spec.rb +2 -0
- data/spec/github/normalizer_spec.rb +18 -6
- data/spec/github/orgs/members/conceal_spec.rb +6 -4
- data/spec/github/orgs/members/delete_spec.rb +2 -0
- data/spec/github/orgs/members/list_spec.rb +1 -1
- data/spec/github/orgs/members/member_spec.rb +3 -1
- data/spec/github/orgs/members/publicize_spec.rb +2 -0
- data/spec/github/orgs/teams/add_member_spec.rb +2 -0
- data/spec/github/orgs/teams/create_spec.rb +1 -1
- data/spec/github/orgs/teams/delete_spec.rb +1 -1
- data/spec/github/orgs/teams/edit_spec.rb +1 -1
- data/spec/github/orgs/teams/get_spec.rb +1 -1
- data/spec/github/orgs/teams/list_spec.rb +1 -1
- data/spec/github/orgs/teams/team_member_spec.rb +3 -1
- data/spec/github/parameter_filter_spec.rb +19 -58
- data/spec/github/pull_requests/comments/create_spec.rb +3 -1
- data/spec/github/pull_requests/comments/delete_spec.rb +1 -1
- data/spec/github/pull_requests/comments/edit_spec.rb +2 -0
- data/spec/github/pull_requests/comments/get_spec.rb +3 -1
- data/spec/github/pull_requests/comments/list_spec.rb +3 -1
- data/spec/github/pull_requests/commits_spec.rb +3 -3
- data/spec/github/pull_requests/create_spec.rb +4 -0
- data/spec/github/pull_requests/files_spec.rb +4 -0
- data/spec/github/pull_requests/get_spec.rb +3 -3
- data/spec/github/pull_requests/list_spec.rb +3 -3
- data/spec/github/pull_requests/merge_spec.rb +2 -0
- data/spec/github/pull_requests/merged_spec.rb +3 -1
- data/spec/github/pull_requests/update_spec.rb +4 -0
- data/spec/github/repos/collaborators/add_spec.rb +3 -1
- data/spec/github/repos/collaborators/get_spec.rb +1 -3
- data/spec/github/repos/collaborators/list_spec.rb +5 -1
- data/spec/github/repos/collaborators/remove_spec.rb +3 -1
- data/spec/github/repos/comments/create_spec.rb +4 -0
- data/spec/github/repos/comments/delete_spec.rb +2 -2
- data/spec/github/repos/comments/get_spec.rb +6 -2
- data/spec/github/repos/commits/compare_spec.rb +3 -3
- data/spec/github/repos/commits/get_spec.rb +3 -3
- data/spec/github/repos/commits/list_spec.rb +3 -3
- data/spec/github/repos/contents/archive_spec.rb +12 -0
- data/spec/github/repos/contents/get_spec.rb +5 -0
- data/spec/github/repos/contributors_spec.rb +7 -2
- data/spec/github/repos/downloads/create_spec.rb +4 -0
- data/spec/github/repos/downloads/delete_spec.rb +5 -1
- data/spec/github/repos/downloads/get_spec.rb +3 -1
- data/spec/github/repos/downloads/list_spec.rb +3 -1
- data/spec/github/repos/forks/create_spec.rb +2 -0
- data/spec/github/repos/forks/list_spec.rb +3 -1
- data/spec/github/repos/hooks/edit_spec.rb +1 -1
- data/spec/github/repos/keys/delete_spec.rb +1 -1
- data/spec/github/repos/keys/edit_spec.rb +2 -0
- data/spec/github/repos/keys/get_spec.rb +3 -1
- data/spec/github/repos/keys/list_spec.rb +4 -2
- data/spec/github/repos/list_spec.rb +6 -1
- data/spec/github/repos/pub_sub_hubbub/subscribe_service_spec.rb +27 -0
- data/spec/github/repos/pub_sub_hubbub/subscribe_spec.rb +51 -0
- data/spec/github/repos/pub_sub_hubbub/unsubscribe_service_spec.rb +21 -0
- data/spec/github/repos/pub_sub_hubbub/unsubscribe_spec.rb +58 -0
- data/spec/github/repos/statuses/create_spec.rb +2 -0
- data/spec/github/search_spec.rb +25 -10
- data/spec/github/users/followers/follow_spec.rb +1 -1
- data/spec/github/users/followers/is_following_spec.rb +1 -1
- data/spec/github/users/followers/unfollow_spec.rb +1 -1
- data/spec/github/users/keys/delete_spec.rb +1 -1
- data/spec/github/users/keys/get_spec.rb +1 -1
- data/spec/github/users/keys/update_spec.rb +1 -1
- data/spec/github/users/update_spec.rb +1 -1
- data/spec/integration/arguments_spec.rb +76 -0
- data/spec/{github → integration}/authorizations_spec.rb +0 -0
- metadata +44 -35
- 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
|
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
|
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
|
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
|
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
|
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?
|
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
|
-
|
15
|
-
|
16
|
-
|
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
|
-
|
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
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
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
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
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
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
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
|
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
|
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
|
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
|
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
|
23
|
-
|
24
|
-
|
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
|
25
|
-
|
26
|
-
|
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
|
26
|
-
|
27
|
-
|
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?(
|
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
|
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
|
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
|
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
|
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
|
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
|
25
|
-
expect { subject.get
|
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
|