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
@@ -23,7 +23,7 @@ describe Github::Authorizations, '#delete' do
|
|
23
23
|
|
24
24
|
it "should fail to get resource without basic authentication" do
|
25
25
|
reset_authentication_for subject
|
26
|
-
expect { subject.delete
|
26
|
+
expect { subject.delete }.to raise_error(ArgumentError)
|
27
27
|
end
|
28
28
|
|
29
29
|
it "should delete resource successfully" do
|
@@ -22,7 +22,7 @@ describe Github::Authorizations, '#get' do
|
|
22
22
|
let(:status) { 200 }
|
23
23
|
|
24
24
|
it "should fail to get resource without authorization id" do
|
25
|
-
expect { subject.get
|
25
|
+
expect { subject.get }.to raise_error(ArgumentError)
|
26
26
|
end
|
27
27
|
|
28
28
|
it "should get the resource" do
|
@@ -7,15 +7,15 @@ describe Github::Error::Validations do
|
|
7
7
|
let(:error) { described_class.new(:username => nil) }
|
8
8
|
|
9
9
|
it 'contains the problem in the message' do
|
10
|
-
error.message.should
|
10
|
+
error.message.should =~ /Attempted to send request with nil arguments/
|
11
11
|
end
|
12
12
|
|
13
13
|
it 'contains the summary in the message' do
|
14
|
-
error.message.should
|
14
|
+
error.message.should =~ /Each request expects certain number of required arguments./
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'contains the resolution in the message' do
|
18
|
-
error.message.should
|
18
|
+
error.message.should =~ /Double check that the provided arguments are set to some value/
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end # Github::Error::Validations
|
@@ -20,7 +20,7 @@ describe Github::Gists::Comments, '#list' do
|
|
20
20
|
it { should respond_to :all }
|
21
21
|
|
22
22
|
it "throws error if gist id not provided" do
|
23
|
-
expect { subject.list
|
23
|
+
expect { subject.list }.to raise_error(ArgumentError)
|
24
24
|
end
|
25
25
|
|
26
26
|
it "should get the resources" do
|
@@ -16,7 +16,7 @@ describe Github::Gists, '#delete' do
|
|
16
16
|
after { reset_authentication_for(subject) }
|
17
17
|
|
18
18
|
it 'should raise error if gist id not present' do
|
19
|
-
expect { subject.delete
|
19
|
+
expect { subject.delete }.to raise_error(ArgumentError)
|
20
20
|
end
|
21
21
|
|
22
22
|
it "should remove resource successfully" do
|
@@ -16,7 +16,7 @@ describe Github::Gists, '#star' do
|
|
16
16
|
after { reset_authentication_for(subject) }
|
17
17
|
|
18
18
|
it "should fail to fork gist without gist id" do
|
19
|
-
expect { subject.fork
|
19
|
+
expect { subject.fork }.to raise_error(ArgumentError)
|
20
20
|
end
|
21
21
|
|
22
22
|
it "should fork resource successfully" do
|
@@ -20,7 +20,7 @@ describe Github::Gists, '#get' do
|
|
20
20
|
it { should respond_to :find }
|
21
21
|
|
22
22
|
it "should fail to get resource without gist id" do
|
23
|
-
expect { subject.get
|
23
|
+
expect { subject.get }.to raise_error(ArgumentError)
|
24
24
|
end
|
25
25
|
|
26
26
|
it "should get the resource" do
|
@@ -18,6 +18,8 @@ describe Github::Gists, '#unstar' do
|
|
18
18
|
context 'when gist is starred' do
|
19
19
|
let(:status) { 204 }
|
20
20
|
|
21
|
+
it { expect { subject.starred? }.to raise_error(ArgumentError) }
|
22
|
+
|
21
23
|
it 'should raise error if gist id not present' do
|
22
24
|
expect { subject.starred? nil }.to raise_error(ArgumentError)
|
23
25
|
end
|
@@ -16,7 +16,7 @@ describe Github::Gists, '#star' do
|
|
16
16
|
after { reset_authentication_for(subject) }
|
17
17
|
|
18
18
|
it "should raise error if gist id not present" do
|
19
|
-
expect { subject.star
|
19
|
+
expect { subject.star }.to raise_error(ArgumentError)
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'successfully stars a gist' do
|
@@ -16,7 +16,7 @@ describe Github::Gists, '#unstar' do
|
|
16
16
|
after { reset_authentication_for(subject) }
|
17
17
|
|
18
18
|
it "should raise error if gist id not present" do
|
19
|
-
expect { subject.unstar
|
19
|
+
expect { subject.unstar }.to raise_error(ArgumentError)
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'successfully stars a gist' do
|
@@ -27,6 +27,8 @@ describe Github::GitData::Blobs, '#create' do
|
|
27
27
|
let(:body) { fixture('git_data/blob_sha.json') }
|
28
28
|
let(:status) { 201 }
|
29
29
|
|
30
|
+
it { expect { subject.create user }.to raise_error(ArgumentError) }
|
31
|
+
|
30
32
|
it "should fail to create resource if 'content' input is missing" do
|
31
33
|
expect {
|
32
34
|
subject.create user, repo, inputs.except('content')
|
@@ -23,7 +23,7 @@ describe Github::GitData::Blobs, '#get' do
|
|
23
23
|
it { should respond_to :find }
|
24
24
|
|
25
25
|
it "should fail to get resource without sha" do
|
26
|
-
expect { subject.get user, repo
|
26
|
+
expect { subject.get user, repo }.to raise_error(ArgumentError)
|
27
27
|
end
|
28
28
|
|
29
29
|
it "should get the resource" do
|
@@ -34,6 +34,8 @@ describe Github::GitData::Commits, '#get' do
|
|
34
34
|
let(:body) { fixture('git_data/commit.json') }
|
35
35
|
let(:status) { 201 }
|
36
36
|
|
37
|
+
it { expect { subject.create user }.to raise_error(ArgumentError)}
|
38
|
+
|
37
39
|
it "should fail to create resource if 'message' input is missing" do
|
38
40
|
expect {
|
39
41
|
subject.create user, repo, inputs.except('message')
|
@@ -21,10 +21,10 @@ describe Github::GitData::Commits, '#get' do
|
|
21
21
|
|
22
22
|
it { should respond_to :find }
|
23
23
|
|
24
|
+
it { expect { subject.get }.to raise_error(ArgumentError) }
|
25
|
+
|
24
26
|
it "should fail to get resource without sha" do
|
25
|
-
expect {
|
26
|
-
subject.get user, repo, nil
|
27
|
-
}.to raise_error(ArgumentError)
|
27
|
+
expect { subject.get user, repo }.to raise_error(ArgumentError)
|
28
28
|
end
|
29
29
|
|
30
30
|
it "should get the resource" do
|
@@ -29,7 +29,7 @@ describe Github::GitData::References, '#create' do
|
|
29
29
|
it "should fail to create resource if 'ref' input is missing" do
|
30
30
|
expect {
|
31
31
|
subject.create user, repo, inputs.except('ref')
|
32
|
-
}.to raise_error(
|
32
|
+
}.to raise_error(Github::Error::RequiredParams )
|
33
33
|
end
|
34
34
|
|
35
35
|
it "should fail to create resource if 'sha' input is missing" do
|
@@ -21,8 +21,10 @@ describe Github::GitData::References, '#delete' do
|
|
21
21
|
|
22
22
|
it { should respond_to :remove }
|
23
23
|
|
24
|
+
it { expect { subject.delete }.to raise_error(ArgumentError) }
|
25
|
+
|
24
26
|
it "should fail to delete resource if 'ref' input is missing" do
|
25
|
-
expect { subject.delete user, repo
|
27
|
+
expect { subject.delete user, repo }.to raise_error(ArgumentError)
|
26
28
|
end
|
27
29
|
|
28
30
|
it "should delete resource successfully" do
|
@@ -38,6 +38,8 @@ describe Github::GitData::Tags, '#create' do
|
|
38
38
|
let(:body) { fixture('git_data/tag.json') }
|
39
39
|
let(:status) { 201 }
|
40
40
|
|
41
|
+
it { expect { subject.create user }.to raise_error(ArgumentError) }
|
42
|
+
|
41
43
|
it "should create resource successfully" do
|
42
44
|
subject.create user, repo, inputs
|
43
45
|
a_post(request_path).with(inputs).should have_been_made
|
@@ -22,7 +22,7 @@ describe Github::Gitignore, '#get' do
|
|
22
22
|
it { should respond_to :find }
|
23
23
|
|
24
24
|
it "should fail to get resource without key" do
|
25
|
-
expect { subject.get
|
25
|
+
expect { subject.get }.to raise_error(ArgumentError)
|
26
26
|
end
|
27
27
|
|
28
28
|
it "should get the resource" do
|
@@ -21,8 +21,10 @@ describe Github::Issues::Events, '#list' do
|
|
21
21
|
|
22
22
|
it { should respond_to :find }
|
23
23
|
|
24
|
+
it { expect { subject.get }.to raise_error(ArgumentError) }
|
25
|
+
|
24
26
|
it "should fail to get resource without event id" do
|
25
|
-
expect { subject.get user, repo
|
27
|
+
expect { subject.get user, repo }.to raise_error(ArgumentError)
|
26
28
|
end
|
27
29
|
|
28
30
|
it "should get the resource" do
|
@@ -24,8 +24,10 @@ describe Github::Issues::Events, '#list' do
|
|
24
24
|
|
25
25
|
it { subject.should respond_to :all }
|
26
26
|
|
27
|
+
it { expect { subject.list }.to raise_error(ArgumentError) }
|
28
|
+
|
27
29
|
it "should fail to get resource without username" do
|
28
|
-
expect { subject.list }.to raise_error(ArgumentError)
|
30
|
+
expect { subject.list user }.to raise_error(ArgumentError)
|
29
31
|
end
|
30
32
|
|
31
33
|
it "should get the resources" do
|
@@ -16,7 +16,7 @@ describe Github::Issues::Labels, '#add' do
|
|
16
16
|
after { reset_authentication_for(subject) }
|
17
17
|
|
18
18
|
let(:issue_id) { 1 }
|
19
|
-
let(:
|
19
|
+
let(:label) { "Label 1" }
|
20
20
|
|
21
21
|
context "labels added" do
|
22
22
|
let(:body) { fixture('issues/labels.json') }
|
@@ -24,27 +24,27 @@ describe Github::Issues::Labels, '#add' do
|
|
24
24
|
|
25
25
|
it "should fail to add labels if issue-id is missing" do
|
26
26
|
expect {
|
27
|
-
subject.add user, repo, nil,
|
27
|
+
subject.add user, repo, nil, label
|
28
28
|
}.to raise_error(ArgumentError)
|
29
29
|
end
|
30
30
|
|
31
31
|
it "should create resource successfully" do
|
32
|
-
subject.add user, repo, issue_id,
|
32
|
+
subject.add user, repo, issue_id, label
|
33
33
|
a_post(request_path).should have_been_made
|
34
34
|
end
|
35
35
|
|
36
36
|
it "should return the resource" do
|
37
|
-
labels = subject.add user, repo, issue_id,
|
37
|
+
labels = subject.add user, repo, issue_id, label
|
38
38
|
labels.first.should be_a Hashie::Mash
|
39
39
|
end
|
40
40
|
|
41
41
|
it "should get the label information" do
|
42
|
-
labels = subject.add user, repo, issue_id,
|
42
|
+
labels = subject.add user, repo, issue_id, label
|
43
43
|
labels.first.name.should == 'bug'
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
47
|
it_should_behave_like 'request failure' do
|
48
|
-
let(:requestable) { subject.add user, repo, issue_id,
|
48
|
+
let(:requestable) { subject.add user, repo, issue_id, label }
|
49
49
|
end
|
50
50
|
end # add
|
@@ -19,8 +19,10 @@ describe Github::Issues::Labels, '#list' do
|
|
19
19
|
context "for this repository" do
|
20
20
|
it { should respond_to :all }
|
21
21
|
|
22
|
+
it { expect { subject.list }.to raise_error(ArgumentError) }
|
23
|
+
|
22
24
|
it "should fail to get resource without username" do
|
23
|
-
expect { subject.list
|
25
|
+
expect { subject.list user }.to raise_error(ArgumentError)
|
24
26
|
end
|
25
27
|
|
26
28
|
it "should get the resources" do
|
@@ -6,7 +6,7 @@ describe Github::Issues::Labels, '#replace' do
|
|
6
6
|
let(:user) { 'peter-murach' }
|
7
7
|
let(:repo) { 'github' }
|
8
8
|
let(:issue_id) { 1 }
|
9
|
-
let(:
|
9
|
+
let(:label) { "Label 1" }
|
10
10
|
let(:request_path) { "/repos/#{user}/#{repo}/issues/#{issue_id}/labels" }
|
11
11
|
|
12
12
|
before {
|
@@ -16,35 +16,34 @@ describe Github::Issues::Labels, '#replace' do
|
|
16
16
|
|
17
17
|
after { reset_authentication_for(subject) }
|
18
18
|
|
19
|
-
|
20
19
|
context "labels replaced" do
|
21
20
|
let(:body) { fixture('issues/labels.json') }
|
22
21
|
let(:status) { 200 }
|
23
22
|
|
24
23
|
it "should fail to add labels if issue-id is missing" do
|
25
24
|
expect {
|
26
|
-
subject.replace user, repo, nil,
|
25
|
+
subject.replace user, repo, nil, label
|
27
26
|
}.to raise_error(ArgumentError)
|
28
27
|
end
|
29
28
|
|
30
29
|
it "should create resource successfully" do
|
31
|
-
subject.replace user, repo, issue_id,
|
30
|
+
subject.replace user, repo, issue_id, label
|
32
31
|
a_put(request_path).should have_been_made
|
33
32
|
end
|
34
33
|
|
35
34
|
it "should return the resource" do
|
36
|
-
labels = subject.replace user, repo, issue_id,
|
35
|
+
labels = subject.replace user, repo, issue_id, label
|
37
36
|
labels.first.should be_a Hashie::Mash
|
38
37
|
end
|
39
38
|
|
40
39
|
it "should get the label information" do
|
41
|
-
labels = subject.replace user, repo, issue_id,
|
40
|
+
labels = subject.replace user, repo, issue_id, label
|
42
41
|
labels.first.name.should == 'bug'
|
43
42
|
end
|
44
43
|
end
|
45
44
|
|
46
45
|
it_should_behave_like 'request failure' do
|
47
|
-
let(:requestable) { subject.replace user, repo, issue_id,
|
46
|
+
let(:requestable) { subject.replace user, repo, issue_id, label }
|
48
47
|
end
|
49
48
|
|
50
49
|
end # replace
|
@@ -21,6 +21,8 @@ describe Github::Issues::Milestones, '#get' do
|
|
21
21
|
|
22
22
|
it { subject.should respond_to :find }
|
23
23
|
|
24
|
+
it { expect { subject.get }.to raise_error(ArgumentError) }
|
25
|
+
|
24
26
|
it "should fail to get resource without milestone id" do
|
25
27
|
expect { subject.get user, repo, nil }.to raise_error(ArgumentError)
|
26
28
|
end
|
@@ -1,20 +1,32 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'github_api/core_ext/hash'
|
3
3
|
|
4
|
-
describe Github::Normalizer do
|
5
|
-
let(:
|
6
|
-
|
7
|
-
let(:
|
4
|
+
describe Github::Normalizer, '#normalize!' do
|
5
|
+
let(:hash) { { 'a' => { :b => { 'c' => 1 }, 'd' => [ 'a', { :e => 2 }] } } }
|
6
|
+
|
7
|
+
let(:klass) {
|
8
|
+
Class.new do
|
9
|
+
include Github::Normalizer
|
10
|
+
end
|
11
|
+
}
|
12
|
+
|
13
|
+
subject(:instance) { klass.new }
|
8
14
|
|
9
15
|
context '#normalize!' do
|
10
16
|
it 'converts hash keys to string' do
|
11
17
|
['a', 'b', 'c'].each do |key|
|
12
|
-
|
18
|
+
subject.normalize!(hash).all_keys.should include key
|
13
19
|
end
|
14
20
|
[:a, :b, :c].each do |key|
|
15
|
-
|
21
|
+
subject.normalize!(hash).all_keys.should_not include key
|
16
22
|
end
|
17
23
|
end
|
24
|
+
|
25
|
+
it "should stringify all the keys inside nested hash" do
|
26
|
+
actual = subject.normalize! hash
|
27
|
+
expected = { 'a' => { 'b'=> { 'c' => 1 }, 'd' => [ 'a', { 'e'=> 2 }] } }
|
28
|
+
actual.should be_eql expected
|
29
|
+
end
|
18
30
|
end
|
19
31
|
|
20
32
|
end # Github::Normalizer
|
@@ -4,8 +4,8 @@ require 'spec_helper'
|
|
4
4
|
|
5
5
|
describe Github::Orgs::Members, '#conceal' do
|
6
6
|
let(:org) { 'github' }
|
7
|
-
let(:
|
8
|
-
let(:request_path) { "/orgs/#{org}/public_members/#{
|
7
|
+
let(:user) { 'peter-murach' }
|
8
|
+
let(:request_path) { "/orgs/#{org}/public_members/#{user}" }
|
9
9
|
|
10
10
|
before {
|
11
11
|
stub_delete(request_path).to_return(:body => body, :status => status,
|
@@ -22,14 +22,16 @@ describe Github::Orgs::Members, '#conceal' do
|
|
22
22
|
expect { subject.conceal }.to raise_error(ArgumentError)
|
23
23
|
end
|
24
24
|
|
25
|
+
it { expect { subject.conceal org }.to raise_error(ArgumentError) }
|
26
|
+
|
25
27
|
it "should get the resources" do
|
26
|
-
subject.conceal org,
|
28
|
+
subject.conceal org, user
|
27
29
|
a_delete(request_path).should have_been_made
|
28
30
|
end
|
29
31
|
end
|
30
32
|
|
31
33
|
it_should_behave_like 'request failure' do
|
32
|
-
let(:requestable) { subject.conceal org,
|
34
|
+
let(:requestable) { subject.conceal org, user }
|
33
35
|
end
|
34
36
|
|
35
37
|
end # conceal
|
@@ -20,6 +20,8 @@ describe Github::Orgs::Members, '#delete' do
|
|
20
20
|
expect { subject.delete }.to raise_error(ArgumentError)
|
21
21
|
end
|
22
22
|
|
23
|
+
it { expect { subject.delete org }.to raise_error(ArgumentError) }
|
24
|
+
|
23
25
|
it "should delete the resource" do
|
24
26
|
subject.delete org, member
|
25
27
|
a_delete(request_path).should have_been_made
|
@@ -20,7 +20,7 @@ describe Github::Orgs::Members, '#list' do
|
|
20
20
|
it { should respond_to :all }
|
21
21
|
|
22
22
|
it "should fail to get resource without org name" do
|
23
|
-
expect { subject.list
|
23
|
+
expect { subject.list }.to raise_error(ArgumentError)
|
24
24
|
end
|
25
25
|
|
26
26
|
it "should get the resources" do
|
@@ -20,8 +20,10 @@ describe Github::Orgs::Members, '#member?' do
|
|
20
20
|
context "this repo is being watched by the user" do
|
21
21
|
let(:status) { 404 }
|
22
22
|
|
23
|
+
it { expect { subject.member? }.to raise_error(ArgumentError) }
|
24
|
+
|
23
25
|
it "should fail validation " do
|
24
|
-
expect { subject.member?
|
26
|
+
expect { subject.member? org }.to raise_error(ArgumentError)
|
25
27
|
end
|
26
28
|
|
27
29
|
it "should return false if resource not found" do
|