Skip to content

Commit

Permalink
fix rubocop errors
Browse files Browse the repository at this point in the history
  • Loading branch information
saz committed Jan 7, 2017
1 parent a33452b commit b70c66d
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 39 deletions.
2 changes: 2 additions & 0 deletions .rubocop.yml
Expand Up @@ -504,3 +504,5 @@ RSpec/DescribeClass:
RSpec/ExampleLength:
Enabled: False

RSpec/NestedGroups:
MaxNesting: 5
4 changes: 2 additions & 2 deletions spec/classes/client_spec.rb
Expand Up @@ -13,7 +13,7 @@
}
end
it do
should contain_package('openssh-client').with(ensure: 'present')
is_expected.to contain_package('openssh-client').with(ensure: 'present')
end
end
context 'On Debian with custom ensure' do
Expand All @@ -33,7 +33,7 @@
}
end
it do
should contain_package('openssh-client').with(ensure: 'latest')
is_expected.to contain_package('openssh-client').with(ensure: 'latest')
end
end
end
10 changes: 5 additions & 5 deletions spec/classes/init_spec.rb
Expand Up @@ -20,13 +20,13 @@
}
end
it do
should contain_class('ssh::client')
is_expected.to contain_class('ssh::client')
end
it do
should contain_class('ssh::server')
is_expected.to contain_class('ssh::server')
end
it do
should contain_concat('/etc/ssh/sshd_config').with_validate_cmd(nil)
is_expected.to contain_concat('/etc/ssh/sshd_config').with_validate_cmd(nil)
end

context 'On Debian with the validate_sshd_file setting' do
Expand All @@ -53,10 +53,10 @@
}
end
it do
should contain_class('ssh::client')
is_expected.to contain_class('ssh::client')
end
it do
should contain_concat('/etc/ssh/sshd_config').with_validate_cmd('/usr/sbin/sshd -tf %')
is_expected.to contain_concat('/etc/ssh/sshd_config').with_validate_cmd('/usr/sbin/sshd -tf %')
end
end
end
Expand Down
22 changes: 11 additions & 11 deletions spec/classes/server_spec.rb
Expand Up @@ -36,7 +36,7 @@
end

