Skip to content

Commit

Permalink
Change ruby code to conform with rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
ghoneycutt committed Dec 4, 2015
1 parent da45774 commit bd3009d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
18 changes: 9 additions & 9 deletions spec/classes/letsencrypt_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

describe 'letsencrypt' do
context 'on supported operating systems' do
let(:facts) {{ osfamily: 'Debian' }}
let(:facts) { { osfamily: 'Debian' } }
it { is_expected.to compile }

describe 'with defaults' do
Expand All @@ -20,39 +20,39 @@
end

describe 'with custom path' do
let(:params) {{ path: '/usr/lib/letsencrypt' }}
let(:params) { { path: '/usr/lib/letsencrypt' } }

it { is_expected.to contain_vcsrepo('/usr/lib/letsencrypt') }
it { is_expected.to contain_exec('initialize letsencrypt').with_command('/usr/lib/letsencrypt/letsencrypt-auto --agree-tos -h') }
end

describe 'with custom repo' do
let(:params) {{ repo: 'git://foo.com/letsencrypt.git' }}
let(:params) { { repo: 'git://foo.com/letsencrypt.git' } }
it { is_expected.to contain_vcsrepo('/opt/letsencrypt').with_source('git://foo.com/letsencrypt.git') }
end

describe 'with custom version' do
let(:params) {{ version: 'foo' }}
let(:params) { { version: 'foo' } }
it { is_expected.to contain_vcsrepo('/opt/letsencrypt').with_revision('foo') }
end

describe 'with custom config file' do
let(:params) {{ config_file: '/etc/letsencrypt/custom_config.ini' }}
let(:params) { { config_file: '/etc/letsencrypt/custom_config.ini' } }
it { is_expected.to contain_ini_setting('/etc/letsencrypt/custom_config.ini server https://acme-v01.api.letsencrypt.org/directory') }
end

describe 'with custom config' do
let(:params) {{ config: { 'foo' => 'bar' }}}
let(:params) { { config: { 'foo' => 'bar' } } }
it { is_expected.to contain_ini_setting('/etc/letsencrypt/cli.ini foo bar') }
end

describe 'with manage_config set to false' do
let(:params) {{ manage_config: false }}
let(:params) { { manage_config: false } }
it { is_expected.not_to contain_ini_setting('/etc/letsencrypt/cli.ini server https://acme-v01.api.letsencrypt.org/directory') }
end

describe 'with manage_dependencies set to false' do
let(:params) {{ manage_dependencies: false }}
let(:params) { { manage_dependencies: false } }
it 'should not contain the dependencies' do
is_expected.not_to contain_package('git')
is_expected.not_to contain_package('python')
Expand All @@ -61,7 +61,7 @@
end

context 'on supported operating systems' do
let(:facts) {{ osfamily: 'RedHat' }}
let(:facts) { { osfamily: 'RedHat' } }
it 'should fail' do
is_expected.to raise_error Puppet::Error, /supports Debian-based operating systems/
end
Expand Down
12 changes: 6 additions & 6 deletions spec/defines/letsencrypt_certonly_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
describe 'letsencrypt::certonly' do
let(:facts) {{ osfamily: 'Debian' }}
let(:facts) { { osfamily: 'Debian' } }
let(:pre_condition) { 'include letsencrypt' }

context 'with a single domain' do
Expand All @@ -11,31 +11,31 @@

context 'with multiple domains' do
let(:title) { 'foo' }
let(:params) {{ domains: ['foo.example.com', 'bar.example.com']}}
let(:params) { { domains: ['foo.example.com', 'bar.example.com'] } }
it { is_expected.to contain_exec('letsencrypt certonly foo').with_command '/opt/letsencrypt/letsencrypt-auto certonly --standalone -d foo.example.com -d bar.example.com' }
end

context 'with custom path' do
let(:title) { 'foo.example.com' }
let(:params) {{ letsencrypt_path: '/usr/lib/letsencrypt' }}
let(:params) { { letsencrypt_path: '/usr/lib/letsencrypt' } }
it { is_expected.to contain_exec('letsencrypt certonly foo.example.com').with_command '/usr/lib/letsencrypt/letsencrypt-auto certonly --standalone -d foo.example.com' }
end

context 'with custom plugin' do
let(:title) { 'foo.example.com' }
let(:params) {{ plugin: 'apache' }}
let(:params) { { plugin: 'apache' } }
it { is_expected.to contain_exec('letsencrypt certonly foo.example.com').with_command '/opt/letsencrypt/letsencrypt-auto certonly --apache -d foo.example.com' }
end

context 'with invalid plugin' do
let(:title) { 'foo.example.com' }
let(:params) {{ plugin: 'bad' }}
let(:params) { { plugin: 'bad' } }
it { is_expected.to raise_error Puppet::Error }
end

context 'when specifying additional arguments' do
let(:title) { 'foo.example.com' }
let(:params) {{ additional_args: ['--foo bar', '--baz quux'] }}
let(:params) { { additional_args: ['--foo bar', '--baz quux'] } }
it { is_expected.to contain_exec('letsencrypt certonly foo.example.com').with_command '/opt/letsencrypt/letsencrypt-auto certonly --standalone -d foo.example.com --foo bar --baz quux' }
end
end

0 comments on commit bd3009d

Please sign in to comment.