octokit 1.17.0 → 1.17.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,13 +9,13 @@ describe Octokit::Client::Markdown do
9
9
  @client = Octokit::Client.new
10
10
  end
11
11
 
12
- it "should render markdown" do
12
+ it "renders markdown" do
13
13
  stub_post("/markdown").
14
14
  to_return(:body => fixture("v3/markdown_gfm"))
15
15
  text = "This is for #111"
16
16
  markdown = @client.markdown(text, :context => 'pengwynn/octokit', :mode => 'gfm')
17
17
 
18
- markdown.should include('https://github.com/pengwynn/octokit/issues/111')
18
+ expect(markdown).to include('https://github.com/pengwynn/octokit/issues/111')
19
19
  end
20
20
 
21
21
  end
@@ -9,57 +9,57 @@ describe Octokit::Client::Milestones do
9
9
 
10
10
  describe ".list_milestones" do
11
11
 
12
- it "should list milestones belonging to repository" do
12
+ it "lists milestones belonging to repository" do
13
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
- milestones.first.description.should == "Add support for API v3"
16
+ expect(milestones.first.description).to eq("Add support for API v3")
17
17
  end
18
18
 
19
19
  end
20
20
 
21
21
  describe ".milestone" do
22
22
 
23
- it "should get a single milestone belonging to repository" do
23
+ it "gets a single milestone belonging to repository" do
24
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
- milestones.description.should == "Add support for API v3"
27
+ expect(milestones.description).to eq("Add support for API v3")
28
28
  end
29
29
 
30
30
  end
31
31
 
32
32
  describe ".create_milestone" do
33
33
 
34
- it "should create a single milestone" do
34
+ it "creates a single milestone" do
35
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")
39
- milestone.title.should == "0.7.0"
39
+ expect(milestone.title).to eq("0.7.0")
40
40
  end
41
41
 
42
42
  end
43
43
 
44
44
  describe ".update_milestone" do
45
45
 
46
- it "should update a milestone" do
46
+ it "updates a milestone" do
47
47
  stub_post("/repos/pengwynn/octokit/milestones/1").
48
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
- milestone.description.should == "Add support for API v3"
51
+ expect(milestone.description).to eq("Add support for API v3")
52
52
  end
53
53
 
54
54
  end
55
55
 
56
56
  describe ".delete_milestone" do
57
57
 
58
- it "should delete a milestone from a repository" do
58
+ it "deletes a milestone from a repository" do
59
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
- response.status.should == 204
62
+ expect(response.status).to eq(204)
63
63
  end
64
64
 
65
65
  end
@@ -9,51 +9,51 @@ describe Octokit::Client::Objects do
9
9
 
10
10
  describe ".tree" do
11
11
 
12
- it "should return a tree" do
12
+ it "returns a tree" do
13
13
  stub_get("https://api.github.com/repos/sferik/rails_admin/git/trees/3cdfabd973bc3caac209cba903cfdb3bf6636bcd").
14
14
  to_return(:body => fixture("v3/tree.json"))
15
15
  result = @client.tree("sferik/rails_admin", "3cdfabd973bc3caac209cba903cfdb3bf6636bcd")
16
- result.sha.should == "3cdfabd973bc3caac209cba903cfdb3bf6636bcd"
17
- result.tree.first.path.should == ".gitignore"
16
+ expect(result.sha).to eq("3cdfabd973bc3caac209cba903cfdb3bf6636bcd")
17
+ expect(result.tree.first.path).to eq(".gitignore")
18
18
  end
19
19
 
20
20
  end
21
21
 
22
22
  describe ".create_tree" do
23
23
 
24
- it "should create a tree" do
24
+ it "creates a tree" do
25
25
  stub_post("/repos/octocat/Hello-World/git/trees").
26
26
  with(:body => { :tree => [ { :path => "file.rb", "mode" => "100644", "type" => "blob", "sha" => "44b4fc6d56897b048c772eb4087f854f46256132" } ] },
27
27
  :headers => { "Content-Type" => "application/json" }).
