Skip to content

Commit 7ae3c58

Browse files
author
Craig Watson
committed
Spec: Fixing Rubocop offences
1 parent b653bbf commit 7ae3c58

8 files changed

+107
-119
lines changed

spec/classes/newrelic_infra_spec.rb

+18-21
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,34 @@
11
require 'spec_helper'
22

3-
describe 'newrelic::infra', :type => :class do
4-
3+
describe 'newrelic::infra', 'type' => 'class' do
54
let(:facts) do
6-
{
7-
'os' => {
8-
'family' => 'RedHat',
9-
'name' => 'CentOS',
10-
'release' => {
11-
'major' => '7'
12-
}
5+
{
6+
'os' => {
7+
'family' => 'RedHat',
8+
'name' => 'CentOS',
9+
'release' => {
10+
'major' => '7',
11+
},
12+
},
1313
}
14-
}
1514
end
1615

17-
1816
let(:params) do
19-
{
20-
:license_key => '1234567890qwerty',
21-
}
17+
{
18+
'license_key' => '1234567890qwerty',
19+
}
2220
end
2321

24-
2522
it { is_expected.to compile }
26-
it { should contain_package('newrelic-infra') }
27-
it { should contain_service('newrelic-infra').that_requires('Package[newrelic-infra]') }
28-
it { should contain_file('/etc/newrelic-infra.yml').with_content("license_key: 1234567890qwerty\n") }
23+
it { is_expected.to contain_package('newrelic-infra') }
24+
it { is_expected.to contain_service('newrelic-infra').that_requires('Package[newrelic-infra]') }
25+
it { is_expected.to contain_file('/etc/newrelic-infra.yml').with_content("license_key: 1234567890qwerty\n") }
2926

3027
context 'with manage_repo => true' do
31-
let(:params)do
32-
super().merge({ 'manage_repo' => true })
28+
let(:params) do
29+
super().merge('manage_repo' => true)
3330
end
3431

35-
it { should contain_class('newrelic::repo::infra') }
32+
it { is_expected.to contain_class('newrelic::repo::infra') }
3633
end
3734
end

spec/classes/newrelic_java_spec.rb

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
require 'spec_helper'
22

3-
describe 'newrelic::agent::java', :type => :class do
4-
let(:facts) do
3+
describe 'newrelic::agent::java', type: :class do
4+
let(:facts) do
55
{
66
'os' => {
77
'family' => 'RedHat',
88
'name' => 'CentOS',
99
'release' => {
10-
'major' => '7'
11-
}
10+
'major' => '7',
11+
},
1212
},
1313
'operatingsystem' => 'Centos',
14-
'path' => '/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/puppetlabs/bin:/opt/puppetlabs/puppet/bin:/root/.local/bin:/root/bin'
15-
}
14+
'path' => '/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/puppetlabs/bin:/opt/puppetlabs/puppet/bin:/root/.local/bin:/root/bin',
15+
}
1616
end
1717

1818
let(:params) do
1919
{
20-
:license_key => '1234567890qwerty',
21-
:manage_config => true
20+
license_key: '1234567890qwerty',
21+
manage_config: true,
2222
}
2323
end
2424

2525
it { is_expected.to compile }
26-
it { should contain_package('unzip') }
27-
it { should contain_exec('wget-newrelic-java-agent')}
28-
it { should contain_exec('chown-newrelic-install-dir')}
29-
it { should contain_exec('unzip-newrelic-java-agent-zip')}
30-
it { should contain_file('/opt/newrelic/newrelic.yml')}
26+
it { is_expected.to contain_package('unzip') }
27+
it { is_expected.to contain_exec('wget-newrelic-java-agent') }
28+
it { is_expected.to contain_exec('chown-newrelic-install-dir') }
29+
it { is_expected.to contain_exec('unzip-newrelic-java-agent-zip') }
30+
it { is_expected.to contain_file('/opt/newrelic/newrelic.yml') }
3131
end

spec/classes/newrelic_php_spec.rb

+19-19
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
11
require 'spec_helper'
22

3-
describe 'newrelic::agent::php', :type => :class do
4-
let(:facts) do
3+
describe 'newrelic::agent::php', type: :class do
4+
let(:facts) do
55
{
66
'os' => {
77
'family' => 'RedHat',
88
'name' => 'CentOS',
99
'release' => {
10-
'major' => '7'
11-
}
10+
'major' => '7',
11+
},
1212
},
1313
'operatingsystem' => 'Centos',
14-
'path' => '/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/puppetlabs/bin:/opt/puppetlabs/puppet/bin:/root/.local/bin:/root/bin'
15-
}
14+
'path' => '/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/puppetlabs/bin:/opt/puppetlabs/puppet/bin:/root/.local/bin:/root/bin',
15+
}
1616
end
1717

