Skip to content

Commit 858bb6f

Browse files
author
jordanbreen28
committed
(CONT-792) - Correct RSpec/ImplicitSubject
1 parent a3aa06f commit 858bb6f

29 files changed

+218
-221
lines changed

.rubocop_todo.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,8 @@ RSpec/FilePath:
9696
- 'spec/defines/server/instance/service.rb'
9797
- 'spec/unit/puppet/type/postgresql_conn_validator.rb'
9898

99-
# Offense count: 183
100-
# This cop supports safe autocorrection (--autocorrect).
101-
# Configuration parameters: EnforcedStyle.
102-
# SupportedStyles: single_line_only, single_statement_only, disallow, require_implicit
103-
RSpec/ImplicitSubject:
99+
100+
RSpec/NamedSubject:
104101
Enabled: false
105102

106103
# Offense count: 2

spec/classes/client_spec.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,22 @@
1616
end
1717

1818
it 'modifies package' do
19-
is_expected.to contain_package('postgresql-client').with(ensure: 'absent',
20-
name: 'mypackage',
21-
tag: 'puppetlabs-postgresql')
19+
expect(subject).to contain_package('postgresql-client').with(ensure: 'absent',
20+
name: 'mypackage',
21+
tag: 'puppetlabs-postgresql')
2222
end
2323

2424
it 'has specified validate connexion' do
25-
is_expected.to contain_file('/opt/bin/my-validate-con.sh').with(ensure: 'file',
26-
owner: 0,
27-
group: 0,
28-
mode: '0755')
25+
expect(subject).to contain_file('/opt/bin/my-validate-con.sh').with(ensure: 'file',
26+
owner: 0,
27+
group: 0,
28+
mode: '0755')
2929
end
3030
end
3131

3232
describe 'with no parameters' do
3333
it 'creates package with postgresql tag' do
34-
is_expected.to contain_package('postgresql-client').with(tag: 'puppetlabs-postgresql')
34+
expect(subject).to contain_package('postgresql-client').with(tag: 'puppetlabs-postgresql')
3535
end
3636
end
3737