28
28
  to_return(:body => fixture("v3/tree_create.json"))
29
29
  response = @client.create_tree("octocat/Hello-World", [ { "path" => "file.rb", "mode" => "100644", "type" => "blob", "sha" => "44b4fc6d56897b048c772eb4087f854f46256132" } ])
30
- response.sha.should == "cd8274d15fa3ae2ab983129fb037999f264ba9a7"
31
- response.tree.size.should == 1
32
- response.tree.first.sha.should == "7c258a9869f33c1e1e1f74fbb32f07c86cb5a75b"
30
+ expect(response.sha).to eq("cd8274d15fa3ae2ab983129fb037999f264ba9a7")
31
+ expect(response.tree.size).to eq(1)
32
+ expect(response.tree.first.sha).to eq("7c258a9869f33c1e1e1f74fbb32f07c86cb5a75b")
33
33
  end
34
34
 
35
35
  end
36
36
 
37
37
  describe ".blob" do
38
38
 
39
- it "should return a blob" do
39
+ it "returns a blob" do
40
40
  stub_get("https://api.github.com/repos/sferik/rails_admin/git/blobs/94616fa57520ac8147522c7cf9f03d555595c5ea").
41
41
  to_return(:body => fixture("v3/blob.json"))
42
42
  blob = @client.blob("sferik/rails_admin", "94616fa57520ac8147522c7cf9f03d555595c5ea")
43
- blob.sha.should == "94616fa57520ac8147522c7cf9f03d555595c5ea"
43
+ expect(blob.sha).to eq("94616fa57520ac8147522c7cf9f03d555595c5ea")
44
44
  end
45
45
 
46
46
  end
47
47
 
48
48
  describe ".create_blob" do
49
49
 
50
- it "should create a blob" do
50
+ it "creates a blob" do
51
51
  stub_post("/repos/octocat/Hello-World/git/blobs").
52
52
  with(:body => { :content => "content", :encoding => "utf-8" },
53
53
  :headers => { "Content-Type" => "application/json" }).
54
54
  to_return(:body => fixture("v3/blob_create.json"))
55
55
  blob = @client.create_blob("octocat/Hello-World", "content")
56
- blob.should == "3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15"
56
+ expect(blob).to eq("3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15")
57
57
  end
58
58
 
59
59
  end
@@ -9,23 +9,23 @@ describe Octokit::Client::Organizations do
9
9
 
10
10
  describe ".organization" do
11
11
 
12
- it "should return an organization" do
12
+ it "returns an organization" do
13
13
  stub_get("https://api.github.com/orgs/codeforamerica").
14
14
  to_return(:body => fixture("v3/organization.json"))
15
15
  organization = @client.organization("codeforamerica")
16
- organization.name.should == "Code For America"
16
+ expect(organization.name).to eq("Code For America")
17
17
  end
18
18
 
19
19
  end
20
20
 
21
21
  describe ".update_organization" do
22
22
 
23
- it "should update an organization" do
23
+ it "updates an organization" do
24
24
  stub_patch("https://api.github.com/orgs/codeforamerica").
25
25
  with(:name => "Code For America").
26
26
  to_return(:body => fixture("v3/organization.json"))
27
27
  organization = @client.update_organization("codeforamerica", {:name => "Code For America"})
28
- organization.name.should == "Code For America"
28
+ expect(organization.name).to eq("Code For America")
29
29
  end
30
30
 
31
31
  end
@@ -34,22 +34,22 @@ describe Octokit::Client::Organizations do
34
34
 
35
35
  context "with a user passed" do
36
36
 
37
- it "should return all organizations for a user" do
37
+ it "returns all organizations for a user" do
38
38
  stub_get("https://api.github.com/users/sferik/orgs").
39
39
  to_return(:body => fixture("v3/organizations.json"))
