Skip to content

Commit 76b40d3

Browse files
committed
(CONT-801) Correct RSpec/EmptyLineAfterExample
1 parent 303d7b0 commit 76b40d3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+161
-6
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,6 @@ RSpec/ContextWording:
140140
RSpec/DescribeClass:
141141
Enabled: false
142142

143-
# Offense count: 161
144-
# This cop supports safe autocorrection (--autocorrect).
145-
# Configuration parameters: AllowConsecutiveOneLiners.
146-
RSpec/EmptyLineAfterExample:
147-
Enabled: false
148-
149143
# Offense count: 25
150144
# This cop supports safe autocorrection (--autocorrect).
151145
RSpec/EmptyLineAfterExampleGroup:

spec/functions/base64_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,34 +27,42 @@
2727
is_expected.to run.with_params('encode', 'a very long string that will cause the base64 encoder to produce output with multiple lines')
2828
.and_return("YSB2ZXJ5IGxvbmcgc3RyaW5nIHRoYXQgd2lsbCBjYXVzZSB0aGUgYmFzZTY0\nIGVuY29kZXIgdG8gcHJvZHVjZSBvdXRwdXQgd2l0aCBtdWx0aXBsZSBsaW5l\ncw==\n")
2929
}
30+
3031
it {
3132
is_expected.to run.with_params('decode', "YSB2ZXJ5IGxvbmcgc3RyaW5nIHRoYXQgd2lsbCBjYXVzZSB0aGUgYmFzZTY0\nIGVuY29kZXIgdG8gcHJvZHVjZSBvdXRwdXQgd2l0aCBtdWx0aXBsZSBsaW5l\ncw==\n")
3233
.and_return('a very long string that will cause the base64 encoder to produce output with multiple lines')
3334
}
35+
3436
it {
3537
is_expected.to run.with_params('decode', 'YSB2ZXJ5IGxvbmcgc3RyaW5nIHRoYXQgd2lsbCBjYXVzZSB0aGUgYmFzZTY0IGVuY29kZXIgdG8gcHJvZHVjZSBvdXRwdXQgd2l0aCBtdWx0aXBsZSBsaW5lcw==')
3638
.and_return('a very long string that will cause the base64 encoder to produce output with multiple lines')
3739
}
40+
3841
it {
3942
is_expected.to run.with_params('encode', 'a very long string that will cause the base64 encoder to produce output with multiple lines', 'strict')
4043
.and_return('YSB2ZXJ5IGxvbmcgc3RyaW5nIHRoYXQgd2lsbCBjYXVzZSB0aGUgYmFzZTY0IGVuY29kZXIgdG8gcHJvZHVjZSBvdXRwdXQgd2l0aCBtdWx0aXBsZSBsaW5lcw==')
4144
}
45+
4246
it {
4347
is_expected.to run.with_params('decode', 'YSB2ZXJ5IGxvbmcgc3RyaW5nIHRoYXQgd2lsbCBjYXVzZSB0aGUgYmFzZTY0IGVuY29kZXIgdG8gcHJvZHVjZSBvdXRwdXQgd2l0aCBtdWx0aXBsZSBsaW5lcw==', 'strict')
4448
.and_return('a very long string that will cause the base64 encoder to produce output with multiple lines')
4549
}
50+
4651
it {
4752
is_expected.to run.with_params('encode', 'https://www.google.com.tw/?gws_rd=ssl#q=hello+world', 'urlsafe')
4853
.and_return('aHR0cHM6Ly93d3cuZ29vZ2xlLmNvbS50dy8_Z3dzX3JkPXNzbCNxPWhlbGxvK3dvcmxk')
4954
}
55+
5056
it {
5157
is_expected.to run.with_params('decode', 'aHR0cHM6Ly93d3cuZ29vZ2xlLmNvbS50dy8_Z3dzX3JkPXNzbCNxPWhlbGxvK3dvcmxk', 'urlsafe')
5258
.and_return('https://www.google.com.tw/?gws_rd=ssl#q=hello+world')
5359
}
60+
5461
it {
5562
is_expected.to run.with_params('encode', 'https://github.com/puppetlabs/puppetlabs-stdlib/pulls?utf8=%E2%9C%93&q=is%3Apr+is%3Aopen+Add', 'urlsafe')
5663
.and_return('aHR0cHM6Ly9naXRodWIuY29tL3B1cHBldGxhYnMvcHVwcGV0bGFicy1zdGRsaWIvcHVsbHM_dXRmOD0lRTIlOUMlOTMmcT1pcyUzQXByK2lzJTNBb3BlbitBZGQ=')
5764
}
65+
5866
it {
5967
is_expected.to run.with_params('decode', 'aHR0cHM6Ly9naXRodWIuY29tL3B1cHBldGxhYnMvcHVwcGV0bGFicy1zdGRsaWIvcHVsbHM_dXRmOD0lRTIlOUMlOTMmcT1pcyUzQXByK2lzJTNBb3BlbitBZGQ=', 'urlsafe')
6068
.and_return('https://github.com/puppetlabs/puppetlabs-stdlib/pulls?utf8=%E2%9C%93&q=is%3Apr+is%3Aopen+Add')

spec/functions/batch_escape_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
describe 'escaping' do
1919
it { is_expected.to run.with_params('foo').and_return('"foo"') }
2020
it { is_expected.to run.with_params('foo bar').and_return('"foo bar"') }
21+
2122
it {
2223
is_expected.to run.with_params('~`!@#$%^&*()_-=[]\{}|;\':",./<>?')
2324
.and_return('"~`!@#\\$%^&*()_-=[]\\\{}|;\':"",./<>?"')

spec/functions/bool2str_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
describe 'bool2str' do
66
it { is_expected.not_to eq(nil) }
77
it { is_expected.to run.with_params.and_raise_error(Puppet::ParseError) }
8+
89
['true', 'false', nil, :undef, ''].each do |invalid|
910
it { is_expected.to run.with_params(invalid).and_raise_error(Puppet::ParseError) }
1011
end

spec/functions/count_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77
it { is_expected.to run.with_params.and_raise_error(ArgumentError) }
88
it { is_expected.to run.with_params('one').and_raise_error(ArgumentError) }
99
it { is_expected.to run.with_params('one', 'two').and_return(1) }
10+
1011
it {
1112
pending('should actually be like this, and not like above')
1213
is_expected.to run.with_params('one', 'two').and_raise_error(ArgumentError)
1314
}
15+
1416
it { is_expected.to run.with_params('one', 'two', 'three').and_raise_error(ArgumentError) }
1517
it { is_expected.to run.with_params(['one', 'two', 'three']).and_return(3) }
1618
it { is_expected.to run.with_params(['one', 'two', 'two'], 'two').and_return(2) }

spec/functions/deep_merge_spec.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
.with_params({ 'key1' => 'value1', 'key2' => 'value2' }, 'key2' => 'replacement_value', 'key3' => 'value3') \
2121
.and_return('key1' => 'value1', 'key2' => 'replacement_value', 'key3' => 'value3')
2222
end
23+
2324
it {
2425
is_expected.to run \
2526
.with_params({ 'key1' => 'value1' }, { 'key1' => 'value2' }, 'key1' => 'value3') \
@@ -33,11 +34,13 @@
3334
.with_params({ 'key1' => 'value1' }, 'key2' => 'value2', 'key3' => { 'subkey1' => 'value4' }) \
3435
.and_return('key1' => 'value1', 'key2' => 'value2', 'key3' => { 'subkey1' => 'value4' })
3536
}
37+
3638
it {
3739
is_expected.to run \
3840
.with_params({ 'key1' => { 'subkey1' => 'value1' } }, 'key1' => { 'subkey2' => 'value2' }) \
3941
.and_return('key1' => { 'subkey1' => 'value1', 'subkey2' => 'value2' })
4042
}
43+
4144
it {
4245
is_expected.to run \
4346
.with_params({ 'key1' => { 'subkey1' => { 'subsubkey1' => 'value1' } } }, 'key1' => { 'subkey1' => { 'subsubkey1' => 'value2' } }) \

spec/functions/defined_with_params_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
it { is_expected.to run.with_params('Test::Deftype[foo]', {}).and_return(true) }
8989
it { is_expected.to run.with_params('Test::Deftype[bar]', {}).and_return(false) }
9090
it { is_expected.to run.with_params(Puppet::Resource.new('Test::Deftype[foo]'), {}).and_return(true) }
91+
9192
it {
9293
is_expected.to run.with_params(Puppet::Resource.new('Test::Deftype[bar]'), {}).and_return(false)
9394

spec/functions/delete_at_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
it { is_expected.to run.with_params('one', 1).and_raise_error(Puppet::ParseError, %r{Requires array}) }
99
it { is_expected.to run.with_params(1, 1).and_raise_error(Puppet::ParseError, %r{Requires array}) }
1010
it { is_expected.to run.with_params(['one'], 'two').and_raise_error(Puppet::ParseError, %r{You must provide non-negative numeric}) }
11+
1112
it {
1213
pending('Current implementation ignores parameters after the first two.')
1314
is_expected.to run.with_params(['one'], 0, 1).and_raise_error(Puppet::ParseError)

spec/functions/delete_regex_spec.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@
3030
it { is_expected.to run.with_params({}, '').and_return({}) }
3131
it { is_expected.to run.with_params({}, 'key').and_return({}) }
3232
it { is_expected.to run.with_params({ 'key' => 'value' }, 'key').and_return({}) }
33+
3334
it {
3435
is_expected.to run \
3536
.with_params({ 'key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3' }, 'key2') \
3637
.and_return('key1' => 'value1', 'key3' => 'value3')
3738
}
39+
3840
it {
3941
is_expected.to run \
4042
.with_params({ 'key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3' }, ['key1', 'key2']) \
@@ -48,6 +50,7 @@
4850
subject.execute(argument1, 'two')
4951
expect(argument1).to eq(original1)
5052
end
53+
5154
it 'leaves the original hash intact' do
5255
argument1 = { 'key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3' }
5356
original1 = argument1.dup

spec/functions/delete_spec.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,19 @@
4343
it { is_expected.to run.with_params({}, '').and_return({}) }
4444
it { is_expected.to run.with_params({}, 'key').and_return({}) }
4545
it { is_expected.to run.with_params({ 'key' => 'value' }, 'key').and_return({}) }
46+
4647
it {
4748
is_expected.to run \
4849
.with_params({ 'key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3' }, 'key2') \
4950
.and_return('key1' => 'value1', 'key3' => 'value3')
5051
}
52+
5153
it {
5254
is_expected.to run \
5355
.with_params({ 'key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3' }, ['key1', 'key2']) \
5456
.and_return('key3' => 'value3')
5557
}
58+
5659
it {
5760
is_expected.to run \
5861
.with_params({ 'ĸəұ1' => 'νãŀủĕ1', 'ĸəұ2' => 'νãŀủĕ2', 'ĸəұ3' => 'νãŀủĕ3' }, ['ĸəұ1', 'ĸəұ2']) \
@@ -66,12 +69,14 @@
6669
_result = subject.execute(argument1, 'two')
6770
expect(argument1).to eq(original1)
6871
end
72+
6973
it 'leaves the original string intact' do
7074
argument1 = 'onetwothree'
7175
original1 = argument1.dup
7276
_result = subject.execute(argument1, 'two')
7377
expect(argument1).to eq(original1)
7478
end
79+
7580
it 'leaves the original hash intact' do
7681
argument1 = { 'key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3' }
7782
original1 = argument1.dup

0 commit comments

Comments
 (0)