Skip to content

Commit 78d1ae4

Browse files
authored
Merge pull request #1154 from tejasbubane/fix-failing-rubocop
Fix `InternalAffairs/ExampleDescription` offenses on master
2 parents 721fd6c + dd40ff8 commit 78d1ae4

9 files changed

+107
-114
lines changed

spec/rubocop/cop/rspec/align_left_let_brace_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@
4343
end
4444
# rubocop:enable RSpec/ExampleLength
4545

46-
it 'does not register offense for let with proc argument' do
46+
it 'does not register an offense for let with proc argument' do
4747
expect_no_offenses(<<-RUBY)
4848
let(:user, &args[:build_user])
4949
RUBY
5050
end
5151

52-
it 'works with empty file' do
52+
it 'does not register an offense with empty file' do
5353
expect_no_offenses('')
5454
end
5555
end

spec/rubocop/cop/rspec/align_right_let_brace_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@
4343
end
4444
# rubocop:enable RSpec/ExampleLength
4545

46-
it 'does not register offense for let with proc argument' do
46+
it 'does not register an offense for let with proc argument' do
4747
expect_no_offenses(<<-RUBY)
4848
let(:user, &args[:build_user])
4949
RUBY
5050
end
5151

52-
it 'works with empty file' do
52+
it 'does not register an offense with empty file' do
5353
expect_no_offenses('')
5454
end
5555
end

spec/rubocop/cop/rspec/empty_line_after_final_let_spec.rb

Lines changed: 29 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

33
RSpec.describe RuboCop::Cop::RSpec::EmptyLineAfterFinalLet do
4-
it 'checks for empty line after last let' do
4+
it 'registers an offense for empty line after last let' do
55
expect_offense(<<-RUBY)
66
RSpec.describe User do
77
let(:a) { a }
@@ -21,7 +21,7 @@
2121
RUBY
2222
end
2323

24-
it 'check for empty line after the last `let!`' do
24+
it 'registers an offense for empty line after the last `let!`' do
2525
expect_offense(<<-RUBY)
2626
RSpec.describe User do
2727
let(:a) { a }
@@ -45,7 +45,7 @@
4545
RUBY
4646
end
4747

48-
it 'checks for empty line after let with proc argument' do
48+
it 'registers an offense for empty line after let with proc argument' do
4949
expect_offense(<<-RUBY)
5050
RSpec.describe User do
5151
let(:a) { a }
@@ -65,30 +65,32 @@
6565
RUBY
6666
end
6767

68-
it 'approves empty line after let' do
68+
it 'does not register an offense for empty line after let' do
6969
expect_no_offenses(<<-RUBY)
70-
RSpec.describe User do
71-
let(:a) { a }
72-
let(:b) { b }
70+
RSpec.describe User do
71+
let(:a) { a }
72+
let(:b) { b }
7373
74-
it { expect(a).to eq(b) }
75-
end
74+
it { expect(a).to eq(b) }
75+
end
7676
RUBY
7777
end
7878

79-
it 'allows comment followed by an empty line after let' do
79+
it 'does not register an offense for comment '\
80+
'followed by an empty line after let' do
8081
expect_no_offenses(<<-RUBY)
81-
RSpec.describe User do
82-
let(:a) { a }
83-
let(:b) { b }
84-
# end of setup
82+
RSpec.describe User do
83+
let(:a) { a }
84+
let(:b) { b }
85+
# end of setup
8586
86-
it { expect(a).to eq(b) }
87-
end
87+
it { expect(a).to eq(b) }
88+
end
8889
RUBY
8990
end
9091

91-
it 'flags missing empty line after the comment that comes after last let' do
92+
it 'registers an offense for missing empty line after the comment '\
93+
'that comes after last let' do
9294
expect_offense(<<-RUBY)
9395
RSpec.describe User do
9496
let(:a) { a }
@@ -110,7 +112,8 @@
110112
RUBY
111113
end
112114