40
40
  organizations = @client.organizations("sferik")
41
- organizations.first.login.should == "Hubcap"
41
+ expect(organizations.first.login).to eq("Hubcap")
42
42
  end
43
43
 
44
44
  end
45
45
 
46
46
  context "without user passed" do
47
47
 
48
- it "should return all organizations for a user" do
48
+ it "returns all organizations for a user" do
49
49
  stub_get("https://api.github.com/user/orgs").
50
50
  to_return(:body => fixture("v3/organizations.json"))
51
51
  organizations = @client.organizations
52
- organizations.first.login.should == "Hubcap"
52
+ expect(organizations.first.login).to eq("Hubcap")
53
53
  end
54
54
 
55
55
  end
@@ -58,79 +58,79 @@ describe Octokit::Client::Organizations do
58
58
 
59
59
  describe ".organization_repositories" do
60
60
 
61
- it "should return all public repositories for an organization" do
61
+ it "returns all public repositories for an organization" do
62
62
  stub_get("https://api.github.com/orgs/codeforamerica/repos").
63
63
  to_return(:body => fixture("v3/organization-repositories.json"))
64
64
  repositories = @client.organization_repositories("codeforamerica")
65
- repositories.first.name.should == "cfahelloworld"
65
+ expect(repositories.first.name).to eq("cfahelloworld")
66
66
  end
67
67
 
68
68
  end
69
69
 
70
70
  describe ".organization_members" do
71
71
 
72
- it "should return all public members of an organization" do
72
+ it "returns all public members of an organization" do
73
73
  stub_get("https://api.github.com/orgs/codeforamerica/members").
74
74
  to_return(:body => fixture("v3/organization_members.json"))
75
75
  users = @client.organization_members("codeforamerica")
76
- users.first.login.should == "akit"
76
+ expect(users.first.login).to eq("akit")
77
77
  end
78
78
 
79
79
  end
80
80
 
81
81
  describe ".organization_teams" do
82
82
 
83
- it "should return all teams for an organization" do
83
+ it "returns all teams for an organization" do
84
84
  stub_get("https://api.github.com/orgs/codeforamerica/teams").
85
85
  to_return(:body => fixture("v3/teams.json"))
86
86
  teams = @client.organization_teams("codeforamerica")
87
- teams.first.name.should == "Fellows"
87
+ expect(teams.first.name).to eq("Fellows")
88
88
  end
89
89
 
90
90
  end
91
91
 
92
92
  describe ".create_team" do
93
93
 
94
- it "should create a team" do
94
+ it "creates a team" do
95
95
  stub_post("https://api.github.com/orgs/codeforamerica/teams").
96
96
  with(:name => "Fellows").
97
97
  to_return(:body => fixture("v3/team.json"))
98
98
  team = @client.create_team("codeforamerica", {:name => "Fellows"})
99
- team.name.should == "Fellows"
99
+ expect(team.name).to eq("Fellows")
100
100
  end
101
101
 
102
102
  end
103
103
 
104
104
  describe ".team" do
105
105
 
106
- it "should return a team" do
106
+ it "returns a team" do
107
107
  stub_get("https://api.github.com/teams/32598").
108
108
  to_return(:body => fixture("v3/team.json"))
109
109
  team = @client.team(32598)
110
- team.name.should == "Fellows"
110
+ expect(team.name).to eq("Fellows")
111
111
  end
112
112
 
113
113
  end
114
114
 
115
115
  describe ".update_team" do
116
116
 
117
- it "should update a team" do
117
+ it "updates a team" do
118
118
  stub_patch("https://api.github.com/teams/32598").
119
119
  with(:name => "Fellows").
120
120
  to_return(:body => fixture("v3/team.json"))
121
121
  team = @client.update_team(32598, :name => "Fellows")
122
- team.name.should == "Fellows"
122
+ expect(team.name).to eq("Fellows")
123
123
  end
