Skip to content

Commit 773e26d

Browse files
committed
(CONT-801) Correct RSpec/ImplicitSubject
1 parent 0298868 commit 773e26d

Some content is hidden

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

58 files changed

+257
-264
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,6 @@ RSpec/FilePath:
153153
- 'spec/unit/puppet/provider/file_line/ruby_spec_alter.rb'
154154
- 'spec/unit/puppet/provider/file_line/ruby_spec_use_cases.rb'
155155

156-
# Offense count: 198
157-
# This cop supports safe autocorrection (--autocorrect).
158-
# Configuration parameters: EnforcedStyle.
159-
# SupportedStyles: single_line_only, single_statement_only, disallow, require_implicit
160-
RSpec/ImplicitSubject:
161-
Enabled: false
162-
163156
# Offense count: 2
164157
RSpec/LeakyConstantDeclaration:
165158
Exclude:

spec/functions/assert_private_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
expect(scope).to receive(:lookupvar).with('module_name').and_return('foo')
99
expect(scope).to receive(:lookupvar).with('caller_module_name').and_return('foo')
1010

11-
is_expected.to run.with_params
11+
expect(subject).to run.with_params
1212
end
1313
end
1414

@@ -19,11 +19,11 @@
1919
expect(scope.source).to receive(:name).and_return('foo::baz')
2020
expect(scope.source).to receive(:type).and_return('hostclass')
2121

22-
is_expected.to run.with_params.and_raise_error(Puppet::ParseError, %r{Class foo::baz is private})
22+
expect(subject).to run.with_params.and_raise_error(Puppet::ParseError, %r{Class foo::baz is private})
2323
end
2424

2525
it 'fails with an explicit failure message' do
26-
is_expected.to run.with_params('failure message!').and_raise_error(Puppet::ParseError, %r{failure message!})
26+
expect(subject).to run.with_params('failure message!').and_raise_error(Puppet::ParseError, %r{failure message!})
2727
end
2828
end
2929

@@ -34,7 +34,7 @@
3434
expect(scope.source).to receive(:name).and_return('foo::baz')
3535
expect(scope.source).to receive(:type).and_return('definition')
3636

37-
is_expected.to run.with_params.and_raise_error(Puppet::ParseError, %r{Definition foo::baz is private})
37+
expect(subject).to run.with_params.and_raise_error(Puppet::ParseError, %r{Definition foo::baz is private})
3838
end
3939
end
4040
end

spec/functions/base64_spec.rb

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,47 +24,47 @@
2424
it { is_expected.to run.with_params('decode', 'dGhlc3RyaW5n', 'strict').and_return('thestring') }
2525

2626
it {
27-
is_expected.to run.with_params('encode', 'a very long string that will cause the base64 encoder to produce output with multiple lines')
28-
.and_return("YSB2ZXJ5IGxvbmcgc3RyaW5nIHRoYXQgd2lsbCBjYXVzZSB0aGUgYmFzZTY0\nIGVuY29kZXIgdG8gcHJvZHVjZSBvdXRwdXQgd2l0aCBtdWx0aXBsZSBsaW5l\ncw==\n")
27+
expect(subject).to run.with_params('encode', 'a very long string that will cause the base64 encoder to produce output with multiple lines')
28+
.and_return("YSB2ZXJ5IGxvbmcgc3RyaW5nIHRoYXQgd2lsbCBjYXVzZSB0aGUgYmFzZTY0\nIGVuY29kZXIgdG8gcHJvZHVjZSBvdXRwdXQgd2l0aCBtdWx0aXBsZSBsaW5l\ncw==\n")
2929
}
3030

