Skip to content
This repository was archived by the owner on Mar 29, 2022. It is now read-only.

Commit 041137d

Browse files
committed
Rubocop fixes
1 parent 75a774a commit 041137d

File tree

2 files changed

+69
-70
lines changed

2 files changed

+69
-70
lines changed

spec/models/pull_request_spec.rb

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
expect(pr.labelled_invalid?).to eq(true)
1212
end
1313

14-
context "Pull request is merged" do
14+
context 'Pull request is merged' do
1515
let(:pr) { pr_helper(ELIGIBLE_INVALID_MERGED_PR) }
1616

1717
it 'is not considered labelled invalid' do
@@ -38,7 +38,7 @@
3838
end
3939

4040
describe '#spam_repo' do
41-
# TODO -- need to stub SpamRepositoryService
41+
# TODO: need to stub SpamRepositoryService
4242
# PR is in spam repo initially
4343
# PR is waiting, then becomes in spam repo
4444
# PR is eligible, then becomes in spam repo
@@ -62,7 +62,7 @@
6262

6363
context 'Pull request becomes labelled invalid' do
6464
before do
65-
stub_helper(pr, INVALID_LABEL_PR, { 'id' => pr.github_id })
65+
stub_helper(pr, INVALID_LABEL_PR, 'id' => pr.github_id)
6666
pr.check_state
6767
end
6868

@@ -94,7 +94,7 @@
9494

9595
context 'Pull request becomes labelled invalid' do
9696
before do
97-
stub_helper(pr, INVALID_LABEL_PR, { 'id' => pr.github_id })
97+
stub_helper(pr, INVALID_LABEL_PR, 'id' => pr.github_id)
9898
pr.check_state
9999
end
100100

@@ -106,7 +106,7 @@
106106
end
107107

108108
describe '#waiting' do
109-
context "Pull request is valid and created less than seven days ago" do
109+
context 'Pull request is valid and created less than seven days ago' do
110110
let(:pr) { pr_helper(IMMATURE_PR) }
111111

112112
it 'is put it in the waiting state' do
@@ -118,11 +118,11 @@
118118
end
119119
end
120120

121-
context "Pull request is in an invalid repo initially" do
122-
# TODO -- need to stub SpamRepositoryService
121+
context 'Pull request is in an invalid repo initially' do
122+
# TODO: need to stub SpamRepositoryService
123123
end
124124

125-
context "Pull request is labelled invalid initially" do
125+
context 'Pull request is labelled invalid initially' do
126126
let(:pr) { pr_helper(INVALID_LABEL_PR) }
127127

128128
it 'is in the invalid_label state initially' do
@@ -137,7 +137,7 @@
137137
before do
138138
freeze_time
139139

140-
stub_helper(pr, IMMATURE_PR, { 'id' => pr.github_id })
140+
stub_helper(pr, IMMATURE_PR, 'id' => pr.github_id)
141141
pr.check_state
142142
end
143143

@@ -154,7 +154,7 @@
154154
end
155155
end
156156

157-
context "Pull request is labelled invalid initially" do
157+
context 'Pull request is labelled invalid initially' do
158158
let(:pr) { pr_helper(INVALID_LABEL_PR) }
159159

160160
it 'is in the invalid_label state initially' do
@@ -169,8 +169,7 @@
169169
before do
170170
freeze_time
171171

172-
stub_helper(pr, IMMATURE_INVALID_MERGED_PR,
173-
{ 'id' => pr.github_id })
172+
stub_helper(pr, IMMATURE_INVALID_MERGED_PR, 'id' => pr.github_id)
174173
pr.check_state
175174
end
176175

@@ -189,15 +188,15 @@
189188
end
190189

191190
describe '#eligible' do
192-
context "Pull request is valid and created over seven days ago" do
191+
context 'Pull request is valid and created over seven days ago' do
193192
let(:pr) { pr_helper(ELIGIBLE_PR) }
194193

195194
it 'is put it in the eligible state' do
196195
expect(pr.state).to eq('eligible')
197196
end
198197
end
199198

200-
context "Pull request is valid and created less than seven days ago" do
199+
context 'Pull request is valid and created less than seven days ago' do
201200
let(:pr) { pr_helper(IMMATURE_PR) }
202201

203202
it 'is put it in the waiting state' do
@@ -208,7 +207,7 @@
208207
expect(pr.waiting_since).to eq(pr.created_at)
209208
end
210209

