Skip to content

Commit 3ee5a50

Browse files
committed
(maint) fix all spec rubocops
1 parent 33211ed commit 3ee5a50

15 files changed

+174
-209
lines changed

.rubocop.yml

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ AllCops:
1919
- "**/Puppetfile"
2020
- "**/Vagrantfile"
2121
- "**/Guardfile"
22-
inherit_from: ".rubocop_todo.yml"
2322
Layout/LineLength:
2423
Description: People have wide screens, use them.
2524
Max: 200

.rubocop_todo.yml

-25
This file was deleted.

.sync.yml

-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
---
2-
.rubocop.yml:
3-
include_todos: true
4-
5-
62
spec/spec_helper.rb:
73
spec_overrides:
84
- require 'spec_helper_local'

spec/classes/graceful_failures_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
end
1313

1414
it 'gracefully fails' do
15-
expect(subject).to compile.and_raise_error(%r{Unsupported platform:})
15+
is_expected.to compile.and_raise_error(%r{Unsupported platform:})
1616
end
1717
end
1818
end

spec/classes/mycnf_template_spec.rb

+13-13
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
let(:params) { { override_options: { 'mysqld' => { 'socket' => '/var/lib/mysql/mysql.sock' } } } }
1414

1515
it do
16-
expect(subject).to contain_file('mysql-config-file').with(mode: '0644',
16+
is_expected.to contain_file('mysql-config-file').with(mode: '0644',
1717
selinux_ignore_defaults: true).with_content(%r{socket = /var/lib/mysql/mysql.sock})
1818
end
1919
end
@@ -22,7 +22,7 @@
2222
let(:params) { { override_options: { 'mysqld' => { 'replicate-do-db' => ['base1', 'base2'] } } } }
2323

2424
it do
25-
expect(subject).to contain_file('mysql-config-file').with_content(
25+
is_expected.to contain_file('mysql-config-file').with_content(
2626
%r{.*replicate-do-db = base1\nreplicate-do-db = base2.*},
2727
)
2828
end
@@ -80,7 +80,7 @@
8080
let(:params) { { includedir: '/etc/my.cnf.d' } }
8181

8282
it 'makes the directory' do
83-
expect(subject).to contain_file('/etc/my.cnf.d').with(ensure: :directory,
83+
is_expected.to contain_file('/etc/my.cnf.d').with(ensure: :directory,
8484
mode: '0755')
8585
end
8686

@@ -91,7 +91,7 @@
9191
let(:params) { { includedir: '' } }
9292

9393
it 'shouldnt contain the directory' do
94-
expect(subject).not_to contain_file('mysql-config-file').with(ensure: :directory,
94+
is_expected.not_to contain_file('mysql-config-file').with(ensure: :directory,
9595
mode: '0755')
9696
end
9797

@@ -102,55 +102,55 @@
102102
let(:params) { { 'config_file_mode' => '0644' } }
103103

104104
it do
105-
expect(subject).to contain_file('mysql-config-file').with(mode: '0644')
105+
is_expected.to contain_file('mysql-config-file').with(mode: '0644')
106106
end
107107
end
108108

109109
context 'with file mode 0664' do
110110
let(:params) { { 'config_file_mode' => '0664' } }
111111

112112
it do
113-
expect(subject).to contain_file('mysql-config-file').with(mode: '0664')
113+
is_expected.to contain_file('mysql-config-file').with(mode: '0664')
114114
end
115115
end
116116

117117
context 'with file mode 0660' do
118118
let(:params) { { 'config_file_mode' => '0660' } }
119119

120120
it do
121-
expect(subject).to contain_file('mysql-config-file').with(mode: '0660')
121+
is_expected.to contain_file('mysql-config-file').with(mode: '0660')
122122
end
123123
end
124124

125125
context 'with file mode 0641' do
126126
let(:params) { { 'config_file_mode' => '0641' } }
127127

128128
it do
129-
expect(subject).to contain_file('mysql-config-file').with(mode: '0641')
129+
is_expected.to contain_file('mysql-config-file').with(mode: '0641')
130130
end
131131
end
132132

133133
context 'with file mode 0610' do
134134
let(:params) { { 'config_file_mode' => '0610' } }
135135

136136
it do
137-
expect(subject).to contain_file('mysql-config-file').with(mode: '0610')
137+
is_expected.to contain_file('mysql-config-file').with(mode: '0610')
138138
end
139139
end
140140

141141
context 'with file 0600' do
142142
let(:params) { { 'config_file_mode' => '0600' } }
143143

144144
it do
145-
expect(subject).to contain_file('mysql-config-file').with(mode: '0600')
145+
is_expected.to contain_file('mysql-config-file').with(mode: '0600')
146146
end
147147
end
148148

149149
context 'user owner 12345' do
150150
let(:params) { { 'mycnf_owner' => '12345' } }
151151

152152
it do
153-
expect(subject).to contain_file('mysql-config-file').with(
153+
is_expected.to contain_file('mysql-config-file').with(
154154
owner: '12345',
155155
)
156156
end
@@ -160,7 +160,7 @@
160160
let(:params) { { 'mycnf_group' => '12345' } }
161161

162162
it do
163-
expect(subject).to contain_file('mysql-config-file').with(
163+
is_expected.to contain_file('mysql-config-file').with(
164164
group: '12345',
165165
)
166166
end
@@ -170,7 +170,7 @@
170170
let(:params) { { 'mycnf_owner' => '12345', 'mycnf_group' => '12345' } }
171171

172172
it do
173-
expect(subject).to contain_file('mysql-config-file').with(
173+
is_expected.to contain_file('mysql-config-file').with(
174174
owner: '12345',
175175
group: '12345',
176176
)

spec/classes/mysql_backup_mysqldump_spec.rb

+6-6
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class { 'mysql::server': }
3030
end
3131

3232
it {
33-
expect(subject).to contain_cron('mysql-backup').with(
33+
is_expected.to contain_cron('mysql-backup').with(
3434
hour: 23,
3535
minute: 59,
3636
monthday: 30,
@@ -46,7 +46,7 @@ class { 'mysql::server': }
4646
it { is_expected.to contain_class('mysql::params') }
4747

4848
it {
49-
expect(subject).to contain_cron('mysql-backup').with(
49+
is_expected.to contain_cron('mysql-backup').with(
5050
command: '/usr/local/sbin/mysqlbackup.sh',
5151
ensure: 'present',
5252
hour: 23,
@@ -64,13 +64,13 @@ class { 'mysql::server': }
6464
end
6565

6666
it {
67-
expect(subject).to contain_file('mysqlbackup.sh').with_content(
67+
is_expected.to contain_file('mysqlbackup.sh').with_content(
6868
%r{(\| TEST -TEST)},
6969
)
70-
expect(subject).to contain_file('mysqlbackup.sh').with_content(
70+
is_expected.to contain_file('mysqlbackup.sh').with_content(
7171
%r{(\.TEST)},
7272
)
73-
expect(subject).not_to contain_package('bzip2')
73+
is_expected.not_to contain_package('bzip2')
7474
}
7575
end
7676

@@ -83,7 +83,7 @@ class { 'mysql::server': }
8383
end
8484

8585
it {
86-
expect(subject).to contain_file('mysqlbackup.sh').with_content(
86+
is_expected.to contain_file('mysqlbackup.sh').with_content(
8787
%r{information_schema},
8888
)
8989
}

spec/classes/mysql_backup_xtrabackup_spec.rb

+20-20
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ class { 'mysql::server': }
2828
it { is_expected.to contain_class('mysql::params') }
2929

3030
it 'does not contain the touch command' do
31-
expect(subject).to contain_file('xtrabackup.sh').without_content(
31+
is_expected.to contain_file('xtrabackup.sh').without_content(
3232
%r{(^\s+touch\s+$)},
3333
)
3434
end
3535

3636
it 'contains the wrapper script' do
37-
expect(subject).to contain_file('xtrabackup.sh').with_content(
37+
is_expected.to contain_file('xtrabackup.sh').with_content(
3838
%r{(\n*^xtrabackup\s+.*\$@)},
3939
)
4040
end
@@ -61,7 +61,7 @@ class { 'mysql::server': }
6161
end
6262

6363
it 'contains the weekly cronjob' do
64-
expect(subject).to contain_cron('xtrabackup-weekly')
64+
is_expected.to contain_cron('xtrabackup-weekly')
6565
.with(
6666
ensure: 'present',
6767
command: '/usr/local/sbin/xtrabackup.sh --target-dir=/tmp/$(date +\%F)_full --backup',
@@ -80,7 +80,7 @@ class { 'mysql::server': }
8080
else
8181
'$(date -d "last sunday" +\%F)_full'
8282
end
83-
expect(subject).to contain_cron('xtrabackup-daily')
83+
is_expected.to contain_cron('xtrabackup-daily')
8484
.with(
8585
ensure: 'present',
8686
command: "/usr/local/sbin/xtrabackup.sh --incremental-basedir=/tmp/#{dateformat} --target-dir=/tmp/$(date +\\%F_\\%H-\\%M-\\%S) --backup",
@@ -100,14 +100,14 @@ class { 'mysql::server': }
100100
end
101101

102102
it 'contains the defined mysql user' do
103-
expect(subject).to contain_mysql_user('backupuser@localhost')
103+
is_expected.to contain_mysql_user('backupuser@localhost')
104104
.with(
105105
ensure: 'present',
106106
password_hash: '*4110E08DF51E70A4BA1D4E33A84205E38CF3FE58',
107107
)
108108
.that_requires('Class[mysql::server::root_password]')
109109

110-
expect(subject).to contain_mysql_grant('backupuser@localhost/*.*')
110+
is_expected.to contain_mysql_grant('backupuser@localhost/*.*')
111111
.with(
112112
ensure: 'present',
113113
user: 'backupuser@localhost',
@@ -129,9 +129,9 @@ class { 'mysql::server': }
129129
end
130130

131131
it {
132-
expect(subject).not_to contain_mysql_grant('backupuser@localhost/performance_schema.keyring_component_status')
133-
expect(subject).not_to contain_mysql_grant('backupuser@localhost/performance_schema.log_status')
134-
expect(subject).not_to contain_mysql_grant('backupuser@localhost/*.*')
132+
is_expected.not_to contain_mysql_grant('backupuser@localhost/performance_schema.keyring_component_status')
133+
is_expected.not_to contain_mysql_grant('backupuser@localhost/performance_schema.log_status')
134+
is_expected.not_to contain_mysql_grant('backupuser@localhost/*.*')
135135
.with(
136136
ensure: 'present',
137137
user: 'backupuser@localhost',
@@ -150,7 +150,7 @@ class { 'mysql::server': }
150150
end
151151

152152
it {
153-
expect(subject).to contain_mysql_grant('backupuser@localhost/*.*')
153+
is_expected.to contain_mysql_grant('backupuser@localhost/*.*')
154154
.with(
155155
ensure: 'present',
156156
user: 'backupuser@localhost',
@@ -164,7 +164,7 @@ class { 'mysql::server': }
164164
end,
165165
)
166166
.that_requires('Mysql_user[backupuser@localhost]')
167-
expect(subject).to contain_mysql_grant('backupuser@localhost/performance_schema.keyring_component_status')
167+
is_expected.to contain_mysql_grant('backupuser@localhost/performance_schema.keyring_component_status')
168168
.with(
169169
ensure: 'present',
170170
user: 'backupuser@localhost',
@@ -174,7 +174,7 @@ class { 'mysql::server': }
174174
)
175175
.that_requires('Mysql_user[backupuser@localhost]')
176176

177-
expect(subject).to contain_mysql_grant('backupuser@localhost/performance_schema.log_status')
177+
is_expected.to contain_mysql_grant('backupuser@localhost/performance_schema.log_status')
178178
.with(
179179
ensure: 'present',
180180
user: 'backupuser@localhost',
@@ -221,7 +221,7 @@ class { 'mysql::server': }
221221
end
222222

223223
it 'contains the weekly cronjob' do
224-
expect(subject).to contain_cron('xtrabackup-weekly')
224+
is_expected.to contain_cron('xtrabackup-weekly')
225225
.with(
226226
ensure: 'present',
227227
command: '/usr/local/sbin/xtrabackup.sh --target-dir=/tmp/$(date +\%F)_full --backup --skip-ssl',
@@ -234,7 +234,7 @@ class { 'mysql::server': }
234234
end
235235

236236
it 'contains the daily cronjob for weekdays 1-6' do
237-
expect(subject).to contain_cron('xtrabackup-daily')
237+
is_expected.to contain_cron('xtrabackup-daily')
238238
.with(
239239
ensure: 'present',
240240
command: "/usr/local/sbin/xtrabackup.sh --incremental-basedir=/tmp/#{dateformat} --target-dir=/tmp/$(date +\\%F_\\%H-\\%M-\\%S) --backup --skip-ssl",
@@ -253,11 +253,11 @@ class { 'mysql::server': }
253253
end
254254

255255
it 'not contains the weekly cronjob' do
256-
expect(subject).not_to contain_cron('xtrabackup-weekly')
256+
is_expected.not_to contain_cron('xtrabackup-weekly')
257257
end
258258

259259
it 'contains the daily cronjob with all weekdays' do
260-
expect(subject).to contain_cron('xtrabackup-daily').with(
260+
is_expected.to contain_cron('xtrabackup-daily').with(
261261
ensure: 'present',
262262
command: '/usr/local/sbin/xtrabackup.sh --target-dir=/tmp/$(date +\%F_\%H-\%M-\%S) --backup',
263263
user: 'root',
@@ -275,7 +275,7 @@ class { 'mysql::server': }
275275
end
276276

277277
it 'contains the prescript' do
278-
expect(subject).to contain_file('xtrabackup.sh').with_content(
278+
is_expected.to contain_file('xtrabackup.sh').with_content(
279279
%r{.*rsync -a /tmp backup01.local-lan:\n\nrsync -a /tmp backup02.local-lan:.*},
280280
)
281281
end
@@ -288,7 +288,7 @@ class { 'mysql::server': }
288288
end
289289

290290
it 'contains the prostscript' do
291-
expect(subject).to contain_file('xtrabackup.sh').with_content(
291+
is_expected.to contain_file('xtrabackup.sh').with_content(
292292
%r{.*rsync -a /tmp backup01.local-lan:\n\nrsync -a /tmp backup02.local-lan:.*},
293293
)
294294
end
@@ -301,7 +301,7 @@ class { 'mysql::server': }
301301
end
302302

303303
it 'contain the mariabackup executor' do
304-
expect(subject).to contain_file('xtrabackup.sh').with_content(
304+
is_expected.to contain_file('xtrabackup.sh').with_content(
305305
%r{(\n*^mariabackup\s+.*\$@)},
306306
)
307307
end
@@ -313,7 +313,7 @@ class { 'mysql::server': }
313313
end
314314

315315
it 'contain the touch /tmp/backup_success command' do
316-
expect(subject).to contain_file('xtrabackup.sh').with_content(
316+
is_expected.to contain_file('xtrabackup.sh').with_content(
317317
%r{(^\s+touch /tmp/backup_success$)},
318318
)
319319
end

spec/classes/mysql_client_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
end
4545

4646
it do
47-
expect(subject).to contain_package('mysql_client').with(
47+
is_expected.to contain_package('mysql_client').with(
4848
provider: 'dpkg',
4949
source: '/somewhere',
5050
)

0 commit comments

Comments
 (0)