3131
it {
32-
is_expected.to run.with_params('decode', "YSB2ZXJ5IGxvbmcgc3RyaW5nIHRoYXQgd2lsbCBjYXVzZSB0aGUgYmFzZTY0\nIGVuY29kZXIgdG8gcHJvZHVjZSBvdXRwdXQgd2l0aCBtdWx0aXBsZSBsaW5l\ncw==\n")
33-
.and_return('a very long string that will cause the base64 encoder to produce output with multiple lines')
32+
expect(subject).to run.with_params('decode', "YSB2ZXJ5IGxvbmcgc3RyaW5nIHRoYXQgd2lsbCBjYXVzZSB0aGUgYmFzZTY0\nIGVuY29kZXIgdG8gcHJvZHVjZSBvdXRwdXQgd2l0aCBtdWx0aXBsZSBsaW5l\ncw==\n")
33+
.and_return('a very long string that will cause the base64 encoder to produce output with multiple lines')
3434
}
3535

3636
it {
37-
is_expected.to run.with_params('decode', 'YSB2ZXJ5IGxvbmcgc3RyaW5nIHRoYXQgd2lsbCBjYXVzZSB0aGUgYmFzZTY0IGVuY29kZXIgdG8gcHJvZHVjZSBvdXRwdXQgd2l0aCBtdWx0aXBsZSBsaW5lcw==')
38-
.and_return('a very long string that will cause the base64 encoder to produce output with multiple lines')
37+
expect(subject).to run.with_params('decode', 'YSB2ZXJ5IGxvbmcgc3RyaW5nIHRoYXQgd2lsbCBjYXVzZSB0aGUgYmFzZTY0IGVuY29kZXIgdG8gcHJvZHVjZSBvdXRwdXQgd2l0aCBtdWx0aXBsZSBsaW5lcw==')
38+
.and_return('a very long string that will cause the base64 encoder to produce output with multiple lines')
3939
}
4040

4141
it {
42-
is_expected.to run.with_params('encode', 'a very long string that will cause the base64 encoder to produce output with multiple lines', 'strict')
43-
.and_return('YSB2ZXJ5IGxvbmcgc3RyaW5nIHRoYXQgd2lsbCBjYXVzZSB0aGUgYmFzZTY0IGVuY29kZXIgdG8gcHJvZHVjZSBvdXRwdXQgd2l0aCBtdWx0aXBsZSBsaW5lcw==')
42+
expect(subject).to run.with_params('encode', 'a very long string that will cause the base64 encoder to produce output with multiple lines', 'strict')
43+
.and_return('YSB2ZXJ5IGxvbmcgc3RyaW5nIHRoYXQgd2lsbCBjYXVzZSB0aGUgYmFzZTY0IGVuY29kZXIgdG8gcHJvZHVjZSBvdXRwdXQgd2l0aCBtdWx0aXBsZSBsaW5lcw==')
4444
}
4545

4646
it {
47-
is_expected.to run.with_params('decode', 'YSB2ZXJ5IGxvbmcgc3RyaW5nIHRoYXQgd2lsbCBjYXVzZSB0aGUgYmFzZTY0IGVuY29kZXIgdG8gcHJvZHVjZSBvdXRwdXQgd2l0aCBtdWx0aXBsZSBsaW5lcw==', 'strict')
48-
.and_return('a very long string that will cause the base64 encoder to produce output with multiple lines')
47+
expect(subject).to run.with_params('decode', 'YSB2ZXJ5IGxvbmcgc3RyaW5nIHRoYXQgd2lsbCBjYXVzZSB0aGUgYmFzZTY0IGVuY29kZXIgdG8gcHJvZHVjZSBvdXRwdXQgd2l0aCBtdWx0aXBsZSBsaW5lcw==', 'strict')
48+
.and_return('a very long string that will cause the base64 encoder to produce output with multiple lines')
4949
}
5050

5151
it {
52-
is_expected.to run.with_params('encode', 'https://www.google.com.tw/?gws_rd=ssl#q=hello+world', 'urlsafe')
53-
.and_return('aHR0cHM6Ly93d3cuZ29vZ2xlLmNvbS50dy8_Z3dzX3JkPXNzbCNxPWhlbGxvK3dvcmxk')
52+
expect(subject).to run.with_params('encode', 'https://www.google.com.tw/?gws_rd=ssl#q=hello+world', 'urlsafe')
53+
.and_return('aHR0cHM6Ly93d3cuZ29vZ2xlLmNvbS50dy8_Z3dzX3JkPXNzbCNxPWhlbGxvK3dvcmxk')
5454
}
5555

