octokit 1.18.0 → 1.19.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +1 -1
- data/.rspec +1 -0
- data/CHANGELOG.md +25 -0
- data/{LICENSE → LICENSE.md} +0 -0
- data/README.md +25 -8
- data/lib/faraday/response/raise_octokit_error.rb +4 -1
- data/lib/octokit/client.rb +6 -0
- data/lib/octokit/client/authorizations.rb +20 -7
- data/lib/octokit/client/commits.rb +120 -13
- data/lib/octokit/client/contents.rb +3 -4
- data/lib/octokit/client/downloads.rb +4 -3
- data/lib/octokit/client/emojis.rb +1 -1
- data/lib/octokit/client/events.rb +4 -4
- data/lib/octokit/client/gists.rb +33 -31
- data/lib/octokit/client/issues.rb +15 -15
- data/lib/octokit/client/labels.rb +13 -13
- data/lib/octokit/client/markdown.rb +2 -1
- data/lib/octokit/client/milestones.rb +6 -6
- data/lib/octokit/client/notifications.rb +222 -0
- data/lib/octokit/client/objects.rb +4 -4
- data/lib/octokit/client/organizations.rb +65 -20
- data/lib/octokit/client/pub_sub_hubbub.rb +2 -2
- data/lib/octokit/client/pulls.rb +91 -3
- data/lib/octokit/client/rate_limit.rb +20 -0
- data/lib/octokit/client/refs.rb +4 -4
- data/lib/octokit/client/repositories.rb +106 -37
- data/lib/octokit/client/say.rb +14 -0
- data/lib/octokit/client/statuses.rb +2 -2
- data/lib/octokit/client/users.rb +92 -24
- data/lib/octokit/connection.rb +21 -21
- data/lib/octokit/request.rb +47 -36
- data/lib/octokit/version.rb +1 -1
- data/octokit.gemspec +25 -25
- data/spec/fixtures/{v3/authorization.json → authorization.json} +0 -0
- data/spec/fixtures/{v3/authorizations.json → authorizations.json} +0 -0
- data/spec/fixtures/{v3/blob.json → blob.json} +0 -0
- data/spec/fixtures/{v3/blob_create.json → blob_create.json} +0 -0
- data/spec/fixtures/{v3/branches.json → branches.json} +0 -0
- data/spec/fixtures/{v3/collaborators.json → collaborators.json} +0 -0
- data/spec/fixtures/{v3/comment.json → comment.json} +0 -0
- data/spec/fixtures/{v3/comments.json → comments.json} +0 -0
- data/spec/fixtures/{v3/commit.json → commit.json} +0 -0
- data/spec/fixtures/{v3/commit_comment.json → commit_comment.json} +0 -0
- data/spec/fixtures/{v3/commit_comment_create.json → commit_comment_create.json} +0 -0
- data/spec/fixtures/{v3/commit_comment_update.json → commit_comment_update.json} +0 -0
- data/spec/fixtures/{v3/commit_comments.json → commit_comments.json} +0 -0
- data/spec/fixtures/{v3/commit_create.json → commit_create.json} +0 -0
- data/spec/fixtures/{v3/commits.json → commits.json} +0 -0
- data/spec/fixtures/{v3/compare.json → compare.json} +0 -0
- data/spec/fixtures/{v3/contents.json → contents.json} +0 -0
- data/spec/fixtures/{v3/contributors.json → contributors.json} +0 -0
- data/spec/fixtures/{v3/download.json → download.json} +0 -0
- data/spec/fixtures/{v3/download_create.json → download_create.json} +0 -0
- data/spec/fixtures/{v3/downloads.json → downloads.json} +0 -0
- data/spec/fixtures/{v3/emails.json → emails.json} +0 -0
- data/spec/fixtures/{v3/emojis.json → emojis.json} +0 -0
- data/spec/fixtures/{v3/followers.json → followers.json} +0 -0
- data/spec/fixtures/{v3/following.json → following.json} +0 -0
- data/spec/fixtures/{v3/forks.json → forks.json} +0 -0
- data/spec/fixtures/{v3/gist.json → gist.json} +0 -0
- data/spec/fixtures/{v3/gist_comment.json → gist_comment.json} +0 -0
- data/spec/fixtures/{v3/gist_comment_create.json → gist_comment_create.json} +0 -0
- data/spec/fixtures/{v3/gist_comment_update.json → gist_comment_update.json} +0 -0
- data/spec/fixtures/{v3/gist_comments.json → gist_comments.json} +0 -0
- data/spec/fixtures/{v3/gists.json → gists.json} +0 -0
- data/spec/fixtures/{v3/hook.json → hook.json} +0 -0
- data/spec/fixtures/{v3/hooks.json → hooks.json} +0 -0
- data/spec/fixtures/{v3/issue.json → issue.json} +0 -0
- data/spec/fixtures/{v3/issue_closed.json → issue_closed.json} +0 -0
- data/spec/fixtures/{v3/issue_event.json → issue_event.json} +0 -0
- data/spec/fixtures/{v3/issue_events.json → issue_events.json} +0 -0
- data/spec/fixtures/issue_full.json +38 -0
- data/spec/fixtures/{v3/issues.json → issues.json} +0 -0
- data/spec/fixtures/{v3/label.json → label.json} +0 -0
- data/spec/fixtures/{v3/labels.json → labels.json} +0 -0
- data/spec/fixtures/{v3/languages.json → languages.json} +0 -0
- data/spec/fixtures/{v3/list_commit_comments.json → list_commit_comments.json} +0 -0
- data/spec/fixtures/{v3/markdown_gfm → markdown_gfm} +0 -0
- data/spec/fixtures/{v3/merge.json → merge.json} +0 -0
- data/spec/fixtures/{v3/milestone.json → milestone.json} +0 -0
- data/spec/fixtures/{v3/milestones.json → milestones.json} +0 -0
- data/spec/fixtures/{v3/not_found.json → not_found.json} +0 -0
- data/spec/fixtures/notification_thread.json +32 -0
- data/spec/fixtures/notifications.json +32 -0
- data/spec/fixtures/{v3/organization-repositories.json → organization-repositories.json} +0 -0
- data/spec/fixtures/{v3/organization-repository.json → organization-repository.json} +0 -0
- data/spec/fixtures/{v3/organization.json → organization.json} +0 -0
- data/spec/fixtures/{v3/organization_members.json → organization_members.json} +0 -0
- data/spec/fixtures/{v3/organization_team_members.json → organization_team_members.json} +0 -0
- data/spec/fixtures/{v3/organization_team_repos.json → organization_team_repos.json} +0 -0
- data/spec/fixtures/{v3/organizations.json → organizations.json} +0 -0
- data/spec/fixtures/{v3/public_events.json → public_events.json} +0 -0
- data/spec/fixtures/{v3/public_gists.json → public_gists.json} +0 -0
- data/spec/fixtures/{v3/public_key.json → public_key.json} +0 -0
- data/spec/fixtures/public_key_update.json +5 -0
- data/spec/fixtures/{v3/public_keys.json → public_keys.json} +0 -0
- data/spec/fixtures/{v3/pull_created.json → pull_created.json} +0 -0
- data/spec/fixtures/{v3/pull_request.json → pull_request.json} +0 -0
- data/spec/fixtures/pull_request_comment.json +35 -0
- data/spec/fixtures/pull_request_comment_create.json +35 -0
- data/spec/fixtures/pull_request_comment_reply.json +35 -0
- data/spec/fixtures/pull_request_comment_update.json +35 -0
- data/spec/fixtures/{v3/pull_request_comments.json → pull_request_comments.json} +0 -0
- data/spec/fixtures/{v3/pull_request_commits.json → pull_request_commits.json} +0 -0
- data/spec/fixtures/{v3/pull_request_files.json → pull_request_files.json} +0 -0
- data/spec/fixtures/{v3/pull_request_merged.json → pull_request_merged.json} +0 -0
- data/spec/fixtures/{v3/pull_requests.json → pull_requests.json} +0 -0
- data/spec/fixtures/{v3/pull_update.json → pull_update.json} +0 -0
- data/spec/fixtures/{v3/readme.json → readme.json} +0 -0
- data/spec/fixtures/{v3/ref.json → ref.json} +0 -0
- data/spec/fixtures/{v3/ref_create.json → ref_create.json} +0 -0
- data/spec/fixtures/{v3/ref_update.json → ref_update.json} +0 -0
- data/spec/fixtures/{v3/refs.json → refs.json} +0 -0
- data/spec/fixtures/{v3/refs_tags.json → refs_tags.json} +0 -0
- data/spec/fixtures/{v3/repo_assignees.json → repo_assignees.json} +0 -0
- data/spec/fixtures/{v3/repo_events.json → repo_events.json} +0 -0
- data/spec/fixtures/{v3/repo_issues_events.json → repo_issues_events.json} +0 -0
- data/spec/fixtures/{v3/repositories.json → repositories.json} +0 -0
- data/spec/fixtures/{v3/repository.json → repository.json} +0 -0
- data/spec/fixtures/repository_notifications.json +32 -0
- data/spec/fixtures/say.txt +22 -0
- data/spec/fixtures/say_custom.txt +22 -0
- data/spec/fixtures/{v3/stargazers.json → stargazers.json} +0 -0
- data/spec/fixtures/{v3/starred.json → starred.json} +0 -0
- data/spec/fixtures/{v3/starred_gists.json → starred_gists.json} +0 -0
- data/spec/fixtures/{v3/status.json → status.json} +0 -0
- data/spec/fixtures/{v3/statuses.json → statuses.json} +0 -0
- data/spec/fixtures/subscribers.json +9 -0
- data/spec/fixtures/subscription.json +8 -0
- data/spec/fixtures/subscription_update.json +8 -0
- data/spec/fixtures/subscriptions.json +39 -0
- data/spec/fixtures/{v3/tag.json → tag.json} +0 -0
- data/spec/fixtures/{v3/tag_create.json → tag_create.json} +0 -0
- data/spec/fixtures/{v3/tags.json → tags.json} +0 -0
- data/spec/fixtures/{v3/team.json → team.json} +0 -0
- data/spec/fixtures/{v3/teams.json → teams.json} +0 -0
- data/spec/fixtures/thread_subscription.json +8 -0
- data/spec/fixtures/thread_subscription_update.json +8 -0
- data/spec/fixtures/{v3/tree.json → tree.json} +0 -0
- data/spec/fixtures/{v3/tree_create.json → tree_create.json} +0 -0
- data/spec/fixtures/{v3/user.json → user.json} +0 -0
- data/spec/fixtures/{v3/user_events.json → user_events.json} +0 -0
- data/spec/fixtures/validation_failed.json +11 -0
- data/spec/fixtures/{v3/watched.json → watched.json} +0 -0
- data/spec/fixtures/{v3/watchers.json → watchers.json} +0 -0
- data/spec/helper.rb +13 -2
- data/spec/octokit/client/authorizations_spec.rb +44 -7
- data/spec/octokit/client/commits_spec.rb +136 -11
- data/spec/octokit/client/contents_spec.rb +6 -3
- data/spec/octokit/client/downloads_spec.rb +5 -6
- data/spec/octokit/client/emojis_spec.rb +1 -1
- data/spec/octokit/client/events_spec.rb +5 -5
- data/spec/octokit/client/gists_spec.rb +20 -20
- data/spec/octokit/client/issue_events_spec.rb +2 -2
- data/spec/octokit/client/issues_spec.rb +25 -14
- data/spec/octokit/client/labels_spec.rb +18 -22
- data/spec/octokit/client/markdown_spec.rb +1 -1
- data/spec/octokit/client/milestones_spec.rb +8 -8
- data/spec/octokit/client/notifications_spec.rb +141 -0
- data/spec/octokit/client/objects_spec.rb +6 -6
- data/spec/octokit/client/organizations_spec.rb +65 -13
- data/spec/octokit/client/pub_sub_hubbub/service_hooks_spec.rb +4 -4
- data/spec/octokit/client/pub_sub_hubbub_spec.rb +3 -3
- data/spec/octokit/client/pulls_spec.rb +81 -10
- data/spec/octokit/client/refs_spec.rb +7 -7
- data/spec/octokit/client/repositories_spec.rb +86 -34
- data/spec/octokit/client/say_spec.rb +37 -0
- data/spec/octokit/client/statuses_spec.rb +2 -2
- data/spec/octokit/client/users_spec.rb +65 -16
- data/spec/octokit/client_spec.rb +37 -11
- data/spec/{repository_spec.rb → octokit/repository_spec.rb} +0 -0
- data/spec/octokit_spec.rb +1 -1
- metadata +240 -196
@@ -6,7 +6,7 @@ describe Octokit::Client::PubSubHubbub do
|
|
6
6
|
|
7
7
|
describe ".subscribe" do
|
8
8
|
it "subscribes to pull events" do
|
9
|
-
stub_post("/hub
|
9
|
+
stub_post("/hub").
|
10
10
|
with({
|
11
11
|
:"hub.callback" => 'github://Travis?token=travistoken',
|
12
12
|
:"hub.mode" => 'subscribe',
|
@@ -18,7 +18,7 @@ describe Octokit::Client::PubSubHubbub do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
it "raises an error if the topic is not recognized" do
|
21
|
-
stub_post("/hub
|
21
|
+
stub_post("/hub").
|
22
22
|
with({
|
23
23
|
:"hub.callback" => 'github://Travis?token=travistoken',
|
24
24
|
:"hub.mode" => 'subscribe',
|
@@ -34,7 +34,7 @@ describe Octokit::Client::PubSubHubbub do
|
|
34
34
|
|
35
35
|
describe ".unsubscribe" do
|
36
36
|
it "unsubscribes from pull events" do
|
37
|
-
stub_post("/hub
|
37
|
+
stub_post("/hub").
|
38
38
|
with({
|
39
39
|
:"hub.callback" => 'github://Travis?token=travistoken',
|
40
40
|
:"hub.mode" => 'unsubscribe',
|
@@ -12,7 +12,7 @@ describe Octokit::Client::Pulls do
|
|
12
12
|
it "creates a pull request" do
|
13
13
|
stub_post("https://api.github.com/repos/pengwynn/octokit/pulls").
|
14
14
|
with(:pull => {:base => "master", :head => "pengwynn:master", :title => "Title", :body => "Body"}).
|
15
|
-
to_return(
|
15
|
+
to_return(json_response("pull_created.json"))
|
16
16
|
pull = @client.create_pull_request("pengwynn/octokit", "master", "pengwynn:master", "Title", "Body")
|
17
17
|
expect(pull.number).to eq(15)
|
18
18
|
expect(pull.title).to eq("Pull this awesome v3 stuff")
|
@@ -25,7 +25,7 @@ describe Octokit::Client::Pulls do
|
|
25
25
|
it "updates a pull request" do
|
26
26
|
stub_post("https://api.github.com/repos/pengwynn/octokit/pulls/67").
|
27
27
|
with(:pull => { :title => "New title", :body => "Updated body", :state => "closed"}).
|
28
|
-
to_return(
|
28
|
+
to_return(json_response('pull_update.json'))
|
29
29
|
pull = @client.update_pull_request('pengwynn/octokit', 67, 'New title', 'Updated body', 'closed')
|
30
30
|
expect(pull.title).to eq('New title')
|
31
31
|
expect(pull.body).to eq('Updated body')
|
@@ -39,7 +39,7 @@ describe Octokit::Client::Pulls do
|
|
39
39
|
it "creates a pull request and attach it to an existing issue" do
|
40
40
|
stub_post("https://api.github.com/repos/pengwynn/octokit/pulls").
|
41
41
|
with(:pull => {:base => "master", :head => "pengwynn:octokit", :issue => "15"}).
|
42
|
-
to_return(
|
42
|
+
to_return(json_response("pull_created.json"))
|
43
43
|
pull = @client.create_pull_request_for_issue("pengwynn/octokit", "master", "pengwynn:octokit", "15")
|
44
44
|
expect(pull.number).to eq(15)
|
45
45
|
end
|
@@ -50,7 +50,7 @@ describe Octokit::Client::Pulls do
|
|
50
50
|
|
51
51
|
it "returns all pull requests" do
|
52
52
|
stub_get("https://api.github.com/repos/pengwynn/octokit/pulls?state=open").
|
53
|
-
to_return(
|
53
|
+
to_return(json_response("pull_requests.json"))
|
54
54
|
pulls = @client.pulls("pengwynn/octokit")
|
55
55
|
expect(pulls.first.number).to eq(928)
|
56
56
|
end
|
@@ -61,7 +61,7 @@ describe Octokit::Client::Pulls do
|
|
61
61
|
|
62
62
|
it "returns a pull request" do
|
63
63
|
stub_get("https://api.github.com/repos/pengwynn/octokit/pulls/67").
|
64
|
-
to_return(
|
64
|
+
to_return(json_response("pull_request.json"))
|
65
65
|
pull = @client.pull("pengwynn/octokit", 67)
|
66
66
|
expect(pull.number).to eq(67)
|
67
67
|
end
|
@@ -72,7 +72,7 @@ describe Octokit::Client::Pulls do
|
|
72
72
|
|
73
73
|
it "returns the commits for a pull request" do
|
74
74
|
stub_get("https://api.github.com/repos/pengwynn/octokit/pulls/67/commits").
|
75
|
-
to_return(
|
75
|
+
to_return(json_response("pull_request_commits.json"))
|
76
76
|
commits = @client.pull_commits("pengwynn/octokit", 67)
|
77
77
|
expect(commits.first["sha"]).to eq("2097821c7c5aa4dc02a2cc54d5ca51968b373f95")
|
78
78
|
end
|
@@ -83,18 +83,89 @@ describe Octokit::Client::Pulls do
|
|
83
83
|
|
84
84
|
it "returns the comments for a pull request" do
|
85
85
|
stub_get("https://api.github.com/repos/pengwynn/octokit/pulls/67/comments").
|
86
|
-
to_return(
|
86
|
+
to_return(json_response("pull_request_comments.json"))
|
87
87
|
commits = @client.pull_comments("pengwynn/octokit", 67)
|
88
88
|
expect(commits.first["id"]).to eq(401530)
|
89
89
|
end
|
90
90
|
|
91
91
|
end
|
92
92
|
|
93
|
+
describe ".pull_request_comment" do
|
94
|
+
|
95
|
+
it "returns a comment on a pull request" do
|
96
|
+
stub_get("https://api.github.com/repos/pengwynn/octokit/pulls/comments/1903950").
|
97
|
+
to_return(json_response("pull_request_comment.json"))
|
98
|
+
comment = @client.pull_request_comment("pengwynn/octokit", 1903950)
|
99
|
+
expect(comment.id).to eq(1903950)
|
100
|
+
expect(comment.body).to include("Tests FTW.")
|
101
|
+
end
|
102
|
+
|
103
|
+
end
|
104
|
+
|
105
|
+
describe ".create_pull_request_comment" do
|
106
|
+
|
107
|
+
it "creates a new comment on a pull request" do
|
108
|
+
comment_content = JSON.parse(fixture("pull_request_comment_create.json").read)
|
109
|
+
new_comment = {
|
110
|
+
:body => comment_content['body'],
|
111
|
+
:commit_id => comment_content['commit_id'],
|
112
|
+
:path => comment_content['path'],
|
113
|
+
:position => comment_content['position']
|
114
|
+
}
|
115
|
+
stub_post("https://api.github.com/repos/pengwynn/octokit/pulls/163/comments").
|
116
|
+
with(:body => new_comment).
|
117
|
+
to_return(json_response("pull_request_comment_create.json"))
|
118
|
+
comment = @client.create_pull_request_comment("pengwynn/octokit", 163, new_comment[:body], new_comment[:commit_id], new_comment[:path], new_comment[:position])
|
119
|
+
expect(comment).to eq(comment_content)
|
120
|
+
end
|
121
|
+
|
122
|
+
end
|
123
|
+
|
124
|
+
describe ".create_pull_request_comment_reply" do
|
125
|
+
|
126
|
+
it "creates a new reply to a pull request comment" do
|
127
|
+
new_comment = {
|
128
|
+
:body => "done.",
|
129
|
+
:in_reply_to => 1903950
|
130
|
+
}
|
131
|
+
stub_post("https://api.github.com/repos/pengwynn/octokit/pulls/163/comments").
|
132
|
+
with(:body => new_comment).
|
133
|
+
to_return(json_response("pull_request_comment_reply.json"))
|
134
|
+
reply = @client.create_pull_request_comment_reply("pengwynn/octokit", 163, new_comment[:body], new_comment[:in_reply_to])
|
135
|
+
expect(reply.id).to eq(1907270)
|
136
|
+
expect(reply.body).to eq(new_comment[:body])
|
137
|
+
end
|
138
|
+
|
139
|
+
end
|
140
|
+
|
141
|
+
describe ".update_pull_request_comment" do
|
142
|
+
|
143
|
+
it "updates a pull request comment" do
|
144
|
+
stub_patch("https://api.github.com/repos/pengwynn/octokit/pulls/comments/1907270").
|
145
|
+
with(:body => { :body => ":shipit:"}).
|
146
|
+
to_return(json_response("pull_request_comment_update.json"))
|
147
|
+
comment = @client.update_pull_request_comment("pengwynn/octokit", 1907270, ":shipit:")
|
148
|
+
expect(comment.body).to eq(":shipit:")
|
149
|
+
end
|
150
|
+
|
151
|
+
end
|
152
|
+
|
153
|
+
describe ".delete_pull_request_comment" do
|
154
|
+
|
155
|
+
it "deletes a pull request comment" do
|
156
|
+
stub_delete("https://api.github.com/repos/pengwynn/octokit/pulls/comments/1907270").
|
157
|
+
to_return(:status => 204)
|
158
|
+
result = @client.delete_pull_request_comment("pengwynn/octokit", 1907270)
|
159
|
+
expect(result).to be_true
|
160
|
+
end
|
161
|
+
|
162
|
+
end
|
163
|
+
|
93
164
|
describe ".merge_pull_request" do
|
94
165
|
|
95
166
|
it "merges the pull request" do
|
96
167
|
stub_put("https://api.github.com/repos/pengwynn/octokit/pulls/67/merge").
|
97
|
-
to_return(
|
168
|
+
to_return(json_response("pull_request_merged.json"))
|
98
169
|
response = @client.merge_pull_request("pengwynn/octokit", 67)
|
99
170
|
expect(response["sha"]).to eq("2097821c7c5aa4dc02a2cc54d5ca51968b373f95")
|
100
171
|
end
|
@@ -105,7 +176,7 @@ describe Octokit::Client::Pulls do
|
|
105
176
|
|
106
177
|
it "lists files for a pull request" do
|
107
178
|
stub_get("https://api.github.com/repos/pengwynn/octokit/pulls/142/files").
|
108
|
-
to_return(
|
179
|
+
to_return(json_response("pull_request_files.json"))
|
109
180
|
|
110
181
|
files = @client.pull_request_files("pengwynn/octokit", 142)
|
111
182
|
file = files.first
|
@@ -118,7 +189,7 @@ describe Octokit::Client::Pulls do
|
|
118
189
|
describe ".pull_merged?" do
|
119
190
|
|
120
191
|
it "returns whether the pull request has been merged" do
|
121
|
-
stub_get("https://api.github.com/repos/pengwynn/octokit/pulls/67/
|
192
|
+
stub_get("https://api.github.com/repos/pengwynn/octokit/pulls/67/merge").
|
122
193
|
to_return(:status => 204)
|
123
194
|
merged = @client.pull_merged?("pengwynn/octokit", 67)
|
124
195
|
expect(merged).to be_true
|
@@ -11,14 +11,14 @@ describe Octokit::Client::Refs do
|
|
11
11
|
|
12
12
|
it "returns all refs" do
|
13
13
|
stub_get("/repos/sferik/rails_admin/git/refs/").
|
14
|
-
to_return(
|
14
|
+
to_return(json_response("refs.json"))
|
15
15
|
refs = @client.refs("sferik/rails_admin")
|
16
16
|
expect(refs.first.ref).to eq("refs/heads/actions")
|
17
17
|
end
|
18
18
|
|
19
19
|
it "returns all tag refs" do
|
20
20
|
stub_get("/repos/sferik/rails_admin/git/refs/tags").
|
21
|
-
to_return(
|
21
|
+
to_return(json_response("refs_tags.json"))
|
22
22
|
refs = @client.refs("sferik/rails_admin","tags")
|
23
23
|
expect(refs.first.ref).to eq("refs/tags/v0.0.1")
|
24
24
|
end
|
@@ -29,7 +29,7 @@ describe Octokit::Client::Refs do
|
|
29
29
|
|
30
30
|
it "returns the tags/v0.0.3 ref" do
|
31
31
|
stub_get("/repos/sferik/rails_admin/git/refs/tags/v0.0.3").
|
32
|
-
to_return(
|
32
|
+
to_return(json_response("ref.json"))
|
33
33
|
ref = @client.ref("sferik/rails_admin","tags/v0.0.3")
|
34
34
|
expect(ref.object.type).to eq("tag")
|
35
35
|
expect(ref.ref).to eq("refs/tags/v0.0.3")
|
@@ -44,7 +44,7 @@ describe Octokit::Client::Refs do
|
|
44
44
|
stub_post("/repos/octocat/Hello-World/git/refs").
|
45
45
|
with(:body => { "ref" => "refs/heads/master", "sha" => "827efc6d56897b048c772eb4087f854f46256132" },
|
46
46
|
:headers => {'Content-Type'=>'application/json'}).
|
47
|
-
to_return(
|
47
|
+
to_return(json_response("ref_create.json"))
|
48
48
|
ref = @client.create_ref("octocat/Hello-World","heads/master", "827efc6d56897b048c772eb4087f854f46256132")
|
49
49
|
expect(ref.first.ref).to eq("refs/heads/master")
|
50
50
|
end
|
@@ -57,7 +57,7 @@ describe Octokit::Client::Refs do
|
|
57
57
|
stub_patch("/repos/octocat/Hello-World/git/refs/heads/sc/featureA").
|
58
58
|
with(:body => { "sha" => "aa218f56b14c9653891f9e74264a383fa43fefbd", "force" => true },
|
59
59
|
:headers => {'Content-Type'=>'application/json'}).
|
60
|
-
to_return(
|
60
|
+
to_return(json_response("ref_update.json"))
|
61
61
|
refs = @client.update_ref("octocat/Hello-World","heads/sc/featureA", "aa218f56b14c9653891f9e74264a383fa43fefbd", true)
|
62
62
|
expect(refs.first.ref).to eq("refs/heads/sc/featureA")
|
63
63
|
expect(refs.first.object.sha).to eq("aa218f56b14c9653891f9e74264a383fa43fefbd")
|
@@ -69,8 +69,8 @@ describe Octokit::Client::Refs do
|
|
69
69
|
it "deletes an existing ref" do
|
70
70
|
stub_delete("/repos/octocat/Hello-World/git/refs/heads/feature-a").
|
71
71
|
to_return(:status => 204)
|
72
|
-
|
73
|
-
expect(
|
72
|
+
result = @client.delete_ref("octocat/Hello-World", "heads/feature-a")
|
73
|
+
expect(result).to be_true
|
74
74
|
end
|
75
75
|
|
76
76
|
end
|
@@ -11,7 +11,7 @@ describe Octokit::Client::Repositories do
|
|
11
11
|
|
12
12
|
it "returns matching repositories" do
|
13
13
|
stub_get("https://api.github.com/legacy/repos/search/One40Proof").
|
14
|
-
to_return(
|
14
|
+
to_return(json_response("legacy/repositories.json"))
|
15
15
|
repositories = @client.search_repositories("One40Proof")
|
16
16
|
expect(repositories.first.name).to eq("One40Proof")
|
17
17
|
end
|
@@ -22,7 +22,7 @@ describe Octokit::Client::Repositories do
|
|
22
22
|
|
23
23
|
it "returns the matching repository" do
|
24
24
|
stub_get("/repos/sferik/rails_admin").
|
25
|
-
to_return(
|
25
|
+
to_return(json_response("repository.json"))
|
26
26
|
repository = @client.repository("sferik/rails_admin")
|
27
27
|
expect(repository.name).to eq("rails_admin")
|
28
28
|
end
|
@@ -35,7 +35,7 @@ describe Octokit::Client::Repositories do
|
|
35
35
|
description = "RailsAdmin is a Rails 3 engine that provides an easy-to-use interface for managing your data"
|
36
36
|
stub_patch("/repos/sferik/rails_admin").
|
37
37
|
with(:body => {:description => description}).
|
38
|
-
to_return(
|
38
|
+
to_return(json_response("repository.json"))
|
39
39
|
repository = @client.edit_repository("sferik/rails_admin", :description => description)
|
40
40
|
expect(repository.description).to eq(description)
|
41
41
|
end
|
@@ -48,7 +48,7 @@ describe Octokit::Client::Repositories do
|
|
48
48
|
|
49
49
|
it "returns user's repositories" do
|
50
50
|
stub_get("/users/sferik/repos").
|
51
|
-
to_return(
|
51
|
+
to_return(json_response("repositories.json"))
|
52
52
|
repositories = @client.repositories("sferik")
|
53
53
|
expect(repositories.first.name).to eq("merb-admin")
|
54
54
|
end
|
@@ -59,7 +59,7 @@ describe Octokit::Client::Repositories do
|
|
59
59
|
|
60
60
|
it "returns authenticated user's repositories" do
|
61
61
|
stub_get("/user/repos").
|
62
|
-
to_return(
|
62
|
+
to_return(json_response("repositories.json"))
|
63
63
|
repositories = @client.repositories
|
64
64
|
expect(repositories.first.name).to eq("merb-admin")
|
65
65
|
end
|
@@ -112,7 +112,7 @@ describe Octokit::Client::Repositories do
|
|
112
112
|
|
113
113
|
it "forks a repository" do
|
114
114
|
stub_post("/repos/sferik/rails_admin/forks").
|
115
|
-
to_return(
|
115
|
+
to_return(json_response("repository.json"))
|
116
116
|
repository = @client.fork("sferik/rails_admin")
|
117
117
|
expect(repository.name).to eq("rails_admin")
|
118
118
|
end
|
@@ -124,7 +124,7 @@ describe Octokit::Client::Repositories do
|
|
124
124
|
it "creates a repository" do
|
125
125
|
stub_post("/user/repos").
|
126
126
|
with(:name => "rails_admin").
|
127
|
-
to_return(
|
127
|
+
to_return(json_response("repository.json"))
|
128
128
|
repository = @client.create_repository("rails_admin")
|
129
129
|
expect(repository.name).to eq("rails_admin")
|
130
130
|
end
|
@@ -132,7 +132,7 @@ describe Octokit::Client::Repositories do
|
|
132
132
|
it "creates a repository for an organization" do
|
133
133
|
stub_post("/orgs/comorichwebgroup/repos").
|
134
134
|
with(:name => "demo").
|
135
|
-
to_return(
|
135
|
+
to_return(json_response("organization-repository.json"))
|
136
136
|
repository = @client.create_repository("demo", {:organization => 'comorichwebgroup'})
|
137
137
|
expect(repository.name).to eq("demo")
|
138
138
|
expect(repository.organization.login).to eq("CoMoRichWebGroup")
|
@@ -156,7 +156,7 @@ describe Octokit::Client::Repositories do
|
|
156
156
|
it "sets a repository private" do
|
157
157
|
stub_patch("/repos/sferik/rails_admin").
|
158
158
|
with({ :name => "rails_admin", :private => false }).
|
159
|
-
to_return(
|
159
|
+
to_return(json_response("repository.json"))
|
160
160
|
repository = @client.set_private("sferik/rails_admin")
|
161
161
|
expect(repository.name).to eq("rails_admin")
|
162
162
|
end
|
@@ -168,7 +168,7 @@ describe Octokit::Client::Repositories do
|
|
168
168
|
it "sets a repository public" do
|
169
169
|
stub_patch("/repos/sferik/rails_admin").
|
170
170
|
with({ :name => "rails_admin", :private => true }).
|
171
|
-
to_return(
|
171
|
+
to_return(json_response("repository.json"))
|
172
172
|
repository = @client.set_public("sferik/rails_admin")
|
173
173
|
expect(repository.name).to eq("rails_admin")
|
174
174
|
expect(repository.private).to eq(false)
|
@@ -180,7 +180,7 @@ describe Octokit::Client::Repositories do
|
|
180
180
|
|
181
181
|
it "returns a repository's deploy keys" do
|
182
182
|
stub_get("/repos/sferik/rails_admin/keys").
|
183
|
-
to_return(
|
183
|
+
to_return(json_response("public_keys.json"))
|
184
184
|
public_keys = @client.deploy_keys("sferik/rails_admin")
|
185
185
|
expect(public_keys.first.id).to eq(103205)
|
186
186
|
end
|
@@ -192,7 +192,7 @@ describe Octokit::Client::Repositories do
|
|
192
192
|
it "adds a repository deploy keys" do
|
193
193
|
stub_post("/repos/sferik/rails_admin/keys").
|
194
194
|
with(:body => { :title => "Moss", :key => "ssh-dss AAAAB3NzaC1kc3MAAACBAJz7HanBa18ad1YsdFzHO5Wy1/WgXd4BV+czbKq7q23jungbfjN3eo2a0SVdxux8GG+RZ9ia90VD/X+PE4s3LV60oXZ7PDAuyPO1CTF0TaDoKf9mPaHcPa6agMJVocMsgBgwviWT1Q9VgN1SccDsYVDtxkIAwuw25YeHZlG6myx1AAAAFQCgW+OvXWUdUJPBGkRJ8ML7uf0VHQAAAIAlP5G96tTss0SKYVSCJCyocn9cyGQdNjxah4/aYuYFTbLI1rxk7sr/AkZfJNIoF2UFyO5STbbratykIQGUPdUBg1a2t72bu31x+4ZYJMngNsG/AkZ2oqLiH6dJKHD7PFx2oSPalogwsUV7iSMIZIYaPa03A9763iFsN0qJjaed+gAAAIBxz3Prxdzt/os4XGXSMNoWcS03AFC/05NOkoDMrXxQnTTpp1wrOgyRqEnKz15qC5dWk1ynzK+LJXHDZGA8lXPfCjHpJO3zrlZ/ivvLhgPdDpt13MAhIJFH06hTal0woxbk/fIdY71P3kbgXC0Ppx/0S7BC+VxqRCA4/wcM+BoDbA== host" }).
|
195
|
-
to_return(
|
195
|
+
to_return(json_response("public_key.json"))
|
196
196
|
public_key = @client.add_deploy_key("sferik/rails_admin", "Moss", "ssh-dss AAAAB3NzaC1kc3MAAACBAJz7HanBa18ad1YsdFzHO5Wy1/WgXd4BV+czbKq7q23jungbfjN3eo2a0SVdxux8GG+RZ9ia90VD/X+PE4s3LV60oXZ7PDAuyPO1CTF0TaDoKf9mPaHcPa6agMJVocMsgBgwviWT1Q9VgN1SccDsYVDtxkIAwuw25YeHZlG6myx1AAAAFQCgW+OvXWUdUJPBGkRJ8ML7uf0VHQAAAIAlP5G96tTss0SKYVSCJCyocn9cyGQdNjxah4/aYuYFTbLI1rxk7sr/AkZfJNIoF2UFyO5STbbratykIQGUPdUBg1a2t72bu31x+4ZYJMngNsG/AkZ2oqLiH6dJKHD7PFx2oSPalogwsUV7iSMIZIYaPa03A9763iFsN0qJjaed+gAAAIBxz3Prxdzt/os4XGXSMNoWcS03AFC/05NOkoDMrXxQnTTpp1wrOgyRqEnKz15qC5dWk1ynzK+LJXHDZGA8lXPfCjHpJO3zrlZ/ivvLhgPdDpt13MAhIJFH06hTal0woxbk/fIdY71P3kbgXC0Ppx/0S7BC+VxqRCA4/wcM+BoDbA== host")
|
197
197
|
expect(public_key.id).to eq(103205)
|
198
198
|
end
|
@@ -205,7 +205,7 @@ describe Octokit::Client::Repositories do
|
|
205
205
|
stub_delete("/repos/sferik/rails_admin/keys/#{103205}").
|
206
206
|
to_return(:status => 204)
|
207
207
|
result = @client.remove_deploy_key("sferik/rails_admin", 103205)
|
208
|
-
expect(result).to
|
208
|
+
expect(result).to be_true
|
209
209
|
end
|
210
210
|
|
211
211
|
end
|
@@ -214,7 +214,7 @@ describe Octokit::Client::Repositories do
|
|
214
214
|
|
215
215
|
it "returns a repository's collaborators" do
|
216
216
|
stub_get("/repos/sferik/rails_admin/collaborators").
|
217
|
-
to_return(
|
217
|
+
to_return(json_response("collaborators.json"))
|
218
218
|
collaborators = @client.collaborators("sferik/rails_admin")
|
219
219
|
expect(collaborators.first.login).to eq("sferik")
|
220
220
|
end
|
@@ -227,7 +227,7 @@ describe Octokit::Client::Repositories do
|
|
227
227
|
stub_put("/repos/sferik/rails_admin/collaborators/sferik").
|
228
228
|
to_return(:status => 204)
|
229
229
|
result = @client.add_collaborator("sferik/rails_admin", "sferik")
|
230
|
-
expect(result).to
|
230
|
+
expect(result).to be_true
|
231
231
|
end
|
232
232
|
|
233
233
|
end
|
@@ -238,7 +238,7 @@ describe Octokit::Client::Repositories do
|
|
238
238
|
stub_delete("/repos/sferik/rails_admin/collaborators/sferik").
|
239
239
|
to_return(:status => 204)
|
240
240
|
result = @client.remove_collaborator("sferik/rails_admin", "sferik")
|
241
|
-
expect(result).to
|
241
|
+
expect(result).to be_true
|
242
242
|
end
|
243
243
|
|
244
244
|
end
|
@@ -247,7 +247,7 @@ describe Octokit::Client::Repositories do
|
|
247
247
|
|
248
248
|
it "returns all repository teams" do
|
249
249
|
stub_get("/repos/codeforamerica/open311/teams").
|
250
|
-
to_return(
|
250
|
+
to_return(json_response("teams.json"))
|
251
251
|
teams = @client.repository_teams("codeforamerica/open311")
|
252
252
|
expect(teams.first.name).to eq("Fellows")
|
253
253
|
end
|
@@ -260,7 +260,7 @@ describe Octokit::Client::Repositories do
|
|
260
260
|
|
261
261
|
it "returns all repository contributors" do
|
262
262
|
stub_get("/repos/sferik/rails_admin/contributors?anon=true").
|
263
|
-
to_return(
|
263
|
+
to_return(json_response("contributors.json"))
|
264
264
|
contributors = @client.contributors("sferik/rails_admin", true)
|
265
265
|
expect(contributors.first.login).to eq("sferik")
|
266
266
|
end
|
@@ -271,7 +271,7 @@ describe Octokit::Client::Repositories do
|
|
271
271
|
|
272
272
|
it "returns all repository contributors" do
|
273
273
|
stub_get("/repos/sferik/rails_admin/contributors?anon=false").
|
274
|
-
to_return(
|
274
|
+
to_return(json_response("contributors.json"))
|
275
275
|
contributors = @client.contributors("sferik/rails_admin")
|
276
276
|
expect(contributors.first.login).to eq("sferik")
|
277
277
|
end
|
@@ -284,7 +284,7 @@ describe Octokit::Client::Repositories do
|
|
284
284
|
|
285
285
|
it "returns all repository stargazers" do
|
286
286
|
stub_get("/repos/sferik/rails_admin/stargazers").
|
287
|
-
to_return(
|
287
|
+
to_return(json_response("stargazers.json"))
|
288
288
|
stargazers = @client.stargazers("sferik/rails_admin")
|
289
289
|
expect(stargazers.first.login).to eq("sferik")
|
290
290
|
end
|
@@ -295,7 +295,7 @@ describe Octokit::Client::Repositories do
|
|
295
295
|
|
296
296
|
it "returns all repository watchers" do
|
297
297
|
stub_get("/repos/sferik/rails_admin/watchers").
|
298
|
-
to_return(
|
298
|
+
to_return(json_response("watchers.json"))
|
299
299
|
watchers = @client.watchers("sferik/rails_admin")
|
300
300
|
expect(watchers.first.login).to eq("sferik")
|
301
301
|
end
|
@@ -306,7 +306,7 @@ describe Octokit::Client::Repositories do
|
|
306
306
|
|
307
307
|
it "returns a repository's network" do
|
308
308
|
stub_get("/repos/sferik/rails_admin/forks").
|
309
|
-
to_return(
|
309
|
+
to_return(json_response("forks.json"))
|
310
310
|
network = @client.network("sferik/rails_admin")
|
311
311
|
expect(network.first.owner.login).to eq("digx")
|
312
312
|
end
|
@@ -317,7 +317,7 @@ describe Octokit::Client::Repositories do
|
|
317
317
|
|
318
318
|
it "returns a repository's languages" do
|
319
319
|
stub_get("/repos/sferik/rails_admin/languages").
|
320
|
-
to_return(
|
320
|
+
to_return(json_response("languages.json"))
|
321
321
|
languages = @client.languages("sferik/rails_admin")
|
322
322
|
expect(languages["Ruby"]).to eq(345701)
|
323
323
|
end
|
@@ -328,7 +328,7 @@ describe Octokit::Client::Repositories do
|
|
328
328
|
|
329
329
|
it "returns a repository's tags" do
|
330
330
|
stub_get("/repos/pengwynn/octokit/tags").
|
331
|
-
to_return(
|
331
|
+
to_return(json_response("tags.json"))
|
332
332
|
tags = @client.tags("pengwynn/octokit")
|
333
333
|
v0_6_4 = tags.find { |tag| tag.name == "v0.6.4" }
|
334
334
|
expect(v0_6_4.commit.sha).to eq("09bcc30e7286eeb1bbde68d0ace7a6b90b1a84a2")
|
@@ -340,14 +340,14 @@ describe Octokit::Client::Repositories do
|
|
340
340
|
|
341
341
|
it "returns a repository's branches" do
|
342
342
|
stub_get("/repos/pengwynn/octokit/branches").
|
343
|
-
to_return(
|
343
|
+
to_return(json_response("branches.json"))
|
344
344
|
branches = @client.branches("pengwynn/octokit")
|
345
345
|
master = branches.find { |branch| branch.name == "master" }
|
346
346
|
expect(master.commit.sha).to eq("88553a397f7293b3ba176dc27cd1ab6bb93d5d14")
|
347
347
|
end
|
348
348
|
|
349
349
|
it "returns a single branch" do
|
350
|
-
branch = JSON.parse(fixture("
|
350
|
+
branch = JSON.parse(fixture("branches.json").read).last
|
351
351
|
stub_get("/repos/pengwynn/octokit/branches/master").
|
352
352
|
to_return(:body => branch)
|
353
353
|
branch = @client.branch("pengwynn/octokit", "master")
|
@@ -360,7 +360,7 @@ describe Octokit::Client::Repositories do
|
|
360
360
|
|
361
361
|
it "returns a repository's hooks" do
|
362
362
|
stub_get("/repos/railsbp/railsbp.com/hooks").
|
363
|
-
to_return(
|
363
|
+
to_return(json_response("hooks.json"))
|
364
364
|
hooks = @client.hooks("railsbp/railsbp.com")
|
365
365
|
hook = hooks.find { |hook| hook.name == "railsbp" }
|
366
366
|
expect(hook.config.token).to eq("xAAQZtJhYHGagsed1kYR")
|
@@ -372,7 +372,7 @@ describe Octokit::Client::Repositories do
|
|
372
372
|
|
373
373
|
it "returns a repository's single hook" do
|
374
374
|
stub_get("/repos/railsbp/railsbp.com/hooks/154284").
|
375
|
-
to_return(
|
375
|
+
to_return(json_response("hook.json"))
|
376
376
|
hook = @client.hook("railsbp/railsbp.com", 154284)
|
377
377
|
expect(hook.config.token).to eq("xAAQZtJhYHGagsed1kYR")
|
378
378
|
end
|
@@ -384,7 +384,7 @@ describe Octokit::Client::Repositories do
|
|
384
384
|
it "creates a hook" do
|
385
385
|
stub_post("/repos/railsbp/railsbp.com/hooks").
|
386
386
|
with(:body => {:name => "railsbp", :config => {:railsbp_url => "http://railsbp.com", :token => "xAAQZtJhYHGagsed1kYR"}, :events => ["push"], :active => true}).
|
387
|
-
to_return(
|
387
|
+
to_return(json_response("hook.json"))
|
388
388
|
hook = @client.create_hook("railsbp/railsbp.com", "railsbp", {:railsbp_url => "http://railsbp.com", :token => "xAAQZtJhYHGagsed1kYR"})
|
389
389
|
expect(hook.id).to eq(154284)
|
390
390
|
end
|
@@ -396,7 +396,7 @@ describe Octokit::Client::Repositories do
|
|
396
396
|
it "edits a hook" do
|
397
397
|
stub_patch("/repos/railsbp/railsbp.com/hooks/154284").
|
398
398
|
with(:body => {:name => "railsbp", :config => {:railsbp_url => "http://railsbp.com", :token => "xAAQZtJhYHGagsed1kYR"}, :events => ["push"], :active => true}).
|
399
|
-
to_return(
|
399
|
+
to_return(json_response("hook.json"))
|
400
400
|
hook = @client.edit_hook("railsbp/railsbp.com", 154284, "railsbp", {:railsbp_url => "http://railsbp.com", :token => "xAAQZtJhYHGagsed1kYR"})
|
401
401
|
expect(hook.id).to eq(154284)
|
402
402
|
expect(hook.config.token).to eq("xAAQZtJhYHGagsed1kYR")
|
@@ -409,7 +409,7 @@ describe Octokit::Client::Repositories do
|
|
409
409
|
it "removes a hook" do
|
410
410
|
stub_delete("/repos/railsbp/railsbp.com/hooks/154284").
|
411
411
|
to_return(:status => 204)
|
412
|
-
expect(@client.remove_hook("railsbp/railsbp.com", 154284)).to
|
412
|
+
expect(@client.remove_hook("railsbp/railsbp.com", 154284)).to be_true
|
413
413
|
end
|
414
414
|
|
415
415
|
end
|
@@ -419,7 +419,7 @@ describe Octokit::Client::Repositories do
|
|
419
419
|
it "tests a hook" do
|
420
420
|
stub_post("/repos/railsbp/railsbp.com/hooks/154284/test").
|
421
421
|
to_return(:status => 204)
|
422
|
-
expect(@client.test_hook("railsbp/railsbp.com", 154284)).to
|
422
|
+
expect(@client.test_hook("railsbp/railsbp.com", 154284)).to be_true
|
423
423
|
end
|
424
424
|
|
425
425
|
end
|
@@ -428,7 +428,7 @@ describe Octokit::Client::Repositories do
|
|
428
428
|
|
429
429
|
it "lists events for all issues in a repository" do
|
430
430
|
stub_get("/repos/pengwynn/octokit/issues/events").
|
431
|
-
to_return(
|
431
|
+
to_return(json_response("repo_issues_events.json"))
|
432
432
|
events = @client.repo_issue_events("pengwynn/octokit")
|
433
433
|
expect(events.first.actor.login).to eq("ctshryock")
|
434
434
|
expect(events.first.event).to eq("subscribed")
|
@@ -440,11 +440,63 @@ describe Octokit::Client::Repositories do
|
|
440
440
|
|
441
441
|
it "lists all the available assignees (owner + collaborators)" do
|
442
442
|
stub_get("/repos/pengwynn/octokit/assignees").
|
443
|
-
to_return(
|
443
|
+
to_return(json_response("repo_assignees.json"))
|
444
444
|
assignees = @client.repo_assignees("pengwynn/octokit")
|
445
445
|
expect(assignees.first.login).to eq("adamstac")
|
446
446
|
end
|
447
447
|
|
448
448
|
end
|
449
449
|
|
450
|
+
describe ".subscribers" do
|
451
|
+
|
452
|
+
it "lists all the users watching the repository" do
|
453
|
+
stub_get("/repos/pengwynn/octokit/subscribers").
|
454
|
+
to_return(json_response("subscribers.json"))
|
455
|
+
subscribers = @client.subscribers("pengwynn/octokit")
|
456
|
+
expect(subscribers.first.id).to eq(865)
|
457
|
+
expect(subscribers.first.login).to eq("pengwynn")
|
458
|
+
end
|
459
|
+
|
460
|
+
end
|
461
|
+
|
462
|
+
describe ".subscription" do
|
463
|
+
|
464
|
+
it "returns a repository subscription" do
|
465
|
+
stub_get("/repos/pengwynn/octokit/subscription").
|
466
|
+
to_return(json_response("subscription.json"))
|
467
|
+
subscription = @client.subscription("pengwynn/octokit")
|
468
|
+
expect(subscription.subscribed).to be_true
|
469
|
+
end
|
470
|
+
|
471
|
+
end
|
472
|
+
|
473
|
+
describe ".update_subscription" do
|
474
|
+
|
475
|
+
it "updates a repository subscription" do
|
476
|
+
stub_put("/repos/pengwynn/octokit/subscription").
|
477
|
+
to_return(json_response("subscription_update.json"))
|
478
|
+
subscription = @client.update_subscription("pengwynn/octokit", :subscribed => false)
|
479
|
+
expect(subscription.subscribed).to be_false
|
480
|
+
end
|
481
|
+
|
482
|
+
end
|
483
|
+
|
484
|
+
describe ".delete_subscription" do
|
485
|
+
|
486
|
+
it "returns true when repo subscription deleted" do
|
487
|
+
stub_delete("/repos/pengwynn/octokit/subscription").
|
488
|
+
to_return(:status => 204)
|
489
|
+
result = @client.delete_subscription("pengwynn/octokit")
|
490
|
+
expect(result).to be_true
|
491
|
+
end
|
492
|
+
|
493
|
+
it "returns false when delete repo subscription fails" do
|
494
|
+
stub_delete("/repos/pengwynn/octokit/subscription").
|
495
|
+
to_return(:status => 500)
|
496
|
+
result = @client.delete_subscription("pengwynn/octokit")
|
497
|
+
expect(result).to be_false
|
498
|
+
end
|
499
|
+
|
500
|
+
end
|
501
|
+
|
450
502
|
end
|