124
124
 
125
125
  end
126
126
 
127
127
  describe ".delete_team" do
128
128
 
129
- it "should delete a team" do
129
+ it "deletes a team" do
130
130
  stub_delete("https://api.github.com/teams/32598").
131
131
  to_return(:status => 204)
132
132
  result = @client.delete_team(32598)
133
- result.status.should == 204
133
+ expect(result.status).to eq(204)
134
134
  end
135
135
 
136
136
  end
@@ -138,102 +138,102 @@ describe Octokit::Client::Organizations do
138
138
 
139
139
  describe ".team_members" do
140
140
 
141
- it "should return team members" do
141
+ it "returns team members" do
142
142
  stub_get("https://api.github.com/teams/33239/members").
143
143
  to_return(:body => fixture("v3/organization_team_members.json"))
144
144
  users = @client.team_members(33239)
145
- users.first.login.should == "ctshryock"
145
+ expect(users.first.login).to eq("ctshryock")
146
146
  end
147
147
 
148
148
  end
149
149
 
150
150
  describe ".add_team_member" do
151
151
 
152
- it "should add a team member" do
152
+ it "adds a team member" do
153
153
  stub_put("https://api.github.com/teams/32598/members/sferik").
154
154
  with(:name => "sferik").
155
155
  to_return(:status => 204)
156
156
  result = @client.add_team_member(32598, "sferik")
157
- result.should be_true
157
+ expect(result).to be_true
158
158
  end
159
159
 
160
160
  end
161
161
 
162
162
  describe ".remove_team_member" do
163
163
 
164
- it "should remove a team member" do
164
+ it "removes a team member" do
165
165
  stub_delete("https://api.github.com/teams/32598/members/sferik").
166
166
  to_return(:status => 204)
167
167
  result = @client.remove_team_member(32598, "sferik")
168
- result.should be_true
168
+ expect(result).to be_true
169
169
  end
170
170
 
171
171
  end
172
172
 
173
173
  describe ".remove_organization_member" do
174
- it "should remove a member from an organization" do
174
+ it "removes a member from an organization" do
175
175
  stub_delete("https://api.github.com/orgs/codeforamerica/members/glow-mdsol").
176
176
  to_return(:status => 204)
177
177
  result = @client.remove_organization_member("codeforamerica", "glow-mdsol")
178
- result.should be_true
178
+ expect(result).to be_true
179
179
  end
180
180
 
181
181
  end
182
182
  describe ".team_repositories" do
183
183
 
184
- it "should return team repositories" do
184
+ it "returns team repositories" do
185
185
  stub_get("https://api.github.com/teams/33239/repos").
186
186
  to_return(:body => fixture("v3/organization_team_repos.json"))
187
187
  repositories = @client.team_repositories(33239)
188
- repositories.first.name.should == "GitTalk"
189
- repositories.first.owner.id.should == 570695
188
+ expect(repositories.first.name).to eq("GitTalk")
189
+ expect(repositories.first.owner.id).to eq(570695)
190
190
  end
191
191
 
192
192
  end
193
193
 
194
194
  describe ".add_team_repository" do
195
195
 
196
- it "should add a team repository" do
196
+ it "adds a team repository" do
197
197
  stub_put("https://api.github.com/teams/32598/repos/reddavis/One40Proof").
198
198
  with(:name => "reddavis/One40Proof").
199
199
  to_return(:status => 204)
200
200
  result = @client.add_team_repository(32598, "reddavis/One40Proof")
201
- result.should be_true
201
+ expect(result).to be_true
202
202
  end
203
203
 
204
204
  end
205
205
 
206
206
  describe ".remove_team_repository" do
207
207
 
208
- it "should remove a team repository" do
208
+ it "removes a team repository" do
209
209
  stub_delete("https://api.github.com/teams/32598/repos/reddavis/One40Proof").
210
210
  to_return(:status => 204)