5656
it {
57-
is_expected.to run.with_params('decode', 'aHR0cHM6Ly93d3cuZ29vZ2xlLmNvbS50dy8_Z3dzX3JkPXNzbCNxPWhlbGxvK3dvcmxk', 'urlsafe')
58-
.and_return('https://www.google.com.tw/?gws_rd=ssl#q=hello+world')
57+
expect(subject).to run.with_params('decode', 'aHR0cHM6Ly93d3cuZ29vZ2xlLmNvbS50dy8_Z3dzX3JkPXNzbCNxPWhlbGxvK3dvcmxk', 'urlsafe')
58+
.and_return('https://www.google.com.tw/?gws_rd=ssl#q=hello+world')
5959
}
6060

6161
it {
62-
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')
63-
.and_return('aHR0cHM6Ly9naXRodWIuY29tL3B1cHBldGxhYnMvcHVwcGV0bGFicy1zdGRsaWIvcHVsbHM_dXRmOD0lRTIlOUMlOTMmcT1pcyUzQXByK2lzJTNBb3BlbitBZGQ=')
62+
expect(subject).to run.with_params('encode', 'https://github.com/puppetlabs/puppetlabs-stdlib/pulls?utf8=%E2%9C%93&q=is%3Apr+is%3Aopen+Add', 'urlsafe')
63+
.and_return('aHR0cHM6Ly9naXRodWIuY29tL3B1cHBldGxhYnMvcHVwcGV0bGFicy1zdGRsaWIvcHVsbHM_dXRmOD0lRTIlOUMlOTMmcT1pcyUzQXByK2lzJTNBb3BlbitBZGQ=')
6464
}
6565

6666
it {
67-
is_expected.to run.with_params('decode', 'aHR0cHM6Ly9naXRodWIuY29tL3B1cHBldGxhYnMvcHVwcGV0bGFicy1zdGRsaWIvcHVsbHM_dXRmOD0lRTIlOUMlOTMmcT1pcyUzQXByK2lzJTNBb3BlbitBZGQ=', 'urlsafe')
68-
.and_return('https://github.com/puppetlabs/puppetlabs-stdlib/pulls?utf8=%E2%9C%93&q=is%3Apr+is%3Aopen+Add')
67+
expect(subject).to run.with_params('decode', 'aHR0cHM6Ly9naXRodWIuY29tL3B1cHBldGxhYnMvcHVwcGV0bGFicy1zdGRsaWIvcHVsbHM_dXRmOD0lRTIlOUMlOTMmcT1pcyUzQXByK2lzJTNBb3BlbitBZGQ=', 'urlsafe')
68+
.and_return('https://github.com/puppetlabs/puppetlabs-stdlib/pulls?utf8=%E2%9C%93&q=is%3Apr+is%3Aopen+Add')
6969
}
7070
end

spec/functions/batch_escape_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
it { is_expected.to run.with_params('foo bar').and_return('"foo bar"') }
2121

2222
it {
23-
is_expected.to run.with_params('~`!@#$%^&*()_-=[]\{}|;\':",./<>?')
24-
.and_return('"~`!@#\\$%^&*()_-=[]\\\{}|;\':"",./<>?"')
23+
expect(subject).to run.with_params('~`!@#$%^&*()_-=[]\{}|;\':",./<>?')
24+
.and_return('"~`!@#\\$%^&*()_-=[]\\\{}|;\':"",./<>?"')
2525
}
2626
end
2727
end

spec/functions/convert_base_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
it { is_expected.to run.with_params('1', 37).and_raise_error(Puppet::ParseError, %r{base must be at least 2 and must not be greater than 36}) }
1414

1515
it 'raises a ParseError if argument 1 is a string that does not correspond to an integer in base 10' do
16-
is_expected.to run.with_params('ten', 6).and_raise_error(Puppet::ParseError, %r{argument must be an integer or a string corresponding to an integer in base 10})
16+
expect(subject).to run.with_params('ten', 6).and_raise_error(Puppet::ParseError, %r{argument must be an integer or a string corresponding to an integer in base 10})
1717
end
1818