211-
context "Seven days pass from pull request creation" do
210+
context 'Seven days pass from pull request creation' do
212211
before do
213212
travel_to pr.waiting_since + 7.days
214213
pr.check_state
@@ -230,6 +229,6 @@ def pr_helper(hash)
230229

231230
def stub_helper(target, hash, merge = {})
232231
allow(target).to receive(:github_pull_request)
233-
.and_return(github_pull_request(hash.merge(merge)))
232+
.and_return(github_pull_request(hash.merge(merge)))
234233
end
235234
end

spec/support/pull_request_filter_helper.rb

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -87,59 +87,59 @@
8787
].freeze
8888

8989
INVALID_EMOJI_LABEL_PR = {
90-
'id' => 'MDExOlB1bGxSZXF1ZXN0NDc0Nzk5ODQ=',
91-
'title' => 'Results by cookie',
92-
'body' =>
90+
'id' => 'MDExOlB1bGxSZXF1ZXN0NDc0Nzk5ODQ=',
91+
'title' => 'Results by cookie',
92+
'body' =>
9393
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
9494
tempor incididunt ut labore et dolore magna aliqua. Ut enim.',
95-
'url' => 'https://github.com/peek/peek/pull/79',
96-
# This is valid, eligible
97-
'createdAt' => (Time.zone.parse(ENV['NOW_DATE']) - 8.days).to_s,
98-
# Invalid label should make it invalid
99-
'labels' => { 'edges' => [{ 'node': { 'name': '❌ Invalid' } }] },
100-
'repository' => { 'databaseId' => 123 }
95+
'url' => 'https://github.com/peek/peek/pull/79',
96+
# This is valid, eligible
97+
'createdAt' => (Time.zone.parse(ENV['NOW_DATE']) - 8.days).to_s,
98+
# Invalid label should make it invalid
99+
'labels' => { 'edges' => [{ 'node': { 'name': '❌ Invalid' } }] },
100+
'repository' => { 'databaseId' => 123 }
101101
}.freeze
102102

103103
INVALID_LABEL_PR = {
104-
'id' => 'MDExOlB1bGxSZXF1ZXN0OTA4ODAzMzQ=',
105-
'title' => 'Coercion type systems',
106-
'body' =>
104+
'id' => 'MDExOlB1bGxSZXF1ZXN0OTA4ODAzMzQ=',
105+
'title' => 'Coercion type systems',
106+
'body' =>
107107
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
108108
tempor incididunt ut labore et dolore magna aliqua. Ut enim.',
109-
'url' => 'https://github.com/intridea/hashie/pull/379',
110-
# This is valid, eligible
111-
'createdAt' => (Time.zone.parse(ENV['NOW_DATE']) - 11.days).to_s,
112-
# Invalid label should make it invalid
113-
'labels' => { 'edges' => [{ 'node': { 'name': 'Invalid' } }] },
114-
'repository' => { 'databaseId' => 123 }
109+
'url' => 'https://github.com/intridea/hashie/pull/379',
110+
# This is valid, eligible
111+
'createdAt' => (Time.zone.parse(ENV['NOW_DATE']) - 11.days).to_s,
112+
# Invalid label should make it invalid
113+
'labels' => { 'edges' => [{ 'node': { 'name': 'Invalid' } }] },
114+
'repository' => { 'databaseId' => 123 }
115115
}.freeze
116116

117117
ELIGIBLE_PR = {
118-
'id' => 'MDExOlB1bGxSZXF1ZXN0NTE0MTg4ODg=',
119-
'title' => 'Update README.md',
120-
'body' =>
118+
'id' => 'MDExOlB1bGxSZXF1ZXN0NTE0MTg4ODg=',
119+
'title' => 'Update README.md',
120+
'body' =>
121121
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
122122
tempor incididunt ut labore et dolore magna aliqua. Ut enim.',
123-
'url' => 'https://github.com/vulume/Cordova-DBCamera/pull/1',
124-
# This is valid, eligible
125-
'createdAt' => (Time.zone.parse(ENV['NOW_DATE']) - 9.days).to_s,
126-
'labels' => { 'edges' => [] },
127-
'repository' => { 'databaseId' => 123 }
123+
'url' => 'https://github.com/vulume/Cordova-DBCamera/pull/1',
124+
# This is valid, eligible
125+
'createdAt' => (Time.zone.parse(ENV['NOW_DATE']) - 9.days).to_s,
126+
'labels' => { 'edges' => [] },
127+
'repository' => { 'databaseId' => 123 }
128128
}.freeze
129129