1818
let(:params) do
1919
{
20-
:license_key => '1234567890qwerty',
21-
:conf_dir => '/opt/rh/php54/root/etc/php.d',
20+
license_key: '1234567890qwerty',
21+
conf_dir: '/opt/rh/php54/root/etc/php.d',
2222
}
2323
end
2424

2525
it { is_expected.to compile }
26-
it { should contain_class('newrelic::params') }
27-
it { should contain_class('newrelic::repo::legacy') }
28-
it { should contain_package('newrelic-php5') }
29-
it { should contain_package('php-cli') }
30-
it { should contain_file('/etc/newrelic/newrelic.cfg') }
31-
it { should contain_file('/opt/rh/php54/root/etc/php.d/newrelic.ini') }
32-
it { should contain_exec('newrelic install') }
33-
it { should contain_exec('newrelic_kill') }
34-
26+
it { is_expected.to contain_class('newrelic::params') }
27+
it { is_expected.to contain_class('newrelic::repo::legacy') }
28+
it { is_expected.to contain_package('newrelic-php5') }
29+
it { is_expected.to contain_package('php-cli') }
30+
it { is_expected.to contain_file('/etc/newrelic/newrelic.cfg') }
31+
it { is_expected.to contain_file('/opt/rh/php54/root/etc/php.d/newrelic.ini') }
32+
it { is_expected.to contain_exec('newrelic install') }
33+
it { is_expected.to contain_exec('newrelic_kill') }
3534

3635
context 'startup_mode => external' do
3736
let(:params) do
38-
super().merge({ 'startup_mode' => 'external' })
37+
super().merge('startup_mode' => 'external')
3938
end
40-
it { should contain_service('newrelic-daemon') }
39+
40+
it { is_expected.to contain_service('newrelic-daemon') }
4141
end
4242
end
+16-19
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
require 'spec_helper'
22

3-
describe 'newrelic::repo::infra', :type => :class do
4-
3+
describe 'newrelic::repo::infra', type: :class do
54
context 'OS Family => RedHat' do
65
let(:facts) do
76
{
87
'os' => {
98
'family' => 'RedHat',
109
'name' => 'CentOS',
1110
'release' => {
12-
'major' => '7'
13-
}
14-
}
15-
}
16-
end
11+
'major' => '7',
12+
},
13+
},
14+
}
15+
end
1716

1817
it { is_expected.to compile }
19-
it { should contain_yumrepo('newrelic-infra') }
18+
it { is_expected.to contain_yumrepo('newrelic-infra') }
2019
end
2120

2221
context 'OS Family => Debian' do
@@ -25,19 +24,17 @@
2524
'lsbdistcodename' => 'wheezy',
2625
'osfamily' => 'Debian',
2726
'os' => {
28-
'family' => 'Debian',
29-
'name' => 'Debian',
30-
'release' => {
31-
'full' => '7.0'
32-
}
27+
'family' => 'Debian',
28+
'name' => 'Debian',
29+
'release' => {
30+
'full' => '7.0',
31+
},
3332
},
34-
}
35-
end
33+
}
34+
end
3635

3736
it { is_expected.to compile }
38-
it { should contain_apt__source('newrelic-infra') }
39-
it { should contain_package('apt-transport-https') }
37+
it { is_expected.to contain_apt__source('newrelic-infra') }
38+
it { is_expected.to contain_package('apt-transport-https') }
4039
end
41-
42-
4340
end
+14-16
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,39 @@
11
require 'spec_helper'
22

3-
describe 'newrelic::repo::legacy', :type => :class do
4-
3+
describe 'newrelic::repo::legacy', type: :class do
54
context 'OS Family => Redhat' do
65
let(:facts) do
76
{
87
'os' => {
98
'family' => 'RedHat',
109
'name' => 'CentOS',
1110
'release' => {
12-
'major' => '7'
13-
}
14-
}
11+
'major' => '7',
12+
},
13+
},
1514
}
1615
end
1716

1817
it { is_expected.to compile }
19-
it { should contain_package('newrelic-repo-5-3.noarch') }
18+
it { is_expected.to contain_package('newrelic-repo-5-3.noarch') }
2019
end
2120