1919
it 'raises a ParseError if argument 2 is a string and does not correspond to an integer in base 10' do
20-
is_expected.to run.with_params(100, 'hex').and_raise_error(Puppet::ParseError, %r{argument must be an integer or a string corresponding to an integer in base 10})
20+
expect(subject).to run.with_params(100, 'hex').and_raise_error(Puppet::ParseError, %r{argument must be an integer or a string corresponding to an integer in base 10})
2121
end
2222

2323
it { is_expected.to run.with_params('11', '16').and_return('b') }

spec/functions/count_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
it {
1212
pending('should actually be like this, and not like above')
13-
is_expected.to run.with_params('one', 'two').and_raise_error(ArgumentError)
13+
expect(subject).to run.with_params('one', 'two').and_raise_error(ArgumentError)
1414
}
1515

1616
it { is_expected.to run.with_params('one', 'two', 'three').and_raise_error(ArgumentError) }

spec/functions/deep_merge_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,33 +16,33 @@
1616

1717
describe 'when arguments have key collisions' do
1818
it 'prefers values from the last hash' do
19-
is_expected.to run \
19+
expect(subject).to run \
2020
.with_params({ 'key1' => 'value1', 'key2' => 'value2' }, 'key2' => 'replacement_value', 'key3' => 'value3') \
2121
.and_return('key1' => 'value1', 'key2' => 'replacement_value', 'key3' => 'value3')
2222
end
2323

2424
it {
25-
is_expected.to run \
25+
expect(subject).to run \
2626
.with_params({ 'key1' => 'value1' }, { 'key1' => 'value2' }, 'key1' => 'value3') \
2727
.and_return('key1' => 'value3')
2828
}
2929
end
3030

3131
describe 'when arguments have subhashes' do
3232
it {
33-
is_expected.to run \
33+
expect(subject).to run \
3434
.with_params({ 'key1' => 'value1' }, 'key2' => 'value2', 'key3' => { 'subkey1' => 'value4' }) \
3535
.and_return('key1' => 'value1', 'key2' => 'value2', 'key3' => { 'subkey1' => 'value4' })
3636
}
3737

3838
it {
39-
is_expected.to run \
39+
expect(subject).to run \
4040
.with_params({ 'key1' => { 'subkey1' => 'value1' } }, 'key1' => { 'subkey2' => 'value2' }) \
4141
.and_return('key1' => { 'subkey1' => 'value1', 'subkey2' => 'value2' })
4242
}
4343

4444
it {
45-
is_expected.to run \
45+
expect(subject).to run \
4646
.with_params({ 'key1' => { 'subkey1' => { 'subsubkey1' => 'value1' } } }, 'key1' => { 'subkey1' => { 'subsubkey1' => 'value2' } }) \
4747
.and_return('key1' => { 'subkey1' => { 'subsubkey1' => 'value2' } })
4848
}

spec/functions/defined_with_params_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
it { is_expected.to run.with_params(Puppet::Resource.new('Test::Deftype[foo]'), {}).and_return(true) }
9393