113-
it 'flags missing empty line after a multiline comment after last let' do
115+
it 'registers an offense for missing empty line after a multiline comment '\
116+
'after last let' do
114117
expect_offense(<<-RUBY)
115118
RSpec.describe User do
116119
let(:a) { a }
@@ -134,20 +137,8 @@
134137
RUBY
135138
end
136139

137-
it 'ignores empty lines between the lets' do
138-
expect_offense(<<-RUBY)
139-
RSpec.describe User do
140-
let(:a) { a }
141-
142-
subject { described_class }
143-
144-
let!(:b) { b }
145-
^^^^^^^^^^^^^^ Add an empty line after the last `let!`.
146-
it { expect(a).to eq(b) }
147-
end
148-
RUBY
149-
150-
expect_correction(<<-RUBY)
140+
it 'does not register an offense for empty lines between the lets' do
141+
expect_no_offenses(<<-RUBY)
151142
RSpec.describe User do
152143
let(:a) { a }
153144
@@ -160,7 +151,7 @@
160151
RUBY
161152
end
162153

163-
it 'handles let in tests' do
154+
it 'does not register an offense for let in tests' do
164155
expect_no_offenses(<<-RUBY)
165156
RSpec.describe User do
166157
# This shouldn't really ever happen in a sane codebase but I still
@@ -173,7 +164,7 @@
173164
RUBY
174165
end
175166

176-
it 'handles multiline let block' do
167+
it 'does not register an offense for multiline let block' do
177168
expect_no_offenses(<<-RUBY)
178169
RSpec.describe User do
179170
let(:a) { a }
@@ -186,7 +177,7 @@
186177
RUBY
187178
end
188179

189-
it 'handles let being the latest node' do
180+
it 'does not register an offense for let being the latest node' do
190181
expect_no_offenses(<<-RUBY)
191182
RSpec.describe User do
192183
let(:a) { a }
@@ -195,7 +186,7 @@
195186
RUBY
196187
end
197188

198-
it 'handles HEREDOC for let' do
189+
it 'does not register an offense for HEREDOC for let' do
199190
expect_no_offenses(<<-RUBY)
200191
RSpec.describe User do
201192
let(:foo) do
@@ -212,7 +203,7 @@
212203
RUBY
213204
end
214205

215-
it 'handles silly HEREDOC syntax for let' do
206+
it 'does not register an offense for silly HEREDOC syntax for let' do
216207
expect_no_offenses(<<-RUBY)
217208
RSpec.describe 'silly heredoc syntax' do
218209
let(:foo) { <<-BAR }
@@ -227,7 +218,7 @@
227218
RUBY
228219
end
229220

230-
it 'handles silly HEREDOC offense' do
221+
it 'registers an offense for silly HEREDOC offense' do
231222
expect_offense(<<-RUBY)
232223
RSpec.describe 'silly heredoc syntax' do
233224
let(:foo) { <<-BAR }

spec/rubocop/cop/rspec/empty_line_after_hook_spec.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

33
RSpec.describe RuboCop::Cop::RSpec::EmptyLineAfterHook do
4-
it 'checks for empty line after `before` hook' do
4+
it 'registers an offense for empty line after `before` hook' do
55
expect_offense(<<-RUBY)
66
RSpec.describe User do
77
before { do_something }
@@ -19,7 +19,7 @@
1919
RUBY
2020
end
2121

22-
it 'checks for empty line after `after` hook' do
22+
it 'registers an offense for empty line after `after` hook' do
2323
expect_offense(<<-RUBY)
2424
RSpec.describe User do
2525
after { do_something }
@@ -37,7 +37,7 @@
3737
RUBY
3838
end
3939

40-
it 'checks for empty line after `around` hook' do
40+
it 'registers an offense for empty line after `around` hook' do
4141
expect_offense(<<-RUBY)
4242
RSpec.describe User do
4343
around { |test| test.run }
@@ -55,7 +55,7 @@
5555
RUBY
5656
end
5757

58-
it 'approves empty line after `before` hook' do
58+
it 'does not register an offense for empty line after `before` hook' do
5959
expect_no_offenses(<<-RUBY)
6060
RSpec.describe User do
6161
before { do_something }
@@ -65,7 +65,7 @@
6565
RUBY
6666
end
6767

