From ebe04a0fe65b3b84fff02001b5f337d2fa2625ad Mon Sep 17 00:00:00 2001 From: Garrett Honeycutt Date: Thu, 17 Oct 2013 16:55:14 -0400 Subject: [PATCH] Refactor to condense lines in spec test for readability --- spec/classes/init_spec.rb | 48 ++++++++------------------------------- 1 file changed, 10 insertions(+), 38 deletions(-) diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 9e8ecd0..fc5d41d 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -31,9 +31,7 @@ describe 'ssh' do }) } - it { - should contain_file('ssh_config').with_content(/^# This file is being maintained by Puppet.\n# DO NOT EDIT\n\n# \$OpenBSD: ssh_config,v 1.21 2005\/12\/06 22:38:27 reyk Exp \$/) - } + it { should contain_file('ssh_config').with_content(/^# This file is being maintained by Puppet.\n# DO NOT EDIT\n\n# \$OpenBSD: ssh_config,v 1.21 2005\/12\/06 22:38:27 reyk Exp \$/) } it { should_not contain_file('ssh_config').with_content(/^\s*ForwardAgent$/) } it { should_not contain_file('ssh_config').with_content(/^\s*ForwardX11$/) } @@ -50,41 +48,14 @@ describe 'ssh' do }) } - it { - should contain_file('sshd_config').with_content(/^SyslogFacility AUTH$/) - } - - it { - should contain_file('sshd_config').with_content(/^LoginGraceTime 120$/) - } - - it { - should contain_file('sshd_config').with_content(/^PermitRootLogin no$/) - } - - it { - should contain_file('sshd_config').with_content(/^ChallengeResponseAuthentication no$/) - } - - it { - should contain_file('sshd_config').with_content(/^PrintMotd yes$/) - } - - it { - should contain_file('sshd_config').with_content(/^UseDNS yes$/) - } - - it { - should contain_file('sshd_config').with_content(/^Banner none$/) - } - - it { - should contain_file('sshd_config').with_content(/^XAuthLocation \/usr\/bin\/xauth$/) - } - - it { - should contain_file('sshd_config').with_content(/^Subsystem sftp \/usr\/libexec\/openssh\/sftp-server$/) - } + it { should contain_file('sshd_config').with_content(/^SyslogFacility AUTH$/) } + it { should contain_file('sshd_config').with_content(/^LoginGraceTime 120$/) } + it { should contain_file('sshd_config').with_content(/^PermitRootLogin no$/) } + it { should contain_file('sshd_config').with_content(/^ChallengeResponseAuthentication no$/) } + it { should contain_file('sshd_config').with_content(/^PrintMotd yes$/) } + it { should contain_file('sshd_config').with_content(/^UseDNS yes$/) } + it { should contain_file('sshd_config').with_content(/^XAuthLocation \/usr\/bin\/xauth$/) } + it { should contain_file('sshd_config').with_content(/^Subsystem sftp \/usr\/libexec\/openssh\/sftp-server$/) } it { should contain_service('sshd_service').with({ @@ -237,6 +208,7 @@ describe 'ssh' do 'user' => 'root', } } } } + it { should contain_ssh_authorized_key('root_for_userX').with({ 'ensure' => 'present',