octokit 1.17.0 → 1.17.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,38 +7,38 @@ describe Octokit::Client::Events do
7
7
  end
8
8
 
9
9
  describe ".public_events" do
10
- it "should return all public events" do
10
+ it "returns all public events" do
11
11
  stub_get("/events").
12
12
  to_return(:body => fixture("v3/public_events.json"))
13
13
  public_events = @client.public_events
14
- public_events.first.id.should == '1513284759'
14
+ expect(public_events.first.id).to eq('1513284759')
15
15
  end
16
16
  end
17
17
 
18
18
  describe ".user_events" do
19
- it "should return all user events" do
19
+ it "returns all user events" do
20
20
  stub_get("/users/sferik/events").
21
21
  to_return(:body => fixture("v3/user_events.json"))
22
22
  user_events = @client.user_events('sferik')
23
- user_events.first.id.should == '1525888969'
23
+ expect(user_events.first.id).to eq('1525888969')
24
24
  end
25
25
  end
26
26
 
27
27
  describe ".received_events" do
28
- it "should return all user received events" do
28
+ it "returns all user received events" do
29
29
  stub_get("/users/sferik/received_events").
30
30
  to_return(:body => fixture("v3/user_events.json"))
31
31
  received_events = @client.received_events('sferik')
32
- received_events.first.type.should == 'PushEvent'
32
+ expect(received_events.first.type).to eq('PushEvent')
33
33
  end
34
34
  end
35
35
 
36
36
  describe ".repository_events" do
37
- it "should return events for a repository" do
37
+ it "returns events for a repository" do
38
38
  stub_get("/repos/sferik/rails_admin/events").
39
39
  to_return(:body => fixture("v3/repo_events.json"))
40
40
  repo_events = @client.repository_events("sferik/rails_admin")
41
- repo_events.first.type.should == "IssuesEvent"
41
+ expect(repo_events.first.type).to eq("IssuesEvent")
42
42
  end
43
43
 
44
44
  end
@@ -9,50 +9,50 @@ describe Octokit::Client::Gists do
9
9
  end
10
10
 
11
11
  describe ".public_gists" do
12
- it "should return public gists" do
12
+ it "returns public gists" do
13
13
  stub_get("/gists/public").to_return(:body => fixture("v3/public_gists.json"))
14
14
  gists = @client.public_gists
15
- gists.should_not be_empty
15
+ expect(gists).not_to be_empty
16
16
  end
17
17
  end # .public_gists
18
18
 
19
19
  describe ".gists" do
20
20
  context "with username passed" do
21
- it "should return a list of gists" do
21
+ it "returns a list of gists" do
22
22
  stub_get("/users/#{@username}/gists").
23
23
  to_return(:body => fixture("v3/gists.json"))
24
24
  gists = @client.gists(@username)
25
- gists.first.user.login.should == @username
25
+ expect(gists.first.user.login).to eq(@username)
26
26
  end
27
27
  end
28
28
 
29
29
  context "without a username passed" do
30
- it "should return a list of gists" do
30
+ it "returns a list of gists" do
31
31
  stub_get("/gists").to_return(:body => fixture("v3/gists.json"))
32
32
  gists = @client.gists
33
- gists.first.user.login.should == @username
33
+ expect(gists.first.user.login).to eq(@username)
34
34
  end
35
35
  end
36
36
  end # .gists
37
37
 
38
38
  describe ".starred_gists" do
39
- it "should return the user's starred gists" do
39
+ it "returns the user's starred gists" do
40
40
  stub_get("/gists/starred").to_return(:body => fixture("v3/starred_gists.json"))
41
41
  gists = @client.starred_gists
42
- gists.should_not be_empty
42
+ expect(gists).not_to be_empty
43
43
  end
44
44
  end
45
45
 
46
46
  describe ".gist" do
47
- it "should return the gist by ID" do
47
+ it "returns the gist by ID" do
48
48
  stub_get("/gists/1").to_return(:body => fixture("v3/gist.json"))
49
49
  gist = @client.gist(1)