@@ -55,7 +55,7 @@ class { 'postgresql::globals':
5555
end
5656

5757
it 'does not manage postgresql-client package' do
58-
is_expected.not_to contain_package('postgresql-client')
58+
expect(subject).not_to contain_package('postgresql-client')
5959
end
6060
end
6161
end

spec/classes/globals_spec.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
describe 'with no parameters' do
1010
it 'executes successfully' do
11-
is_expected.to contain_class('postgresql::globals')
11+
expect(subject).to contain_class('postgresql::globals')
1212
end
1313
end
1414

@@ -20,7 +20,7 @@
2020
end
2121

2222
it 'pulls in class postgresql::repo' do
23-
is_expected.to contain_class('postgresql::repo')
23+
expect(subject).to contain_class('postgresql::repo')
2424
end
2525
end
2626
end
@@ -30,7 +30,7 @@
3030

3131
describe 'with no parameters' do
3232
it 'executes successfully' do
33-
is_expected.to contain_class('postgresql::globals')
33+
expect(subject).to contain_class('postgresql::globals')
3434
end
3535
end
3636

@@ -43,15 +43,15 @@
4343
end
4444

4545
it 'pulls in class postgresql::repo' do
46-
is_expected.to contain_class('postgresql::repo')
46+
expect(subject).to contain_class('postgresql::repo')
4747
end
4848

4949
it do
50-
is_expected.to contain_yumrepo('yum.postgresql.org').with(
50+
expect(subject).to contain_yumrepo('yum.postgresql.org').with(
5151
'enabled' => '1',
5252
'proxy' => 'http://proxy-server:8080',
5353
)
54-
is_expected.to contain_yumrepo('pgdg-common').with(
54+
expect(subject).to contain_yumrepo('pgdg-common').with(
5555
'enabled' => '1',
5656
'proxy' => 'http://proxy-server:8080',
5757
)
@@ -68,15 +68,15 @@
6868
end
6969

7070
it 'pulls in class postgresql::repo' do
71-
is_expected.to contain_class('postgresql::repo')
71+
expect(subject).to contain_class('postgresql::repo')
7272
end
7373

7474
it do
75-
is_expected.to contain_yumrepo('yum.postgresql.org').with(
75+
expect(subject).to contain_yumrepo('yum.postgresql.org').with(
7676
'enabled' => '1',
7777
'baseurl' => 'http://mirror.localrepo.com/pgdg-postgresql',
7878
)
79-
is_expected.to contain_yumrepo('pgdg-common').with(
79+
expect(subject).to contain_yumrepo('pgdg-common').with(
8080
'enabled' => '1',
8181
'baseurl' => 'http://mirror.localrepo.com/pgdg-common',
8282
)

spec/classes/lib/devel_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
describe 'link pg_config to /usr/bin' do
1111
it {
12-
is_expected.not_to contain_file('/usr/bin/pg_config') \
12+
expect(subject).not_to contain_file('/usr/bin/pg_config') \
1313
.with_ensure('link') \
1414
.with_target('/usr/lib/postgresql/13/bin/pg_config')
1515
}
@@ -38,7 +38,7 @@
3838
end
3939

4040
it {
41-
is_expected.to contain_file('/usr/bin/pg_config') \
41+
expect(subject).to contain_file('/usr/bin/pg_config') \
4242
.with_ensure('link') \
4343
.with_target('/usr/pgsql-9.3/bin/pg_config')
4444
}
@@ -53,7 +53,7 @@
5353
end
5454

5555
it 'fails to compile' do
56-
is_expected.to compile.and_raise_error(%r{is not supported})
56+
expect(subject).to compile.and_raise_error(%r{is not supported})
5757
end
5858
end
5959
end

spec/classes/lib/java_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
include_examples 'Debian 11'
88

99
it {
10-
is_expected.to contain_package('postgresql-jdbc').with(
10+
expect(subject).to contain_package('postgresql-jdbc').with(
1111
name: 'libpostgresql-jdbc-java',
1212
ensure: 'present',
1313
tag: 'puppetlabs-postgresql',
@@ -19,7 +19,7 @@
1919
include_examples 'RedHat 8'
2020

2121
it {
22-
is_expected.to contain_package('postgresql-jdbc').with(
22+
expect(subject).to contain_package('postgresql-jdbc').with(
2323
name: 'postgresql-jdbc',
2424
ensure: 'present',
2525
tag: 'puppetlabs-postgresql',
@@ -32,7 +32,7 @@
3232
end
3333

3434
it {
35-
is_expected.to contain_package('postgresql-jdbc').with(
35+
expect(subject).to contain_package('postgresql-jdbc').with(
3636
name: 'somepackage',
3737
ensure: 'latest',
3838
tag: 'puppetlabs-postgresql',

spec/classes/lib/perl_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
include_examples 'RedHat 8'
88

99
it {
10-
is_expected.to contain_package('perl-DBD-Pg').with(
10+
expect(subject).to contain_package('perl-DBD-Pg').with(
1111
name: 'perl-DBD-Pg',
1212
ensure: 'present',
1313
)
@@ -18,7 +18,7 @@
1818
include_examples 'Debian 11'
1919

2020
it {
21-
is_expected.to contain_package('perl-DBD-Pg').with(
21+
expect(subject).to contain_package('perl-DBD-Pg').with(
2222
name: 'libdbd-pg-perl',
2323
ensure: 'present',
2424
)

spec/classes/lib/pgdocs_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
include_examples 'RedHat 8'
88

99
it {
10-
is_expected.to contain_package('postgresql-docs').with(
10+
expect(subject).to contain_package('postgresql-docs').with(
1111
name: 'postgresql-docs',
1212
ensure: 'present',
1313
tag: 'puppetlabs-postgresql',
@@ -20,7 +20,7 @@
2020
end
2121

2222
it {
23-
is_expected.to contain_package('postgresql-docs').with(
23+
expect(subject).to contain_package('postgresql-docs').with(
2424
name: 'somepackage',
2525
ensure: 'latest',
2626
tag: 'puppetlabs-postgresql',

spec/classes/lib/python_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
include_examples 'RedHat 7'
88

99
it {
10-
is_expected.to contain_package('python-psycopg2').with(
10+
expect(subject).to contain_package('python-psycopg2').with(
1111
name: 'python-psycopg2',
1212
ensure: 'present',
1313
)
@@ -18,7 +18,7 @@
1818
include_examples 'RedHat 8'
1919

2020
it {
21-
is_expected.to contain_package('python-psycopg2').with(
21+
expect(subject).to contain_package('python-psycopg2').with(
2222
name: 'python3-psycopg2',
2323
ensure: 'present',
2424
)
@@ -29,7 +29,7 @@
2929
include_examples 'Debian 11'
3030

3131
it {
32-
is_expected.to contain_package('python-psycopg2').with(
32+
expect(subject).to contain_package('python-psycopg2').with(
3333
name: 'python-psycopg2',
3434
ensure: 'present',
3535
)

spec/classes/repo_spec.rb

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

88
describe 'with no parameters' do
99
it 'instantiates apt_postgresql_org class' do
10-
is_expected.to contain_class('postgresql::repo::apt_postgresql_org')
10+
expect(subject).to contain_class('postgresql::repo::apt_postgresql_org')
1111
end
1212
end
1313
end

0 commit comments

Comments
 (0)