9494
it {
95-
is_expected.to run.with_params(Puppet::Resource.new('Test::Deftype[bar]'), {}).and_return(false)
95+
expect(subject).to run.with_params(Puppet::Resource.new('Test::Deftype[bar]'), {}).and_return(false)
9696

9797
expect(catalogue.resource('Notify[Duplicate found somewhere]')).not_to be_nil
9898
expect(catalogue.resource('Notify[Should not find me]')).to be_nil

spec/functions/delete_at_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
it {
1313
pending('Current implementation ignores parameters after the first two.')
14-
is_expected.to run.with_params(['one'], 0, 1).and_raise_error(Puppet::ParseError)
14+
expect(subject).to run.with_params(['one'], 0, 1).and_raise_error(Puppet::ParseError)
1515
}
1616

1717
describe 'argument validation' do

spec/functions/delete_regex_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@
3232
it { is_expected.to run.with_params({ 'key' => 'value' }, 'key').and_return({}) }
3333

3434
it {
35-
is_expected.to run \
35+
expect(subject).to run \
3636
.with_params({ 'key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3' }, 'key2') \
3737
.and_return('key1' => 'value1', 'key3' => 'value3')
3838
}
3939

4040
it {
41-
is_expected.to run \
41+
expect(subject).to run \
4242
.with_params({ 'key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3' }, ['key1', 'key2']) \
4343
.and_return('key3' => 'value3')
4444
}

spec/functions/delete_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,19 @@
4545
it { is_expected.to run.with_params({ 'key' => 'value' }, 'key').and_return({}) }
4646

4747
it {
48-
is_expected.to run \
48+
expect(subject).to run \
4949
.with_params({ 'key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3' }, 'key2') \
5050
.and_return('key1' => 'value1', 'key3' => 'value3')
5151
}
5252

5353
it {
54-
is_expected.to run \
54+
expect(subject).to run \
5555
.with_params({ 'key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3' }, ['key1', 'key2']) \
5656
.and_return('key3' => 'value3')
5757
}
5858

5959
it {
60-
is_expected.to run \
60+
expect(subject).to run \
6161
.with_params({ 'ĸəұ1' => 'νãŀủĕ1', 'ĸəұ2' => 'νãŀủĕ2', 'ĸəұ3' => 'νãŀủĕ3' }, ['ĸəұ1', 'ĸəұ2']) \
6262
.and_return('ĸəұ3' => 'νãŀủĕ3')
6363
}

spec/functions/delete_undef_values_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
it { is_expected.to run.with_params('key' => undef_value).and_return({}) }
4848

4949
it {
50-
is_expected.to run \
50+
expect(subject).to run \
5151
.with_params('key1' => 'value1', 'undef_key' => undef_value, 'key2' => 'value2') \
5252
.and_return('key1' => 'value1', 'key2' => 'value2')
5353
}

spec/functions/delete_values_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,25 @@
1919
it { is_expected.to run.with_params({}, 'value').and_return({}) }
2020

2121
it {
22-
is_expected.to run \
22+
expect(subject).to run \
2323
.with_params({ 'key1' => 'value1' }, 'non-existing value') \
2424
.and_return('key1' => 'value1')
2525
}
2626

2727
it {
28-
is_expected.to run \
28+
expect(subject).to run \
2929
.with_params({ 'ҝếỵ1 ' => 'νâĺūẹ1', 'ҝếỵ2' => 'value to delete' }, 'value to delete') \
3030
.and_return('ҝếỵ1 ' => 'νâĺūẹ1')
3131
}
3232

3333
it {
34-
is_expected.to run \
34+
expect(subject).to run \
3535
.with_params({ 'key1' => 'value1', 'key2' => 'νǎŀữ℮ ťớ đêłểťė' }, 'νǎŀữ℮ ťớ đêłểťė') \
3636
.and_return('key1' => 'value1')
3737
}
3838

3939
it {
40-
is_expected.to run \
40+
expect(subject).to run \
4141
.with_params({ 'key1' => 'value1', 'key2' => 'value to delete', 'key3' => 'value to delete' }, 'value to delete') \
4242
.and_return('key1' => 'value1')
4343
}

spec/functions/deprecation_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
else
2525
expect(Puppet).to receive(:warning).with(include('heelo')).once
2626
end
27-
is_expected.to run.with_params('key', 'heelo')
27+
expect(subject).to run.with_params('key', 'heelo')
2828
end
2929

3030
it 'displays a single warning, despite multiple calls' do
@@ -35,23 +35,23 @@
3535
expect(Puppet).to receive(:warning).with(include('heelo')).once
3636
end
3737
(0..1).each do |_i|
38-
is_expected.to run.with_params('key', 'heelo')
38+
expect(subject).to run.with_params('key', 'heelo')
3939
end
4040
end
4141

4242
it 'fails twice with message, with multiple calls. when strict= :error' do
4343
Puppet.settings[:strict] = :error
4444
expect(Puppet).not_to receive(:warning).with(include('heelo'))
4545
(0..1).each do |_i|
46-
is_expected.to run.with_params('key', 'heelo').and_raise_error(RuntimeError, %r{deprecation. key. heelo})
46+
expect(subject).to run.with_params('key', 'heelo').and_raise_error(RuntimeError, %r{deprecation. key. heelo})
4747
end
4848
end
4949

5050
it 'displays nothing, despite multiple calls. strict= :off' do
5151
Puppet.settings[:strict] = :off
5252
expect(Puppet).not_to receive(:warning).with(include('heelo'))
5353
(0..1).each do |_i|
54-
is_expected.to run.with_params('key', 'heelo')
54+
expect(subject).to run.with_params('key', 'heelo')
5555
end
5656
end
5757
end
@@ -71,7 +71,7 @@
7171

7272
it 'displays a single warning' do
7373
expect(scope).to receive(:warning).with(include('heelo'))
74-
is_expected.to run.with_params('key', 'heelo')
74+
expect(subject).to run.with_params('key', 'heelo')
7575
end
7676
end
7777
end

spec/functions/dos2unix_spec.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,23 @@
77
it { is_expected.not_to eq(nil) }
88

99
it do
10-
is_expected.to run.with_params.and_raise_error(ArgumentError, %r{Wrong number of arguments})
10+
expect(subject).to run.with_params.and_raise_error(ArgumentError, %r{Wrong number of arguments})
1111
end
1212

1313
it do
14-
is_expected.to run.with_params('one', 'two').and_raise_error(ArgumentError, %r{Wrong number of arguments})
14+
expect(subject).to run.with_params('one', 'two').and_raise_error(ArgumentError, %r{Wrong number of arguments})
1515
end
1616

1717
it do
18-
is_expected.to run.with_params([]).and_raise_error(Puppet::ParseError, %r{Requires string as argument})
18+
expect(subject).to run.with_params([]).and_raise_error(Puppet::ParseError, %r{Requires string as argument})
1919
end
2020

2121
it do
22-
is_expected.to run.with_params({}).and_raise_error(Puppet::ParseError, %r{Requires string as argument})
22+
expect(subject).to run.with_params({}).and_raise_error(Puppet::ParseError, %r{Requires string as argument})
2323
end
2424

2525
it do
26-
is_expected.to run.with_params(1).and_raise_error(Puppet::ParseError, %r{Requires string as argument})
26+
expect(subject).to run.with_params(1).and_raise_error(Puppet::ParseError, %r{Requires string as argument})
2727
end
2828
end
2929

@@ -32,7 +32,7 @@
3232
desired_output = "Hello\nWorld\n"
3333

3434
it 'outputs unix format' do
35-
is_expected.to run.with_params(sample_text).and_return(desired_output)
35+
expect(subject).to run.with_params(sample_text).and_return(desired_output)
3636
end
3737
end
3838

@@ -44,11 +44,11 @@
4444
desired_output_doublebyte = "こんにちは\n世界\n"
4545

4646
it 'outputs uft8 string' do
47-
is_expected.to run.with_params(sample_text_utf8).and_return(desired_output_utf8)
47+
expect(subject).to run.with_params(sample_text_utf8).and_return(desired_output_utf8)
4848
end
4949

5050
it 'outputs double byte string' do
51-
is_expected.to run.with_params(sample_text_doublebyte).and_return(desired_output_doublebyte)
51+
expect(subject).to run.with_params(sample_text_doublebyte).and_return(desired_output_doublebyte)
5252
end
5353
end
5454
end

spec/functions/end_with_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
it { is_expected.to run.with_params('foobar', ['foo', 'baz']).and_return(false) }
1010

1111
it do
12-
is_expected.to run.with_params('foobar', '').and_raise_error(
12+
expect(subject).to run.with_params('foobar', '').and_raise_error(
1313
ArgumentError, %r{'stdlib::end_with' parameter 'suffixes' expects a value of type String\[1\] or Array\[String\[1\], 1\]}
1414
)
1515
end

0 commit comments

Comments
 (0)