68-
it 'approves empty line after `after` hook' do
68+
it 'does not register an offense for empty line after `after` hook' do
6969
expect_no_offenses(<<-RUBY)
7070
RSpec.describe User do
7171
after { do_something }
@@ -75,7 +75,7 @@
7575
RUBY
7676
end
7777

78-
it 'approves empty line after `around` hook' do
78+
it 'does not register an offense for empty line after `around` hook' do
7979
expect_no_offenses(<<-RUBY)
8080
RSpec.describe User do
8181
around { |test| test.run }
@@ -85,7 +85,7 @@
8585
RUBY
8686
end
8787

88-
it 'handles multiline `before` block' do
88+
it 'does not register an offense for multiline `before` block' do
8989
expect_no_offenses(<<-RUBY)
9090
RSpec.describe User do
9191
before do
@@ -97,7 +97,7 @@
9797
RUBY
9898
end
9999

100-
it 'handles multiline `after` block' do
100+
it 'does not register an offense for multiline `after` block' do
101101
expect_no_offenses(<<-RUBY)
102102
RSpec.describe User do
103103
after do
@@ -109,7 +109,7 @@
109109
RUBY
110110
end
111111

112-
it 'handles multiline `around` block' do
112+
it 'does not register an offense for multiline `around` block' do
113113
expect_no_offenses(<<-RUBY)
114114
RSpec.describe User do
115115
around do |test|
@@ -121,7 +121,7 @@
121121
RUBY
122122
end
123123

124-
it 'handles `before` being the latest node' do
124+
it 'does not register an offense for `before` being the latest node' do
125125
expect_no_offenses(<<-RUBY)
126126
RSpec.describe User do
127127
before { do_something }

spec/rubocop/cop/rspec/empty_line_after_subject_spec.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

33
RSpec.describe RuboCop::Cop::RSpec::EmptyLineAfterSubject do
4-
it 'checks for empty line after subject' do
4+
it 'registers an offense for empty line after subject' do
55
expect_offense(<<-RUBY)
66
RSpec.describe User do
77
subject { described_class.new }
@@ -19,7 +19,7 @@
1919
RUBY
2020
end
2121

22-
it 'checks for empty line after subject!' do
22+
it 'registers an offense for empty line after subject!' do
2323
expect_offense(<<-RUBY)
2424
RSpec.describe User do
2525
subject! { described_class.new }
@@ -37,7 +37,7 @@
3737
RUBY
3838
end
3939

40-
it 'approves empty line after subject' do
40+
it 'does not register an offense for empty line after subject' do
4141
expect_no_offenses(<<-RUBY)
4242
RSpec.describe User do
4343
subject { described_class.new }
@@ -47,7 +47,7 @@
4747
RUBY
4848
end
4949

50-
it 'approves empty line after subject!' do
50+
it 'does not register an offense for empty line after subject!' do
5151
expect_no_offenses(<<-RUBY)
5252
RSpec.describe User do
5353
subject! { described_class.new }
@@ -57,7 +57,7 @@
5757
RUBY
5858
end
5959

60-
it 'handles subjects in tests' do
60+
it 'does not register an offense for subjects in tests' do
6161
expect_no_offenses(<<-RUBY)
6262
RSpec.describe User do
6363
# This shouldn't really ever happen in a sane codebase but I still
@@ -70,7 +70,7 @@
7070
RUBY
7171
end
7272

73-
it 'handles multiline subject block' do
73+
it 'does not register an offense for multiline subject block' do
7474
expect_no_offenses(<<-RUBY)
7575
RSpec.describe User do
7676
subject do
@@ -82,7 +82,7 @@
8282
RUBY
8383
end
8484

85-
it 'handles subject being the latest node' do
85+
it 'does not register an offense for subject being the latest node' do
8686
expect_no_offenses(<<-RUBY)
8787
RSpec.describe User do
8888
subject { described_user }

0 commit comments

Comments
 (0)