Skip to content

Commit 5b10f3e

Browse files
author
Ashley Penney
committed
Clean these up to be more readable.
1 parent 00a191f commit 5b10f3e

1 file changed

Lines changed: 18 additions & 22 deletions

File tree

spec/classes/mysql_server_account_security_spec.rb

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,25 @@
66
describe "on #{pe_version} #{pe_platform}" do
77
let(:facts) { facts.merge({:fqdn => 'myhost.mydomain', :hostname => 'myhost'}) }
88

9-
it 'should remove Mysql_User[root@myhost.mydomain]' do
10-
is_expected.to contain_mysql_user('root@myhost.mydomain').with_ensure('absent')
9+
[ 'root@myhost.mydomain',
10+
'root@127.0.0.1',
11+
'root@::1',
12+
'@myhost.mydomain',
13+
'@localhost',
14+
'@%',
15+
].each do |user|
16+
it 'removes Mysql_User[#{user}]' do
17+
is_expected.to contain_mysql_user(user).with_ensure('absent')
18+
end
1119
end
12-
it 'should remove Mysql_User[root@myhost]' do
13-
is_expected.to contain_mysql_user('root@myhost').with_ensure('absent')
14-
end
15-
it 'should remove Mysql_User[root@127.0.0.1]' do
16-
is_expected.to contain_mysql_user('root@127.0.0.1').with_ensure('absent')
17-
end
18-
it 'should remove Mysql_User[root@::1]' do
19-
is_expected.to contain_mysql_user('root@::1').with_ensure('absent')
20-
end
21-
it 'should remove Mysql_User[@myhost.mydomain]' do
22-
is_expected.to contain_mysql_user('@myhost.mydomain').with_ensure('absent')
23-
end
24-
it 'should remove Mysql_User[@myhost]' do
25-
is_expected.to contain_mysql_user('@myhost').with_ensure('absent')
26-
end
27-
it 'should remove Mysql_User[@localhost]' do
28-
is_expected.to contain_mysql_user('@localhost').with_ensure('absent')
29-
end
30-
it 'should remove Mysql_User[@%]' do
31-
is_expected.to contain_mysql_user('@%').with_ensure('absent')
20+
21+
# When the hostname doesn't match the fqdn we also remove these.
22+
# We don't need to test the inverse as when they match they are
23+
# covered by the above list.
24+
[ 'root@myhost', '@myhost' ].each do |user|
25+
it 'removes Mysql_User[#{user}]' do
26+
is_expected.to contain_mysql_user(user).with_ensure('absent')
27+
end
3228
end
3329

3430
it 'should remove Mysql_database[test]' do

0 commit comments

Comments
 (0)