130130
ELIGIBLE_INVALID_MERGED_PR = {
131-
'id' => 'MDExOlB1bGxSZXF1ZXN0NjkyNjE4Mjk=',
132-
'title' => 'Add natural layer',
133-
'body' =>
131+
'id' => 'MDExOlB1bGxSZXF1ZXN0NjkyNjE4Mjk=',
132+
'title' => 'Add natural layer',
133+
'body' =>
134134
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
135135
tempor incididunt ut labore et dolore magna aliqua. Ut enim.',
136-
'url' => 'https://github.com/syl20bnr/spacemacs/pull/6012',
137-
'createdAt' => (Time.zone.parse(ENV['NOW_DATE']) - 10.days).to_s,
138-
# Invalid label should make it invalid
139-
'labels' => { 'edges': [{ 'node': { 'name': 'Invalid' } }] },
140-
# Merged should override the invalid label and make it valid
141-
'merged' => true,
142-
'repository' => { 'databaseId' => 123 }
136+
'url' => 'https://github.com/syl20bnr/spacemacs/pull/6012',
137+
'createdAt' => (Time.zone.parse(ENV['NOW_DATE']) - 10.days).to_s,
138+
# Invalid label should make it invalid
139+
'labels' => { 'edges': [{ 'node': { 'name': 'Invalid' } }] },
140+
# Merged should override the invalid label and make it valid
141+
'merged' => true,
142+
'repository' => { 'databaseId' => 123 }
143143
}.freeze
144144

145145
# 5 pull requests with 3 valid dates & 2 invalid labels
@@ -254,35 +254,35 @@
254254
].freeze
255255

256256
IMMATURE_PR = {
257-
'id' => 'MDExOlB1bGxSZXF1ZXN0NDc0Nzk5ODQ=',
258-
'title' => 'Results by cookie',
259-
'body' =>
257+
'id' => 'MDExOlB1bGxSZXF1ZXN0NDc0Nzk5ODQ=',
258+
'title' => 'Results by cookie',
259+
'body' =>
260260
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
261261
tempor incididunt ut labore et dolore magna aliqua. Ut enim.',
262-
'url' => 'https://github.com/peek/peek/pull/79',
263-
'createdAt' => (Time.zone.parse(ENV['NOW_DATE']) - 2.days).to_s,
264-
'labels' => { 'edges' => [] },
265-
'repository' => { 'databaseId' => 123 }
262+
'url' => 'https://github.com/peek/peek/pull/79',
263+
'createdAt' => (Time.zone.parse(ENV['NOW_DATE']) - 2.days).to_s,
264+
'labels' => { 'edges' => [] },
265+
'repository' => { 'databaseId' => 123 }
266266
}.freeze
267267

268268
IMMATURE_INVALID_MERGED_PR = {
269-
'id' => 'MDExOlB1bGxSZXF1ZXN0NjkyNjE4Mjk=',
270-
'title' => 'Add natural layer',
271-
'body' =>
269+
'id' => 'MDExOlB1bGxSZXF1ZXN0NjkyNjE4Mjk=',
270+
'title' => 'Add natural layer',
271+
'body' =>
272272
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
273273
tempor incididunt ut labore et dolore magna aliqua. Ut enim.',
274-
'url' => 'https://github.com/syl20bnr/spacemacs/pull/6012',
275-
'createdAt' => (Time.zone.parse(ENV['NOW_DATE']) - 2.days).to_s,
276-
# Invalid label should make it invalid
277-
'labels' => { 'edges': [{ 'node': { 'name': 'Invalid' } }] },
278-
# Merged should override the invalid label and make it valid
279-
'merged' => true,
280-
'repository' => { 'databaseId' => 123 }
274+
'url' => 'https://github.com/syl20bnr/spacemacs/pull/6012',
275+
'createdAt' => (Time.zone.parse(ENV['NOW_DATE']) - 2.days).to_s,
276+
# Invalid label should make it invalid
277+
'labels' => { 'edges': [{ 'node': { 'name': 'Invalid' } }] },
278+
# Merged should override the invalid label and make it valid
279+
'merged' => true,
280+
'repository' => { 'databaseId' => 123 }
281281
}.freeze
282282

283283
# 4 pull requests with timestamps less than 7 days old, maturing
284284
IMMATURE_ARRAY = [
285-
IMMATURE_PR,
285+
IMMATURE_PR,
286286
{ 'id' => 'MDExOlB1bGxSZXF1ZXN0NTE0MTg4ODg=',
287287
'title' => 'Update README.md',
288288
'body' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do

0 commit comments

Comments
 (0)