50
- gist.user.login.should == @username
50
+ expect(gist.user.login).to eq(@username)
51
51
  end
52
52
  end
53
53
 
54
54
  describe ".create_gist" do
55
- it "should create a new gist" do
55
+ it "creates a new gist" do
56
56
  gist_content = JSON.parse(fixture("v3/gist.json").read)
57
57
  new_gist = {
58
58
  :description => gist_content['description'],
@@ -64,12 +64,12 @@ describe Octokit::Client::Gists do
64
64
  to_return(:body => fixture("v3/gist.json"))
65
65
 
66
66
  gist = @client.create_gist(new_gist)
67
- gist.should == gist_content
67
+ expect(gist).to eq(gist_content)
68
68
  end
69
69
  end
70
70
 
71
71
  describe ".edit_gist" do
72
- it "should edit an existing gist" do
72
+ it "edit an existing gist" do
73
73
  gist_content = JSON.parse(fixture("v3/gist.json").read)
74
74
  gist_id = gist_content['id']
75
75
  updated_gist = gist_content.merge('description' => 'updated')
@@ -78,55 +78,55 @@ describe Octokit::Client::Gists do
78
78
  to_return(:body => updated_gist)
79
79
 
80
80
  gist = @client.edit_gist(gist_id, :description => 'updated')
81
- gist['description'].should == 'updated'
81
+ expect(gist['description']).to eq('updated')
82
82
  end
83
83
  end
84
84
 
85
85
  describe ".star_gist" do
86
- it "should star an existing gist" do
86
+ it "stars an existing gist" do
87
87
  stub_put("/gists/12345/star").to_return(:status => 204)
88
88
  success = @client.star_gist(12345)
89
- success.should be_true
89
+ expect(success).to be_true
90
90
  end
91
91
  end
92
92
 
93
93
  describe ".unstar_gist" do
94
- it "should unstar an existing gist" do
94
+ it "unstars an existing gist" do
95
95
  stub_delete("/gists/12345/star").to_return(:status => 204)
96
96
  success = @client.unstar_gist(12345)
97
- success.should be_true
97
+ expect(success).to be_true
98
98
  end
99
99
  end
100
100
 
101
101
  describe ".gist_starred?" do
102
- it "should be starred" do
102
+ it "is starred" do
103
103
  stub_get("/gists/12345/star").to_return(:status => 204)
104
104
  starred = @client.gist_starred?(12345)
105
- starred.should be_true
105
+ expect(starred).to be_true
106
106
  end
107
107
 
108
- it "should not be starred" do
108
+ it "is not starred" do
109
109
  stub_get("/gists/12345/star").to_return(:status => 404)
110
110
  starred = @client.gist_starred?(12345)
111
- starred.should be_false
111
+ expect(starred).to be_false
112
112
  end
113
113
  end
114
114
 
115
115
  describe ".fork_gist" do
116
- it "should fork an existing gist" do
116
+ it "forks an existing gist" do
117
117
  stub_post("/gists/12345/fork").
118
118
  to_return(:body => fixture("v3/gist.json"))
119
119
 
120
120
  gist = @client.fork_gist(12345)
121
- gist.user.login.should == @username
121
+ expect(gist.user.login).to eq(@username)
122
122
  end
123
123
  end
124
124
 
125
125
  describe ".delete_gist" do
126
- it "should delete an existing gist" do
126
+ it "deletes an existing gist" do
127
127
  stub_delete("/gists/12345").to_return(:status => 204)
128
128
  deleted = @client.delete_gist(12345)
129
- deleted.should be_true
129
+ expect(deleted).to be_true
130
130
  end
131
131
  end
132
132
 
@@ -9,20 +9,20 @@ describe Octokit::Client::Issues do
9
9
 
10
10
  describe ".issue_events" do
11
11
 
12
- it "should list events for an issue" do
12
+ it "lists events for an issue" do
13
13
  stub_get("/repos/pengwynn/octokit/issues/38/events").
14
14
  to_return(:body => fixture("v3/issue_events.json"))
15
15
  events = @client.issue_events("pengwynn/octokit", 38)
16
- events.first.event.should == "mentioned"
17
- events.last.actor.login.should == "ctshryock"
16
+ expect(events.first.event).to eq("mentioned")
17
+ expect(events.last.actor.login).to eq("ctshryock")
18
18
  end
19
19
 
20
- it "should get a single event" do
20
+ it "gets a single event" do
21
21
  stub_get("/repos/pengwynn/octokit/issues/events/3094334").
22
22
  to_return(:body => fixture("v3/issue_event.json"))
23
23
  events = @client.issue_event("pengwynn/octokit", 3094334)
24
- events.actor.login.should == "sferik"
25
- events.event.should == "closed"
24
+ expect(events.actor.login).to eq("sferik")
25
+ expect(events.event).to eq("closed")
26
26
  end
27
27
 
28
28
  end
@@ -9,153 +9,153 @@ describe Octokit::Client::Issues do
9
9
 
10
10
  describe ".search_issues" do
11
11
 
12
- it "should return matching issues" do
12
+ it "returns matching issues" do
13
13
  stub_get("https://api.github.com/legacy/issues/search/sferik/rails_admin/open/activerecord").
14
14
  to_return(:body => fixture("legacy/issues.json"))
15
15
  issues = @client.search_issues("sferik/rails_admin", "activerecord")
16
- issues.first.number.should == 105
16
+ expect(issues.first.number).to eq(105)
17
17
  end
18
18
 
19
19
  end
20
20
 
21
21
  describe ".list_issues" do
22
22
 
23
- it "should return issues for a repository" do
23
+ it "returns issues for a repository" do
24
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
- issues.first.number.should == 388
27
+ expect(issues.first.number).to eq(388)
28
28
  end
29
29
 
30
- it "should return issues for the authenticated user" do
30
+ it "returns issues for the authenticated user" do
31
31
  stub_get("/issues").
32
32
  to_return(:body => fixture("v3/issues.json"))
33
33
  issues = @client.issues
34
- issues.first.number.should == 388
34
+ expect(issues.first.number).to eq(388)
35
35
  end
36
36
 
37
37
  end
38
38
 
39
39
  describe ".create_issue" do
40
40
 
41
- it "should create an issue" do
41
+ it "creates an issue" do
42
42
  stub_post("/repos/ctshryock/octokit/issues").
43
43
  with(:body => {"title" => "Migrate issues to v3", "body" => "Move all Issues calls to v3 of the API"},
44
44
  :headers => {'Content-Type'=>'application/json'}).
45
45
  to_return(:body => fixture("v3/issue.json"))
46
46
  issue = @client.create_issue("ctshryock/octokit", "Migrate issues to v3", "Move all Issues calls to v3 of the API")
47
- issue.number.should == 12
47
+ expect(issue.number).to eq(12)
48
48
  end
49
49
 
50
50
  end
51
51
 
52
52
  describe ".issue" do
53
53
 
54
- it "should return an issue" do
54
+ it "returns an issue" do
55
55
  stub_get("/repos/ctshryock/octokit/issues/12").
56
56
  to_return(:body => fixture("v3/issue.json"))
57
57
  issue = @client.issue("ctshryock/octokit", 12)
58
- issue.number.should == 12
58
+ expect(issue.number).to eq(12)
59
59
  end
60
60
 
61
61
  end
62
62
 
63
63
  describe ".close_issue" do
64
64
 
65
- it "should close an issue" do
65
+ it "closes an issue" do
66
66
  stub_post("/repos/ctshryock/octokit/issues/12").
67
67
  with(:body => {"state" => "closed"},
68
68
  :headers => {'Content-Type'=>'application/json'}).
69
69
  to_return(:body => fixture("v3/issue_closed.json"))
70
70
  issue = @client.close_issue("ctshryock/octokit", 12)
71
- issue.number.should == 12
72
- issue.should include :closed_at
73
- issue.state.should == "closed"
71
+ expect(issue.number).to eq(12)
72
+ expect(issue).to include :closed_at
73
+ expect(issue.state).to eq("closed")
74
74
  end
75
75
 
76
76
  end
77
77
 
78
78
  describe ".reopen_issue" do
79
79
 
80
- it "should reopen an issue" do
80
+ it "reopens an issue" do
81
81
  stub_post("/repos/ctshryock/octokit/issues/12").
82
82
  with(:body => {"state" => "open"},
83
83
  :headers => {'Content-Type'=>'application/json'}).
84
84
  to_return(:body => fixture("v3/issue.json"))
85
85
  issue = @client.reopen_issue("ctshryock/octokit", 12)
86
- issue.number.should == 12
87
- issue.state.should == "open"
86
+ expect(issue.number).to eq(12)
87
+ expect(issue.state).to eq("open")
88
88
  end
89
89
 
90
90
  end
91
91
 
92
92
  describe ".update_issue" do
93
93
 
94
- it "should update an issue" do
94
+ it "updates an issue" do
95
95
  stub_post("/repos/ctshryock/octokit/issues/12").
96
96
  with(:body => {"title" => "Use all the v3 api!", "body" => ""},
97
97
  :headers => {'Content-Type'=>'application/json'}).
98
98
  to_return(:body => fixture("v3/issue.json"))
99
99
  issue = @client.update_issue("ctshryock/octokit", 12, "Use all the v3 api!", "")
100
- issue.number.should == 12
100
+ expect(issue.number).to eq(12)
101
101
  end
102
102
 
103
103
  end
104
104
 
105
105
  describe ".issue_comments" do
106
106
 
107
- it "should return comments for an issue" do
107
+ it "returns comments for an issue" do
108
108
  stub_get("/repos/pengwynn/octokit/issues/25/comments").
109
109
  to_return(:status => 200, :body => fixture('v3/comments.json'))
110
110
  comments = @client.issue_comments("pengwynn/octokit", 25)
111
- comments.first.user.login.should == "ctshryock"
111
+ expect(comments.first.user.login).to eq("ctshryock")
112
112
  end
113
113
 
114
114
  end
115
115
 
116
116
  describe ".issue_comment" do
117
117
 
118
- it "should return a single comment for an issue" do
118
+ it "returns a single comment for an issue" do
119
119
  stub_get("/repos/pengwynn/octokit/issues/comments/25").
120
120
  to_return(:status => 200, :body => fixture('v3/comment.json'))
121
121
  comments = @client.issue_comment("pengwynn/octokit", 25)
122
- comments.user.login.should == "ctshryock"
123
- comments.url.should == "https://api.github.com/repos/pengwynn/octokit/issues/comments/1194690"
122
+ expect(comments.user.login).to eq("ctshryock")
123
+ expect(comments.url).to eq("https://api.github.com/repos/pengwynn/octokit/issues/comments/1194690")
124
124
  end
125
125
 
126
126
  end
127
127
 
128
128
  describe ".add_comment" do
129
129
 
130
- it "should add a comment" do
130
+ it "adds a comment" do
131
131
  stub_post("/repos/pengwynn/octokit/issues/25/comments").
132
132
  with(:body => {"body" => "A test comment"}).
133
133
  to_return(:status => 201, :body => fixture('v3/comment.json'))
134
134
  comment = @client.add_comment("pengwynn/octokit", 25, "A test comment")
135
- comment.user.login.should == "ctshryock"
135
+ expect(comment.user.login).to eq("ctshryock")
136
136
  end
137
137
 
138
138
  end
139
139
 
140
140
  describe ".update_comment" do
141
141
 
142
- it "should update an existing comment" do
142
+ it "updates an existing comment" do
143
143
  stub_post("/repos/pengwynn/octokit/issues/comments/1194549").
144
144
  with(:body => {"body" => "A test comment update"}).
145
145
  to_return(:status => 200, :body => fixture('v3/comment.json'))
146
146
  comment = @client.update_comment("pengwynn/octokit", 1194549, "A test comment update")
147
- comment.user.login.should == "ctshryock"
147
+ expect(comment.user.login).to eq("ctshryock")
148
148
  end
149
149
 
150
150
  end
151
151
 
152
152
  describe ".delete_comment" do
153
153
 
154
- it "should delete an existing comment" do
154
+ it "deletes an existing comment" do
155
155
  stub_delete("/repos/pengwynn/octokit/issues/comments/1194549").
156
156
  to_return(:status => 204)
157
157
  comment = @client.delete_comment("pengwynn/octokit", 1194549)
158
- comment.status.should == 204
158
+ expect(comment.status).to eq(204)
159
159
  end
160
160
 
161
161
  end
@@ -9,143 +9,143 @@ describe Octokit::Client::Labels do
9
9
 
10
10
  describe ".labels" do
11
11
 
12
- it "should return labels" do
12
+ it "returns labels" do
13
13
  stub_get("/repos/pengwynn/octokit/labels").
14
14
  to_return(:body => fixture("v3/labels.json"))
15
15
  labels = @client.labels("pengwynn/octokit")
16
- labels.first.name.should == "V3 Transition"
16
+ expect(labels.first.name).to eq("V3 Transition")
17
17
  end
18
18
 
19
19
  end
20
20
 
21
21
  describe ".label" do
22
22
 
23
- it "should return a single labels" do
23
+ it "returns a single labels" do
24
24
  stub_get("/repos/pengwynn/octokit/labels/V3+Addition").
25
25
  to_return(:status => 200, :body => fixture('v3/label.json'))
26
26
  label = @client.label("pengwynn/octokit", "V3 Addition")
27
- label.name.should == "V3 Addition"
27
+ expect(label.name).to eq("V3 Addition")
28
28
  end
29
29
 
30
30
  end
31
31
 
32
32
  describe ".add_label" do
33
33
 
34
- it "should add a label with a color" do
34
+ it "adds a label with a color" do
35
35
  stub_post("/repos/pengwynn/octokit/labels").
36
36
  with(:body => {"name" => "a significant bug", "color" => "ededed"},
37
37
  :headers => {'Content-Type'=>'application/json'}).
38
38
  to_return(:status => 201, :body => fixture('v3/label.json'))
39
39
  labels = @client.add_label("pengwynn/octokit", "a significant bug", 'ededed')
40
- labels.color.should == "ededed"
41
- labels.name.should == "V3 Addition"
40
+ expect(labels.color).to eq("ededed")
41
+ expect(labels.name).to eq("V3 Addition")
42
42
  end
43
43
 
44
- it "should add a label with default color" do
44
+ it "adds a label with default color" do
45
45
  stub_post("/repos/pengwynn/octokit/labels").
46
46
  with(:body => {"name" => "another significant bug", "color" => "ffffff"},
47
47
  :headers => {'Content-Type'=>'application/json'}).
48
48
  to_return(:status => 201, :body => fixture('v3/label.json'))
49
49
  labels = @client.add_label("pengwynn/octokit", "another significant bug")
50
- labels.color.should == "ededed"
51
- labels.name.should == "V3 Addition"
50
+ expect(labels.color).to eq("ededed")
51
+ expect(labels.name).to eq("V3 Addition")
52
52
  end
53
53
 
54
54
  end
55
55
 
56
56
  describe ".update_label" do
57
57
 
58
- it "should update a label with a new color" do
58
+ it "updates a label with a new color" do
59
59
  stub_post("/repos/pengwynn/octokit/labels/V3+Addition").
60
60
  with(:body => {"color" => "ededed"},
61
61
  :headers => {'Content-Type'=>'application/json'}).
62
62
  to_return(:status => 200, :body => fixture('v3/label.json'))
63
63
 
64
64
  label = @client.update_label("pengwynn/octokit", "V3 Addition", {:color => 'ededed'})
65
- label.color.should == 'ededed'
65
+ expect(label.color).to eq('ededed')
66
66
  end
67
67
 
68
68
  end
69
69
 
70
70
  describe ".delete_label!" do
71
71
 
72
- it "should delete a label from the repository" do
72
+ it "deletes a label from the repository" do
73
73
  stub_delete("/repos/pengwynn/octokit/labels/V3+Transition").
74
74
  to_return(:status => 204)
75
75
 
76
76
  response = @client.delete_label!("pengwynn/octokit", "V3 Transition")
77
- response.status.should == 204
77
+ expect(response.status).to eq(204)
78
78
  end
79
79
 
80
80
  end
81
81
 
82
82
  describe ".remove_label" do
83
83
 
84
- it "should remove a label from the specified issue" do
84
+ it "removes a label from the specified issue" do
85
85
  stub_delete("/repos/pengwynn/octokit/issues/23/labels/V3+Transition").
86
86
  to_return(:status => 200, :body => fixture('v3/labels.json'), :headers => {})
87
87
 
88
88
  response = @client.remove_label("pengwynn/octokit", 23, "V3 Transition")
89
- response.last.name.should == 'Bug'
89
+ expect(response.last.name).to eq('Bug')
90
90
  end
91
91
 
92
92
  end
93
93
 
94
94
  describe ".remove_all_labels" do
95
95
 
96
- it "should remove all labels from the specified issue" do
96
+ it "removes all labels from the specified issue" do
97
97
  stub_delete("/repos/pengwynn/octokit/issues/23/labels").
98
98
  to_return(:status => 204)
99
99
 
100
100
  response = @client.remove_all_labels('pengwynn/octokit', 23)
101
- response.status.should == 204
101
+ expect(response.status).to eq(204)
102
102
  end
103
103
 
104
104
  end
105
105
 
106
106
  describe ".add_labels_to_an_issue" do
107
- it "should add labels to a given issue" do
107
+ it "adds labels to a given issue" do
108
108
  stub_post("/repos/pengwynn/octokit/issues/42/labels").
109
109
  with(:body => '["V3 Transition","Bug"]',
110
110
  :headers => {'Accept'=>'*/*', 'Content-Type'=>'application/json'}).
111
111
  to_return(:status => 200, :body => fixture('v3/labels.json'), :headers => {})
112
112
 
113
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'
114
+ expect(labels.first.name).to eq('V3 Transition')
115
+ expect(labels.last.name).to eq('Bug')
116
116
  end
117
117
  end
118
118
 
119
119
  describe ".replace_all_labels" do
120
- it "should replace all labels for an issue" do
120
+ it "replaces all labels for an issue" do
121
121
  stub_put("/repos/pengwynn/octokit/issues/42/labels").
122
122
  with(:body => '["V3 Transition","V3 Adding"]',
123
123
  :headers => {'Accept'=>'*/*', 'Content-Type'=>'application/json'}).
124
124
  to_return(:status => 200, :body => fixture('v3/labels.json'), :headers => {})
125
125
 
126
126
  labels = @client.replace_all_labels('pengwynn/octokit', 42, ['V3 Transition', 'V3 Adding'])
127
- labels.first.name.should == 'V3 Transition'
127
+ expect(labels.first.name).to eq('V3 Transition')
128
128
  end
129
129
  end
130
130
 
131
131
  describe ".lables_for_milestone" do
132
- it "should return all labels for a repository" do
132
+ it "returns all labels for a repository" do
133
133
  stub_get('/repos/pengwynn/octokit/milestones/2/labels').
134
134
  to_return(:status => 200, :body => fixture('v3/labels.json'), :headers => {})
135
135
 
136
136
  labels = @client.labels_for_milestone('pengwynn/octokit', 2)
137
- labels.size.should == 3
137
+ expect(labels.size).to eq(3)
138
138
  end
139
139
  end
140
140
 
141
141
  describe ".labels_for_issue" do
142
- it "should return all labels for a given issue" do
142
+ it "returns all labels for a given issue" do
143
143
  stub_get("/repos/pengwynn/octokit/issues/37/labels").
144
144
  to_return(:status => 200, :body => fixture('v3/labels.json'), :headers => {})
145
145
 
146
146
  labels = @client.labels_for_issue('pengwynn/octokit', 37)
147
- labels.first.name.should == 'V3 Transition'
148
- labels.last.name.should == 'Bug'
147
+ expect(labels.first.name).to eq('V3 Transition')
148
+ expect(labels.last.name).to eq('Bug')
149
149
  end
150
150
  end
151
151