it do
should contain_concat__fragment('global config').with(
is_expected.to contain_concat__fragment('global config').with(
target: '/etc/ssh/sshd_config',
content: '# File is managed by Puppet
Expand Down Expand Up @@ -91,21 +91,21 @@
end

describe "on supported osfamily: #{osfamily}" do
it { should contain_class('ssh::params') }
it { should contain_package('openssh-server').with_ensure(param_hash[:ensure]) }
it { is_expected.to contain_class('ssh::params') }
it { is_expected.to contain_package('openssh-server').with_ensure(param_hash[:ensure]) }

it do
should contain_service('ssh').with(
is_expected.to contain_service('ssh').with(
'ensure' => 'running',
'enable' => true,
'hasrestart' => true,
'hasstatus' => true
)
end

it { should contain_concat('/etc/ssh/sshd_config') }
it { is_expected.to contain_concat('/etc/ssh/sshd_config') }
it do
should contain_concat__fragment('global config').with(
is_expected.to contain_concat__fragment('global config').with(
target: '/etc/ssh/sshd_config',
content: '# File is managed by Puppet
Expand Down Expand Up @@ -140,26 +140,26 @@
}
end

it { should contain_class('ssh::params') }
it { is_expected.to contain_class('ssh::params') }
it do
should contain_package('openssh').with(
is_expected.to contain_package('openssh').with(
ensure: param_hash[:ensure],
name: 'openssh'
)
end

it do
should contain_service('sshd.service').with(
is_expected.to contain_service('sshd.service').with(
'ensure' => 'running',
'enable' => true,
'hasrestart' => true,
'hasstatus' => true
)
end

it { should contain_concat('/etc/ssh/sshd_config') }
it { is_expected.to contain_concat('/etc/ssh/sshd_config') }
it do
should contain_concat__fragment('global config').with(
is_expected.to contain_concat__fragment('global config').with(
target: '/etc/ssh/sshd_config',
content: '# File is managed by Puppet
Expand Down
34 changes: 17 additions & 17 deletions spec/defines/client/config/user_spec.rb
Expand Up @@ -41,7 +41,7 @@

it 'fails' do
expect do
should compile
is_expected.to compile
end.to raise_error(%r{#{value[1]}})
end
end
Expand All @@ -61,9 +61,9 @@
end

it do
should contain_file(target).with(ensure: 'file',
owner: title,
mode: '0600')
is_expected.to contain_file(target).with(ensure: 'file',
owner: title,
mode: '0600')
end
end # describe 'with a user provided target'

Expand All @@ -81,13 +81,13 @@
end

it 'contains ssh directory and ssh config' do
should contain_file("#{user_home_dir}/.ssh").with(ensure: 'directory',
owner: title,
mode: '0700').that_comes_before("File[#{user_home_dir}/.ssh/config]")
is_expected.to contain_file("#{user_home_dir}/.ssh").with(ensure: 'directory',
owner: title,
mode: '0700').that_comes_before("File[#{user_home_dir}/.ssh/config]")

should contain_file("#{user_home_dir}/.ssh/config").with(ensure: 'file',
owner: title,
mode: '0600')
is_expected.to contain_file("#{user_home_dir}/.ssh/config").with(ensure: 'file',
owner: title,
mode: '0600')
end
end # context 'with manage_user_ssh_dir default value'

Expand All @@ -100,15 +100,15 @@
end

it do
should_not contain_file("#{user_home_dir}/.ssh")
is_expected.not_to contain_file("#{user_home_dir}/.ssh")
end
end # context 'with manage_user_ssh_dir set to false'
end # context 'with a user provided user_home_dir'

context 'with no user provided user_home_dir' do
it 'with manage_user_ssh_dir default value' do
should contain_file("/home/#{title}/.ssh").that_comes_before("File[/home/#{title}/.ssh/config]")
should contain_file("/home/#{title}/.ssh/config")
is_expected.to contain_file("/home/#{title}/.ssh").that_comes_before("File[/home/#{title}/.ssh/config]")
is_expected.to contain_file("/home/#{title}/.ssh/config")
end

context 'with manage_user_ssh_dir set to false' do
Expand All @@ -119,11 +119,11 @@
end

it do
should_not contain_file("/home/#{title}/.ssh")
is_expected.not_to contain_file("/home/#{title}/.ssh")
end

it do
should contain_file("/home/#{title}/.ssh/config")
is_expected.to contain_file("/home/#{title}/.ssh/config")
end
end # context 'with manage_user_ssh_dir set to false'
end # context 'with no user provided user_home_dir'
Expand All @@ -137,11 +137,11 @@
end

it 'has single value' do
should contain_file("/home/#{title}/.ssh/config").with(content: %r{HashKnownHosts\s+yes})
is_expected.to contain_file("/home/#{title}/.ssh/config").with(content: %r{HashKnownHosts\s+yes})
end

it 'has Hash value' do
should contain_file("/home/#{title}/.ssh/config").with(content: %r{Host \*\.in2p3\.fr\s*\n\s+GSSAPIAuthentication\s+no\s*\n\s+User\s+riton})
is_expected.to contain_file("/home/#{title}/.ssh/config").with(content: %r{Host \*\.in2p3\.fr\s*\n\s+GSSAPIAuthentication\s+no\s*\n\s+User\s+riton})
end
end
end # describe 'with correct values'
Expand Down
8 changes: 4 additions & 4 deletions spec/defines/server/config/setting_spec.rb
Expand Up @@ -29,7 +29,7 @@
end

it do
should contain_concat__fragment('ssh_setting_something_AllowGroups').with_content(%r{\nAllowGroups group1 group2\n})
is_expected.to contain_concat__fragment('ssh_setting_something_AllowGroups').with_content(%r{\nAllowGroups group1 group2\n})
end
end

Expand All @@ -42,7 +42,7 @@
end

it do
should contain_concat__fragment('ssh_setting_something_Somesetting').with_content(%r{\nSomesetting yes\n})
is_expected.to contain_concat__fragment('ssh_setting_something_Somesetting').with_content(%r{\nSomesetting yes\n})
end
end

Expand All @@ -55,7 +55,7 @@
end

it do
should contain_concat__fragment('ssh_setting_something_Foo').with_content(%r{\nFoo 1 2\n})
is_expected.to contain_concat__fragment('ssh_setting_something_Foo').with_content(%r{\nFoo 1 2\n})
end
end

Expand All @@ -71,7 +71,7 @@

it 'fails' do
expect do
should compile
is_expected.to compile
end.to raise_error(%r{Hash values are not supported})
end
end
Expand Down

0 comments on commit b70c66d

Please sign in to comment.