octokit 0.6.4 → 0.6.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +2 -2
- data/CHANGELOG.md +1 -0
- data/README.md +46 -24
- data/Rakefile +0 -0
- data/lib/octokit/authentication.rb +1 -3
- data/lib/octokit/client.rb +3 -1
- data/lib/octokit/client/commits.rb +3 -2
- data/lib/octokit/client/issues.rb +11 -62
- data/lib/octokit/client/labels.rb +153 -0
- data/lib/octokit/client/milestones.rb +1 -1
- data/lib/octokit/client/pub_sub_hubbub/service_hooks.rb +2 -4
- data/lib/octokit/client/repositories.rb +41 -31
- data/lib/octokit/client/timelines.rb +1 -2
- data/lib/octokit/configuration.rb +5 -12
- data/lib/octokit/repository.rb +1 -1
- data/lib/octokit/version.rb +1 -1
- data/octokit.gemspec +16 -25
- data/spec/fixtures/v3/branches.json +16 -0
- data/spec/fixtures/v3/collaborators.json +62 -0
- data/spec/fixtures/v3/commit.json +1 -0
- data/spec/fixtures/v3/commits.json +1 -0
- data/spec/fixtures/v3/contributors.json +891 -0
- data/spec/fixtures/v3/forks.json +872 -0
- data/spec/fixtures/v3/labels.json +3 -3
- data/spec/fixtures/v3/languages.json +5 -0
- data/spec/fixtures/v3/public_key.json +5 -0
- data/spec/fixtures/v3/public_keys.json +7 -0
- data/spec/fixtures/v3/repositories.json +872 -0
- data/spec/fixtures/v3/repository.json +34 -0
- data/spec/fixtures/v3/tags.json +173 -0
- data/spec/fixtures/v3/teams.json +12 -0
- data/spec/fixtures/v3/watchers.json +182 -0
- data/spec/helper.rb +3 -3
- data/spec/octokit/client/commits_spec.rb +5 -5
- data/spec/octokit/client/issues_spec.rb +14 -61
- data/spec/octokit/client/labels_spec.rb +152 -0
- data/spec/octokit/client/milestones_spec.rb +6 -6
- data/spec/octokit/client/objects_spec.rb +6 -6
- data/spec/octokit/client/organizations_spec.rb +19 -19
- data/spec/octokit/client/pub_sub_hubbub/service_hooks_spec.rb +2 -2
- data/spec/octokit/client/pub_sub_hubbub_spec.rb +3 -3
- data/spec/octokit/client/pulls_spec.rb +4 -4
- data/spec/octokit/client/repositories_spec.rb +81 -80
- data/spec/octokit/client/timelines_spec.rb +3 -3
- data/spec/octokit/client/users_spec.rb +21 -21
- data/spec/octokit/client_spec.rb +1 -11
- data/spec/octokit_spec.rb +1 -1
- metadata +125 -215
- data/.autotest +0 -1
- data/spec/fixtures/v2/branches.json +0 -1
- data/spec/fixtures/v2/collaborators.json +0 -1
- data/spec/fixtures/v2/commit.json +0 -1
- data/spec/fixtures/v2/commits.json +0 -1
- data/spec/fixtures/v2/contributors.json +0 -1
- data/spec/fixtures/v2/languages.json +0 -1
- data/spec/fixtures/v2/network.json +0 -1
- data/spec/fixtures/v2/repository.json +0 -1
- data/spec/fixtures/v2/watchers.json +0 -1
@@ -10,7 +10,7 @@ describe Octokit::Client::Issues do
|
|
10
10
|
describe ".search_issues" do
|
11
11
|
|
12
12
|
it "should return matching issues" do
|
13
|
-
stub_get("/api/v2/json/issues/search/sferik/rails_admin/open/activerecord").
|
13
|
+
stub_get("https://github.com/api/v2/json/issues/search/sferik/rails_admin/open/activerecord").
|
14
14
|
to_return(:body => fixture("v2/issues.json"))
|
15
15
|
issues = @client.search_issues("sferik/rails_admin", "activerecord")
|
16
16
|
issues.first.number.should == 105
|
@@ -21,7 +21,7 @@ describe Octokit::Client::Issues do
|
|
21
21
|
describe ".list_issues" do
|
22
22
|
|
23
23
|
it "should return issues" do
|
24
|
-
stub_get("
|
24
|
+
stub_get("/repos/sferik/rails_admin/issues").
|
25
25
|
to_return(:body => fixture("v3/issues.json"))
|
26
26
|
issues = @client.issues("sferik/rails_admin")
|
27
27
|
issues.first.number.should == 388
|
@@ -32,7 +32,7 @@ describe Octokit::Client::Issues do
|
|
32
32
|
describe ".create_issue" do
|
33
33
|
|
34
34
|
it "should create an issue" do
|
35
|
-
stub_post("/api/v2/json/issues/open/sferik/rails_admin").
|
35
|
+
stub_post("https://github.com/api/v2/json/issues/open/sferik/rails_admin").
|
36
36
|
to_return(:body => fixture("v2/issue.json"))
|
37
37
|
issue = @client.create_issue("sferik/rails_admin", "Use OrmAdapter instead of talking directly to ActiveRecord", "Hi,\n\nI just tried to play with this in an app with no ActiveRecord. I was disappointed. It seems the only reason the engine relies on AR is to provide History functionality. I would argue that having the History in a database, and therefore tying the app to AR & SQL, isn't worth it. How about we change it to just dump to a CSV and remove the AR dep?\n\n$0.02")
|
38
38
|
issue.number.should == 105
|
@@ -43,7 +43,7 @@ describe Octokit::Client::Issues do
|
|
43
43
|
describe ".issue" do
|
44
44
|
|
45
45
|
it "should return an issue" do
|
46
|
-
stub_get("/api/v2/json/issues/show/sferik/rails_admin/105").
|
46
|
+
stub_get("https://github.com/api/v2/json/issues/show/sferik/rails_admin/105").
|
47
47
|
to_return(:body => fixture("v2/issue.json"))
|
48
48
|
issue = @client.issue("sferik/rails_admin", 105)
|
49
49
|
issue.number.should == 105
|
@@ -54,7 +54,7 @@ describe Octokit::Client::Issues do
|
|
54
54
|
describe ".close_issue" do
|
55
55
|
|
56
56
|
it "should close an issue" do
|
57
|
-
stub_post("/api/v2/json/issues/close/sferik/rails_admin/105").
|
57
|
+
stub_post("https://github.com/api/v2/json/issues/close/sferik/rails_admin/105").
|
58
58
|
to_return(:body => fixture("v2/issue.json"))
|
59
59
|
issue = @client.close_issue("sferik/rails_admin", 105)
|
60
60
|
issue.number.should == 105
|
@@ -65,7 +65,7 @@ describe Octokit::Client::Issues do
|
|
65
65
|
describe ".reopen_issue" do
|
66
66
|
|
67
67
|
it "should reopen an issue" do
|
68
|
-
stub_post("/api/v2/json/issues/reopen/sferik/rails_admin/105").
|
68
|
+
stub_post("https://github.com/api/v2/json/issues/reopen/sferik/rails_admin/105").
|
69
69
|
to_return(:body => fixture("v2/issue.json"))
|
70
70
|
issue = @client.reopen_issue("sferik/rails_admin", 105)
|
71
71
|
issue.number.should == 105
|
@@ -76,7 +76,7 @@ describe Octokit::Client::Issues do
|
|
76
76
|
describe ".update_issue" do
|
77
77
|
|
78
78
|
it "should update an issue" do
|
79
|
-
stub_post("/api/v2/json/issues/edit/sferik/rails_admin/105").
|
79
|
+
stub_post("https://github.com/api/v2/json/issues/edit/sferik/rails_admin/105").
|
80
80
|
to_return(:body => fixture("v2/issue.json"))
|
81
81
|
issue = @client.update_issue("sferik/rails_admin", 105, "Use OrmAdapter instead of talking directly to ActiveRecord", "Hi,\n\nI just tried to play with this in an app with no ActiveRecord. I was disappointed. It seems the only reason the engine relies on AR is to provide History functionality. I would argue that having the History in a database, and therefore tying the app to AR & SQL, isn't worth it. How about we change it to just dump to a CSV and remove the AR dep?\n\n$0.02")
|
82
82
|
issue.number.should == 105
|
@@ -84,55 +84,10 @@ describe Octokit::Client::Issues do
|
|
84
84
|
|
85
85
|
end
|
86
86
|
|
87
|
-
describe ".labels" do
|
88
|
-
|
89
|
-
it "should return labels" do
|
90
|
-
stub_get("https://api.github.com/repos/pengwynn/octokit/labels").
|
91
|
-
to_return(:body => fixture("v3/labels.json"))
|
92
|
-
labels = @client.labels("pengwynn/octokit")
|
93
|
-
labels.first.name.should == "V3 Transition"
|
94
|
-
end
|
95
|
-
|
96
|
-
end
|
97
|
-
|
98
|
-
describe ".label" do
|
99
|
-
|
100
|
-
it "should return a single labels" do
|
101
|
-
stub_get("https://api.github.com/repos/pengwynn/octokit/labels/V3%20Addition").
|
102
|
-
to_return(:status => 200, :body => fixture('v3/label.json'))
|
103
|
-
label = @client.label("pengwynn/octokit", 'V3 Addition')
|
104
|
-
label.name.should == "V3 Addition"
|
105
|
-
end
|
106
|
-
|
107
|
-
end
|
108
|
-
|
109
|
-
describe ".add_label" do
|
110
|
-
|
111
|
-
it "should add a label" do
|
112
|
-
stub_post("https://api.github.com/repos/pengwynn/octokit/labels").
|
113
|
-
to_return(:status => 201, :body => fixture('v3/label.json'))
|
114
|
-
labels = @client.add_label("pengwynn/octokit", "bug", 'ededed')
|
115
|
-
labels.color.should == "ededed"
|
116
|
-
labels.name.should == "V3 Addition"
|
117
|
-
end
|
118
|
-
|
119
|
-
end
|
120
|
-
|
121
|
-
describe ".remove_label" do
|
122
|
-
|
123
|
-
it "should remove a label" do
|
124
|
-
stub_post("/api/v2/json/issues/label/remove/sferik/rails_admin/bug").
|
125
|
-
to_return(:body => fixture("v2/labels.json"))
|
126
|
-
labels = @client.remove_label("sferik/rails_admin", "bug")
|
127
|
-
labels.first.should == "bug"
|
128
|
-
end
|
129
|
-
|
130
|
-
end
|
131
|
-
|
132
87
|
describe ".issue_comments" do
|
133
88
|
|
134
89
|
it "should return comments for an issue" do
|
135
|
-
stub_get("
|
90
|
+
stub_get("/repos/pengwynn/octokit/issues/25/comments").
|
136
91
|
to_return(:status => 200, :body => fixture('v3/comments.json'))
|
137
92
|
comments = @client.issue_comments("pengwynn/octokit", 25)
|
138
93
|
comments.first.user.login.should == "ctshryock"
|
@@ -143,7 +98,7 @@ describe Octokit::Client::Issues do
|
|
143
98
|
describe ".issue_comment" do
|
144
99
|
|
145
100
|
it "should return a single comment for an issue" do
|
146
|
-
stub_get("
|
101
|
+
stub_get("/repos/pengwynn/octokit/issues/comments/25").
|
147
102
|
to_return(:status => 200, :body => fixture('v3/comment.json'))
|
148
103
|
comments = @client.issue_comment("pengwynn/octokit", 25)
|
149
104
|
comments.user.login.should == "ctshryock"
|
@@ -155,9 +110,8 @@ describe Octokit::Client::Issues do
|
|
155
110
|
describe ".add_comment" do
|
156
111
|
|
157
112
|
it "should add a comment" do
|
158
|
-
stub_post("
|
159
|
-
with(:body =>
|
160
|
-
:headers => {'Content-Type'=>'application/json'}).
|
113
|
+
stub_post("/repos/pengwynn/octokit/issues/25/comments").
|
114
|
+
with(:body => {"body" => "A test comment"}).
|
161
115
|
to_return(:status => 201, :body => fixture('v3/comment.json'))
|
162
116
|
comment = @client.add_comment("pengwynn/octokit", 25, "A test comment")
|
163
117
|
comment.user.login.should == "ctshryock"
|
@@ -168,9 +122,8 @@ describe Octokit::Client::Issues do
|
|
168
122
|
describe ".update_comment" do
|
169
123
|
|
170
124
|
it "should update an existing comment" do
|
171
|
-
stub_post("
|
172
|
-
with(:body =>
|
173
|
-
:headers => {'Content-Type'=>'application/json'}).
|
125
|
+
stub_post("/repos/pengwynn/octokit/issues/comments/1194549").
|
126
|
+
with(:body => {"body" => "A test comment update"}).
|
174
127
|
to_return(:status => 200, :body => fixture('v3/comment.json'))
|
175
128
|
comment = @client.update_comment("pengwynn/octokit", 1194549, "A test comment update")
|
176
129
|
comment.user.login.should == "ctshryock"
|
@@ -181,7 +134,7 @@ describe Octokit::Client::Issues do
|
|
181
134
|
describe ".delete_comment" do
|
182
135
|
|
183
136
|
it "should delete an existing comment" do
|
184
|
-
stub_delete("
|
137
|
+
stub_delete("/repos/pengwynn/octokit/issues/comments/1194549").
|
185
138
|
to_return(:status => 204)
|
186
139
|
comment = @client.delete_comment("pengwynn/octokit", 1194549)
|
187
140
|
comment.status.should == 204
|
@@ -0,0 +1,152 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
describe Octokit::Client::Issues do
|
5
|
+
|
6
|
+
before do
|
7
|
+
@client = Octokit::Client.new(:login => 'sferik')
|
8
|
+
end
|
9
|
+
|
10
|
+
describe ".labels" do
|
11
|
+
|
12
|
+
it "should return labels" do
|
13
|
+
stub_get("/repos/pengwynn/octokit/labels").
|
14
|
+
to_return(:body => fixture("v3/labels.json"))
|
15
|
+
labels = @client.labels("pengwynn/octokit")
|
16
|
+
labels.first.name.should == "V3 Transition"
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
describe ".label" do
|
22
|
+
|
23
|
+
it "should return a single labels" do
|
24
|
+
stub_get("/repos/pengwynn/octokit/labels/V3+Addition").
|
25
|
+
to_return(:status => 200, :body => fixture('v3/label.json'))
|
26
|
+
label = @client.label("pengwynn/octokit", "V3 Addition")
|
27
|
+
label.name.should == "V3 Addition"
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
describe ".add_label" do
|
33
|
+
|
34
|
+
it "should add a label with a color" do
|
35
|
+
stub_post("/repos/pengwynn/octokit/labels").
|
36
|
+
with(:body => {"name" => "a significant bug", "color" => "ededed"},
|
37
|
+
:headers => {'Content-Type'=>'application/json'}).
|
38
|
+
to_return(:status => 201, :body => fixture('v3/label.json'))
|
39
|
+
labels = @client.add_label("pengwynn/octokit", "a significant bug", 'ededed')
|
40
|
+
labels.color.should == "ededed"
|
41
|
+
labels.name.should == "V3 Addition"
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should add a label with default color" do
|
45
|
+
stub_post("/repos/pengwynn/octokit/labels").
|
46
|
+
with(:body => {"name" => "another significant bug", "color" => "ffffff"},
|
47
|
+
:headers => {'Content-Type'=>'application/json'}).
|
48
|
+
to_return(:status => 201, :body => fixture('v3/label.json'))
|
49
|
+
labels = @client.add_label("pengwynn/octokit", "another significant bug")
|
50
|
+
labels.color.should == "ededed"
|
51
|
+
labels.name.should == "V3 Addition"
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
describe ".update_label" do
|
57
|
+
|
58
|
+
it "should update a label with a new color" do
|
59
|
+
stub_post("/repos/pengwynn/octokit/labels/V3+Addition").
|
60
|
+
with(:body => {"color" => "ededed"},
|
61
|
+
:headers => {'Content-Type'=>'application/json'}).
|
62
|
+
to_return(:status => 200, :body => fixture('v3/label.json'))
|
63
|
+
|
64
|
+
label = @client.update_label("pengwynn/octokit", "V3 Addition", {:color => 'ededed'})
|
65
|
+
label.color.should == 'ededed'
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
describe ".delete_label!" do
|
71
|
+
|
72
|
+
it "should delete a label from the repository" do
|
73
|
+
stub_delete("/repos/pengwynn/octokit/labels/V3+Transition").
|
74
|
+
to_return(:status => 204)
|
75
|
+
|
76
|
+
response = @client.delete_label!("pengwynn/octokit", "V3 Transition")
|
77
|
+
response.status.should == 204
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
|
82
|
+
describe ".remove_label" do
|
83
|
+
|
84
|
+
it "should remove a label from the specified issue" do
|
85
|
+
stub_delete("/repos/pengwynn/octokit/issues/23/labels/V3+Transition").
|
86
|
+
to_return(:status => 200, :body => fixture('v3/labels.json'), :headers => {})
|
87
|
+
|
88
|
+
response = @client.remove_label("pengwynn/octokit", 23, "V3 Transition")
|
89
|
+
response.last.name.should == 'Bug'
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
93
|
+
|
94
|
+
describe ".remove_all_labels" do
|
95
|
+
|
96
|
+
it "should remove all labels from the specified issue" do
|
97
|
+
stub_delete("/repos/pengwynn/octokit/issues/23/labels").
|
98
|
+
to_return(:status => 204)
|
99
|
+
|
100
|
+
response = @client.remove_all_labels('pengwynn/octokit', 23)
|
101
|
+
response.status.should == 204
|
102
|
+
end
|
103
|
+
|
104
|
+
end
|
105
|
+
|
106
|
+
describe ".add_labels_to_an_issue" do
|
107
|
+
it "should add labels to a given issue" do
|
108
|
+
stub_post("/repos/pengwynn/octokit/issues/42/labels").
|
109
|
+
with(:body => '["V3 Transition","Bug"]',
|
110
|
+
:headers => {'Accept'=>'*/*', 'Content-Type'=>'application/json'}).
|
111
|
+
to_return(:status => 200, :body => fixture('v3/labels.json'), :headers => {})
|
112
|
+
|
113
|
+
labels = @client.add_labels_to_an_issue('pengwynn/octokit', 42, ['V3 Transition', 'Bug'])
|
114
|
+
labels.first.name.should == 'V3 Transition'
|
115
|
+
labels.last.name.should == 'Bug'
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
describe ".replace_all_labels" do
|
120
|
+
it "should replace all labels for an issue" do
|
121
|
+
stub_put("/repos/pengwynn/octokit/issues/42/labels").
|
122
|
+
with(:body => '["V3 Transition","V3 Adding"]',
|
123
|
+
:headers => {'Accept'=>'*/*', 'Content-Type'=>'application/json'}).
|
124
|
+
to_return(:status => 200, :body => fixture('v3/labels.json'), :headers => {})
|
125
|
+
|
126
|
+
labels = @client.replace_all_labels('pengwynn/octokit', 42, ['V3 Transition', 'V3 Adding'])
|
127
|
+
labels.first.name.should == 'V3 Transition'
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
describe ".lables_for_milestone" do
|
132
|
+
it "should return all labels for a repository" do
|
133
|
+
stub_get('/repos/pengwynn/octokit/milestones/2/labels').
|
134
|
+
to_return(:status => 200, :body => fixture('v3/labels.json'), :headers => {})
|
135
|
+
|
136
|
+
labels = @client.labels_for_milestone('pengwynn/octokit', 2)
|
137
|
+
labels.size.should == 3
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
describe ".labels_for_issue" do
|
142
|
+
it "should return all labels for a given issue" do
|
143
|
+
stub_get("/repos/pengwynn/octokit/issues/37/labels").
|
144
|
+
to_return(:status => 200, :body => fixture('v3/labels.json'), :headers => {})
|
145
|
+
|
146
|
+
labels = @client.labels_for_issue('pengwynn/octokit', 37)
|
147
|
+
labels.first.name.should == 'V3 Transition'
|
148
|
+
labels.last.name.should == 'Bug'
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
end
|
@@ -10,7 +10,7 @@ describe Octokit::Client::Milestones do
|
|
10
10
|
describe ".list_milestones" do
|
11
11
|
|
12
12
|
it "should list milestones belonging to repository" do
|
13
|
-
stub_get("
|
13
|
+
stub_get("/repos/pengwynn/octokit/milestones").
|
14
14
|
to_return(:status => 200, :body => fixture('v3/milestones.json'))
|
15
15
|
milestones = @client.list_milestones("pengwynn/octokit")
|
16
16
|
milestones.first.description.should == "Add support for API v3"
|
@@ -21,7 +21,7 @@ describe Octokit::Client::Milestones do
|
|
21
21
|
describe ".milestone" do
|
22
22
|
|
23
23
|
it "should get a single milestone belonging to repository" do
|
24
|
-
stub_get("
|
24
|
+
stub_get("/repos/pengwynn/octokit/milestones/1").
|
25
25
|
to_return(:status => 200, :body => fixture('v3/milestone.json'))
|
26
26
|
milestones = @client.milestone("pengwynn/octokit", 1)
|
27
27
|
milestones.description.should == "Add support for API v3"
|
@@ -32,7 +32,7 @@ describe Octokit::Client::Milestones do
|
|
32
32
|
describe ".create_milestone" do
|
33
33
|
|
34
34
|
it "should create a single milestone" do
|
35
|
-
stub_post("
|
35
|
+
stub_post("/repos/pengwynn/octokit/milestones").
|
36
36
|
with(:body => '{"title":"0.7.0"}', :headers => {'Content-Type'=>'application/json'}).
|
37
37
|
to_return(:status => 201, :body => fixture('v3/milestone.json'))
|
38
38
|
milestone = @client.create_milestone("pengwynn/octokit", "0.7.0")
|
@@ -44,8 +44,8 @@ describe Octokit::Client::Milestones do
|
|
44
44
|
describe ".update_milestone" do
|
45
45
|
|
46
46
|
it "should update a milestone" do
|
47
|
-
stub_post("
|
48
|
-
with(:body =>
|
47
|
+
stub_post("/repos/pengwynn/octokit/milestones/1").
|
48
|
+
with(:body => {"description" => "Add support for API v3"}, :headers => {'Accept'=>'*/*', 'Content-Type'=>'application/json'}).
|
49
49
|
to_return(:status => 200, :body => fixture('v3/milestone.json'))
|
50
50
|
milestone = @client.update_milestone("pengwynn/octokit", 1, {:description => "Add support for API v3"})
|
51
51
|
milestone.description.should == "Add support for API v3"
|
@@ -56,7 +56,7 @@ describe Octokit::Client::Milestones do
|
|
56
56
|
describe ".delete_milestone" do
|
57
57
|
|
58
58
|
it "should delete a milestone from a repository" do
|
59
|
-
stub_delete("
|
59
|
+
stub_delete("/repos/pengwynn/octokit/milestones/2").
|
60
60
|
to_return(:status => 204, :body => "", :headers => {})
|
61
61
|
response = @client.delete_milestone("pengwynn/octokit", 2)
|
62
62
|
response.status.should == 204
|
@@ -10,7 +10,7 @@ describe Octokit::Client::Objects do
|
|
10
10
|
describe ".tree" do
|
11
11
|
|
12
12
|
it "should return a tree" do
|
13
|
-
stub_get("/api/v2/json/tree/show/sferik/rails_admin/3cdfabd973bc3caac209cba903cfdb3bf6636bcd").
|
13
|
+
stub_get("https://github.com/api/v2/json/tree/show/sferik/rails_admin/3cdfabd973bc3caac209cba903cfdb3bf6636bcd").
|
14
14
|
to_return(:body => fixture("v2/tree.json"))
|
15
15
|
tree = @client.tree("sferik/rails_admin", "3cdfabd973bc3caac209cba903cfdb3bf6636bcd")
|
16
16
|
tree.first.name.should == ".gitignore"
|
@@ -21,7 +21,7 @@ describe Octokit::Client::Objects do
|
|
21
21
|
describe ".blob" do
|
22
22
|
|
23
23
|
it "should return a blob" do
|
24
|
-
stub_get("/api/v2/json/blob/show/sferik/rails_admin/3cdfabd973bc3caac209cba903cfdb3bf6636bcd/README.mkd").
|
24
|
+
stub_get("https://github.com/api/v2/json/blob/show/sferik/rails_admin/3cdfabd973bc3caac209cba903cfdb3bf6636bcd/README.mkd").
|
25
25
|
to_return(:body => fixture("v2/blob.json"))
|
26
26
|
blob = @client.blob("sferik/rails_admin", "3cdfabd973bc3caac209cba903cfdb3bf6636bcd", "README.mkd")
|
27
27
|
blob.name.should == "README.mkd"
|
@@ -32,7 +32,7 @@ describe Octokit::Client::Objects do
|
|
32
32
|
describe ".blobs" do
|
33
33
|
|
34
34
|
it "should return blobs" do
|
35
|
-
stub_get("/api/v2/json/blob/all/sferik/rails_admin/3cdfabd973bc3caac209cba903cfdb3bf6636bcd").
|
35
|
+
stub_get("https://github.com/api/v2/json/blob/all/sferik/rails_admin/3cdfabd973bc3caac209cba903cfdb3bf6636bcd").
|
36
36
|
to_return(:body => fixture("v2/blobs.json"))
|
37
37
|
blobs = @client.blobs("sferik/rails_admin", "3cdfabd973bc3caac209cba903cfdb3bf6636bcd")
|
38
38
|
blobs[".gitignore"].should == "5efe0eb47a773fa6ea84a0bf190ee218b6a31ead"
|
@@ -43,7 +43,7 @@ describe Octokit::Client::Objects do
|
|
43
43
|
describe ".blob_metadata" do
|
44
44
|
|
45
45
|
it "should return blob metadata" do
|
46
|
-
stub_get("/api/v2/json/blob/full/sferik/rails_admin/3cdfabd973bc3caac209cba903cfdb3bf6636bcd").
|
46
|
+
stub_get("https://github.com/api/v2/json/blob/full/sferik/rails_admin/3cdfabd973bc3caac209cba903cfdb3bf6636bcd").
|
47
47
|
to_return(:body => fixture("v2/blob_metadata.json"))
|
48
48
|
blob_metadata = @client.blob_metadata("sferik/rails_admin", "3cdfabd973bc3caac209cba903cfdb3bf6636bcd")
|
49
49
|
blob_metadata.first.name.should == ".gitignore"
|
@@ -54,7 +54,7 @@ describe Octokit::Client::Objects do
|
|
54
54
|
describe ".tree_metadata" do
|
55
55
|
|
56
56
|
it "should return tree metadata" do
|
57
|
-
stub_get("/api/v2/json/tree/full/sferik/rails_admin/3cdfabd973bc3caac209cba903cfdb3bf6636bcd").
|
57
|
+
stub_get("https://github.com/api/v2/json/tree/full/sferik/rails_admin/3cdfabd973bc3caac209cba903cfdb3bf6636bcd").
|
58
58
|
to_return(:body => fixture("v2/tree_metadata.json"))
|
59
59
|
tree_metadata = @client.tree_metadata("sferik/rails_admin", "3cdfabd973bc3caac209cba903cfdb3bf6636bcd")
|
60
60
|
tree_metadata.first.name.should == ".gitignore"
|
@@ -65,7 +65,7 @@ describe Octokit::Client::Objects do
|
|
65
65
|
describe ".raw" do
|
66
66
|
|
67
67
|
it "should return raw data" do
|
68
|
-
stub_get("/api/v2/json/blob/show/sferik/rails_admin/3cdfabd973bc3caac209cba903cfdb3bf6636bcd").
|
68
|
+
stub_get("https://github.com/api/v2/json/blob/show/sferik/rails_admin/3cdfabd973bc3caac209cba903cfdb3bf6636bcd").
|
69
69
|
to_return(:body => fixture("v2/raw.txt"))
|
70
70
|
raw = @client.raw("sferik/rails_admin", "3cdfabd973bc3caac209cba903cfdb3bf6636bcd")
|
71
71
|
lambda {
|
@@ -10,7 +10,7 @@ describe Octokit::Client::Organizations do
|
|
10
10
|
describe ".organization" do
|
11
11
|
|
12
12
|
it "should return an organization" do
|
13
|
-
stub_get("/api/v2/json/organizations/codeforamerica").
|
13
|
+
stub_get("https://github.com/api/v2/json/organizations/codeforamerica").
|
14
14
|
to_return(:body => fixture("v2/organization.json"))
|
15
15
|
organization = @client.organization("codeforamerica")
|
16
16
|
organization.name.should == "Code For America"
|
@@ -21,7 +21,7 @@ describe Octokit::Client::Organizations do
|
|
21
21
|
describe ".update_organization" do
|
22
22
|
|
23
23
|
it "should update an organization" do
|
24
|
-
stub_put("/api/v2/json/organizations/codeforamerica").
|
24
|
+
stub_put("https://github.com/api/v2/json/organizations/codeforamerica").
|
25
25
|
with(:name => "Code For America").
|
26
26
|
to_return(:body => fixture("v2/organization.json"))
|
27
27
|
organization = @client.update_organization("codeforamerica", {:name => "Code For America"})
|
@@ -35,7 +35,7 @@ describe Octokit::Client::Organizations do
|
|
35
35
|
context "with an org passed" do
|
36
36
|
|
37
37
|
it "should return all organizations for a user" do
|
38
|
-
stub_get("/api/v2/json/user/show/sferik/organizations").
|
38
|
+
stub_get("https://github.com/api/v2/json/user/show/sferik/organizations").
|
39
39
|
to_return(:body => fixture("v2/organizations.json"))
|
40
40
|
organizations = @client.organizations("sferik")
|
41
41
|
organizations.first.name.should == "Hubcap"
|
@@ -46,7 +46,7 @@ describe Octokit::Client::Organizations do
|
|
46
46
|
context "without an org passed" do
|
47
47
|
|
48
48
|
it "should return all organizations for a user" do
|
49
|
-
stub_get("/api/v2/json/organizations").
|
49
|
+
stub_get("https://github.com/api/v2/json/organizations").
|
50
50
|
to_return(:body => fixture("v2/organizations.json"))
|
51
51
|
organizations = @client.organizations
|
52
52
|
organizations.first.name.should == "Hubcap"
|
@@ -61,7 +61,7 @@ describe Octokit::Client::Organizations do
|
|
61
61
|
context "with an org passed" do
|
62
62
|
|
63
63
|
it "should return all public repositories for an organization" do
|
64
|
-
stub_get("/api/v2/json/organizations/codeforamerica/public_repositories").
|
64
|
+
stub_get("https://github.com/api/v2/json/organizations/codeforamerica/public_repositories").
|
65
65
|
to_return(:body => fixture("v2/repositories.json"))
|
66
66
|
repositories = @client.organization_repositories("codeforamerica")
|
67
67
|
repositories.first.name.should == "One40Proof"
|
@@ -72,7 +72,7 @@ describe Octokit::Client::Organizations do
|
|
72
72
|
context "without an org passed" do
|
73
73
|
|
74
74
|
it "should return all organization repositories for a user" do
|
75
|
-
stub_get("/api/v2/json/organizations/repositories").
|
75
|
+
stub_get("https://github.com/api/v2/json/organizations/repositories").
|
76
76
|
to_return(:body => fixture("v2/repositories.json"))
|
77
77
|
repositories = @client.organization_repositories
|
78
78
|
repositories.first.name.should == "One40Proof"
|
@@ -85,7 +85,7 @@ describe Octokit::Client::Organizations do
|
|
85
85
|
describe ".organization_members" do
|
86
86
|
|
87
87
|
it "should return all public members of an organization" do
|
88
|
-
stub_get("/api/v2/json/organizations/codeforamerica/public_members").
|
88
|
+
stub_get("https://github.com/api/v2/json/organizations/codeforamerica/public_members").
|
89
89
|
to_return(:body => fixture("v2/users.json"))
|
90
90
|
users = @client.organization_members("codeforamerica")
|
91
91
|
users.first.name.should == "Erik Michaels-Ober"
|
@@ -96,7 +96,7 @@ describe Octokit::Client::Organizations do
|
|
96
96
|
describe ".organization_teams" do
|
97
97
|
|
98
98
|
it "should return all teams for an organization" do
|
99
|
-
stub_get("/api/v2/json/organizations/codeforamerica/teams").
|
99
|
+
stub_get("https://github.com/api/v2/json/organizations/codeforamerica/teams").
|
100
100
|
to_return(:body => fixture("v2/teams.json"))
|
101
101
|
teams = @client.organization_teams("codeforamerica")
|
102
102
|
teams.first.name.should == "Fellows"
|
@@ -107,7 +107,7 @@ describe Octokit::Client::Organizations do
|
|
107
107
|
describe ".create_team" do
|
108
108
|
|
109
109
|
it "should create a team" do
|
110
|
-
stub_post("/api/v2/json/organizations/codeforamerica/teams").
|
110
|
+
stub_post("https://github.com/api/v2/json/organizations/codeforamerica/teams").
|
111
111
|
with(:name => "Fellows").
|
112
112
|
to_return(:body => fixture("v2/team.json"))
|
113
113
|
team = @client.create_team("codeforamerica", {:name => "Fellows"})
|
@@ -119,7 +119,7 @@ describe Octokit::Client::Organizations do
|
|
119
119
|
describe ".team" do
|
120
120
|
|
121
121
|
it "should return a team" do
|
122
|
-
stub_get("/api/v2/json/teams/32598").
|
122
|
+
stub_get("https://github.com/api/v2/json/teams/32598").
|
123
123
|
to_return(:body => fixture("v2/team.json"))
|
124
124
|
team = @client.team(32598)
|
125
125
|
team.name.should == "Fellows"
|
@@ -130,7 +130,7 @@ describe Octokit::Client::Organizations do
|
|
130
130
|
describe ".update_team" do
|
131
131
|
|
132
132
|
it "should update a team" do
|
133
|
-
stub_put("/api/v2/json/teams/32598").
|
133
|
+
stub_put("https://github.com/api/v2/json/teams/32598").
|
134
134
|
with(:name => "Fellows").
|
135
135
|
to_return(:body => fixture("v2/team.json"))
|
136
136
|
team = @client.update_team(32598, :name => "Fellows")
|
@@ -142,7 +142,7 @@ describe Octokit::Client::Organizations do
|
|
142
142
|
describe ".delete_team" do
|
143
143
|
|
144
144
|
it "should delete a team" do
|
145
|
-
stub_delete("/api/v2/json/teams/32598").
|
145
|
+
stub_delete("https://github.com/api/v2/json/teams/32598").
|
146
146
|
to_return(:body => fixture("v2/team.json"))
|
147
147
|
team = @client.delete_team(32598)
|
148
148
|
team.name.should == "Fellows"
|
@@ -153,7 +153,7 @@ describe Octokit::Client::Organizations do
|
|
153
153
|
describe ".delete_team" do
|
154
154
|
|
155
155
|
it "should delete a team" do
|
156
|
-
stub_delete("/api/v2/json/teams/32598").
|
156
|
+
stub_delete("https://github.com/api/v2/json/teams/32598").
|
157
157
|
to_return(:body => fixture("v2/team.json"))
|
158
158
|
team = @client.delete_team(32598)
|
159
159
|
team.name.should == "Fellows"
|
@@ -164,7 +164,7 @@ describe Octokit::Client::Organizations do
|
|
164
164
|
describe ".team_members" do
|
165
165
|
|
166
166
|
it "should return team members" do
|
167
|
-
stub_get("/api/v2/json/teams/32598/members").
|
167
|
+
stub_get("https://github.com/api/v2/json/teams/32598/members").
|
168
168
|
to_return(:body => fixture("v2/users.json"))
|
169
169
|
users = @client.team_members(32598)
|
170
170
|
users.first.name.should == "Erik Michaels-Ober"
|
@@ -175,7 +175,7 @@ describe Octokit::Client::Organizations do
|
|
175
175
|
describe ".add_team_member" do
|
176
176
|
|
177
177
|
it "should add a team member" do
|
178
|
-
stub_post("/api/v2/json/teams/32598/members").
|
178
|
+
stub_post("https://github.com/api/v2/json/teams/32598/members").
|
179
179
|
with(:name => "sferik").
|
180
180
|
to_return(:body => fixture("v2/user.json"))
|
181
181
|
user = @client.add_team_member(32598, "sferik")
|
@@ -187,7 +187,7 @@ describe Octokit::Client::Organizations do
|
|
187
187
|
describe ".remove_team_member" do
|
188
188
|
|
189
189
|
it "should remove a team member" do
|
190
|
-
stub_delete("/api/v2/json/teams/32598/members").
|
190
|
+
stub_delete("https://github.com/api/v2/json/teams/32598/members").
|
191
191
|
with(:query => {:name => "sferik"}).
|
192
192
|
to_return(:body => fixture("v2/user.json"))
|
193
193
|
user = @client.remove_team_member(32598, "sferik")
|
@@ -199,7 +199,7 @@ describe Octokit::Client::Organizations do
|
|
199
199
|
describe ".team_repositories" do
|
200
200
|
|
201
201
|
it "should return team repositories" do
|
202
|
-
stub_get("/api/v2/json/teams/32598/repositories").
|
202
|
+
stub_get("https://github.com/api/v2/json/teams/32598/repositories").
|
203
203
|
to_return(:body => fixture("v2/repositories.json"))
|
204
204
|
repositories = @client.team_repositories(32598)
|
205
205
|
repositories.first.name.should == "One40Proof"
|
@@ -210,7 +210,7 @@ describe Octokit::Client::Organizations do
|
|
210
210
|
describe ".add_team_repository" do
|
211
211
|
|
212
212
|
it "should add a team repository" do
|
213
|
-
stub_post("/api/v2/json/teams/32598/repositories").
|
213
|
+
stub_post("https://github.com/api/v2/json/teams/32598/repositories").
|
214
214
|
with(:name => "reddavis/One40Proof").
|
215
215
|
to_return(:body => fixture("v2/repositories.json"))
|
216
216
|
repositories = @client.add_team_repository(32598, "reddavis/One40Proof")
|
@@ -222,7 +222,7 @@ describe Octokit::Client::Organizations do
|
|
222
222
|
describe ".remove_team_repository" do
|
223
223
|
|
224
224
|
it "should remove a team repository" do
|
225
|
-
stub_delete("/api/v2/json/teams/32598/repositories").
|
225
|
+
stub_delete("https://github.com/api/v2/json/teams/32598/repositories").
|
226
226
|
with(:query => {:name => "reddavis/One40Proof"}).
|
227
227
|
to_return(:body => fixture("v2/repositories.json"))
|
228
228
|
repositories = @client.remove_team_repository(32598, "reddavis/One40Proof")
|