211
211
  result = @client.remove_team_repository(32598, "reddavis/One40Proof")
212
- result.should be_true
212
+ expect(result).to be_true
213
213
  end
214
214
 
215
215
  end
216
216
 
217
217
  describe ".publicize_membership" do
218
218
 
219
- it "should pulicize membership" do
219
+ it "pulicizes membership" do
220
220
  stub_put("https://api.github.com/orgs/codeforamerica/public_members/sferik").
221
221
  with(:name => "sferik").
222
222
  to_return(:status => 204)
223
223
  result = @client.publicize_membership("codeforamerica", "sferik")
224
- result.should be_true
224
+ expect(result).to be_true
225
225
  end
226
226
 
227
227
  end
228
228
 
229
229
  describe ".unpublicize_membership" do
230
230
 
231
- it "should unpulicize membership" do
231
+ it "unpulicizes membership" do
232
232
  stub_delete("https://api.github.com/orgs/codeforamerica/public_members/sferik").
233
233
  with(:name => "sferik").
234
234
  to_return(:status => 204)
235
235
  result = @client.unpublicize_membership("codeforamerica", "sferik")
236
- result.should be_true
236
+ expect(result).to be_true
237
237
  end
238
238
 
239
239
  end
@@ -18,7 +18,7 @@ describe Octokit::Client::PubSubHubbub::ServiceHooks do
18
18
  with(subscribe_request_body).
19
19
  to_return(:body => nil)
20
20
 
21
- client.subscribe_service_hook("joshk/completeness-fu", "Travis", { :token => 'travistoken' }).should == true
21
+ expect(client.subscribe_service_hook("joshk/completeness-fu", "Travis", { :token => 'travistoken' })).to eq(true)
22
22
  assert_requested :post, "https://api.github.com/hub?access_token=myfaketoken", :body => subscribe_request_body, :times => 1
23
23
  end
24
24
  end
@@ -37,7 +37,7 @@ describe Octokit::Client::PubSubHubbub::ServiceHooks do
37
37
  with(unsubscribe_request_body).
38
38
  to_return(:body => nil)
39
39
 
40
- client.unsubscribe_service_hook("joshk/completeness-fu", "Travis").should == true
40
+ expect(client.unsubscribe_service_hook("joshk/completeness-fu", "Travis")).to eq(true)
41
41
  assert_requested :post, "https://api.github.com/hub?access_token=myfaketoken", :body => unsubscribe_request_body, :times => 1
42
42
  end
43
43
  end
@@ -14,7 +14,7 @@ describe Octokit::Client::PubSubHubbub do
14
14
  }).
15
15
  to_return(:body => nil)
16
16
 
17
- client.subscribe("https://github.com/joshk/completeness-fu/events/push", "github://Travis?token=travistoken").should == true
17
+ expect(client.subscribe("https://github.com/joshk/completeness-fu/events/push", "github://Travis?token=travistoken")).to eq(true)
18
18
  end
19
19
 
20
20
  it "raises an error if the topic is not recognized" do
@@ -26,9 +26,9 @@ describe Octokit::Client::PubSubHubbub do
26
26
  }).
27
27
  to_return(:status => 422)
28
28
 
29
- proc {
29
+ expect {
30
30
  client.subscribe("https://github.com/joshk/completeness-fud/events/push", "github://Travis?token=travistoken")
31
- }.should raise_exception
31
+ }.to raise_exception
32
32
  end
33
33
  end
34
34
 
@@ -42,7 +42,7 @@ describe Octokit::Client::PubSubHubbub do
42
42
  }).
43
43
  to_return(:body => nil)
44
44
 
45
- client.unsubscribe("https://github.com/joshk/completeness-fu/events/push", "github://Travis?token=travistoken").should == true
45
+ expect(client.unsubscribe("https://github.com/joshk/completeness-fu/events/push", "github://Travis?token=travistoken")).to eq(true)
46
46
  end
47
47
  end
48
48