2221
context 'OS Family => Debian' do
2322
let(:facts) do
2423
{
2524
'os' => {
26-
'family' => 'Debian',
27-
'name' => 'Debian',
28-
'release' => {
29-
'full' => '7.0'
30-
}
25+
'family' => 'Debian',
26+
'name' => 'Debian',
27+
'release' => {
28+
'full' => '7.0',
29+
},
3130
},
3231
'osfamily' => 'Debian',
33-
'lsbdistcodename' => 'wheezy'
34-
}
35-
end
32+
'lsbdistcodename' => 'wheezy',
33+
}
34+
end
3635

3736
it { is_expected.to compile }
38-
it { should contain_apt__source('newrelic') }
37+
it { is_expected.to contain_apt__source('newrelic') }
3938
end
40-
4139
end
+15-17
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,38 @@
11
require 'spec_helper'
22

3-
describe 'newrelic::server::linux', :type => :class do
3+
describe 'newrelic::server::linux', type: :class do
44
let(:facts) do
55
{
66
'path' => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/puppetlabs/bin:/snap/bin:/opt/puppetlabs/bin/',
77
'os' => {
88
'family' => 'RedHat',
99
'name' => 'CentOS',
1010
'release' => {
11-
'major' => '7'
12-
}
13-
}
14-
}
11+
'major' => '7',
12+
},
13+
},
14+
}
1515
end
1616

1717
let(:params) do
1818
{
19-
:license_key => '1234567890qwerty',
19+
license_key: '1234567890qwerty',
2020
}
2121
end
2222

2323
it { is_expected.to compile }
24-
it { should contain_class('newrelic::repo::legacy') }
25-
it { should contain_service('newrelic-sysmond') }
26-
it { should contain_package('newrelic-sysmond') }
27-
it { should contain_file('/var/log/newrelic') }
28-
it { should contain_file('/etc/newrelic/nrsysmond.cfg') }
29-
it { should contain_exec('install_newrelic_license_key') }
24+
it { is_expected.to contain_class('newrelic::repo::legacy') }
25+
it { is_expected.to contain_service('newrelic-sysmond') }
26+
it { is_expected.to contain_package('newrelic-sysmond') }
27+
it { is_expected.to contain_file('/var/log/newrelic') }
28+
it { is_expected.to contain_file('/etc/newrelic/nrsysmond.cfg') }
29+
it { is_expected.to contain_exec('install_newrelic_license_key') }
3030

3131
context 'with manage_repo => true' do
32-
let(:params)do
33-
super().merge({ 'manage_repo' => true })
32+
let(:params) do
33+
super().merge('manage_repo' => true)
3434
end
3535

36-
it { should contain_class('newrelic::repo::legacy') }
36+
it { is_expected.to contain_class('newrelic::repo::legacy') }
3737
end
38-
39-
4038
end

spec/classes/newrelic_spec.rb

+9-10
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
11
require 'spec_helper'
22

3-
describe 'newrelic', :type => :class do
3+
describe 'newrelic', type: :class do
44
let(:facts) do
55
{
66
'os' => {
77
'family' => 'RedHat',
88
'name' => 'CentOS',
99
'release' => {
10-
'major' => '7'
11-
}
12-
}
13-
}
10+
'major' => '7',
11+
},
12+
},
13+
}
1414
end
1515

1616
let(:params) do
17-
{
18-
:license_key => '1234567890qwerty',
19-
}
17+
{
18+
license_key: '1234567890qwerty',
19+
}
2020
end
2121

2222
it { is_expected.to compile }
23-
it { should contain_class('newrelic::params') }
24-
23+
it { is_expected.to contain_class('newrelic::params') }
2524
end

spec/defines/newrelic_ini.rb

+3-4
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
let(:title) { '/opt/rh/php54/root/etc/php.d' }
55

66
it { is_expected.to compile }
7-
it { should contain_defines__newrelic__php__newrelic_ini('/opt/rh/php54/root/etc/php.d') }
8-
it { should contain_exec('/usr/bin/newrelic-install /opt/rh/php54/root/etc/php.d') }
9-
it { should contain_file('/opt/rh/php54/root/etc/php.d/newrelic.ini') }
10-
7+
it { is_expected.to contain_defines__newrelic__php__newrelic_ini('/opt/rh/php54/root/etc/php.d') }
8+
it { is_expected.to contain_exec('/usr/bin/newrelic-install /opt/rh/php54/root/etc/php.d') }
9+
it { is_expected.to contain_file('/opt/rh/php54/root/etc/php.d/newrelic.ini') }
1110
end

0 commit comments

Comments
 (0)