diff options
author | Melissa Stone <melissa@puppet.com> | 2018-04-13 15:10:47 -0700 |
---|---|---|
committer | Melissa Stone <melissa@puppet.com> | 2018-04-16 16:19:34 -0700 |
commit | 42416d957e7a96d156c532480018201e3c5ef487 (patch) | |
tree | 8d7248a2b59c7d5150c525cb82289fac977c3f97 /spec/unit | |
parent | 88cd8802c5841b619baa3df2313f7b1fdf68308f (diff) | |
download | puppet-mailalias_core-42416d957e7a96d156c532480018201e3c5ef487.tar.gz puppet-mailalias_core-42416d957e7a96d156c532480018201e3c5ef487.tar.bz2 |
Fix rubocop violations
Diffstat (limited to 'spec/unit')
-rwxr-xr-x[-rw-r--r--] | spec/unit/type/mailalias_spec.rb | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/spec/unit/type/mailalias_spec.rb b/spec/unit/type/mailalias_spec.rb index eb701c6..2a079ba 100644..100755 --- a/spec/unit/type/mailalias_spec.rb +++ b/spec/unit/type/mailalias_spec.rb @@ -4,46 +4,52 @@ require 'spec_helper' describe Puppet::Type.type(:mailalias) do include PuppetSpec::Files - let :tmpfile_path do tmpfile('afile') end - let :target do tmpfile('mailalias') end + let :tmpfile_path do + tmpfile('afile') + end + + let :target do + tmpfile('mailalias') + end + let :recipient_resource do - described_class.new(:name => "luke", :recipient => "yay", :target => target) + described_class.new(name: 'luke', recipient: 'yay', target: target) end let :file_resource do - described_class.new(:name => "lukefile", :file => tmpfile_path, :target => target) + described_class.new(name: 'lukefile', file: tmpfile_path, target: target) end - it "should be initially absent as a recipient" do + it 'is initially absent as a recipient' do expect(recipient_resource.retrieve_resource[:recipient]).to eq(:absent) end - it "should be initially absent as an included file" do + it 'is initially absent as an included file' do expect(file_resource.retrieve_resource[:file]).to eq(:absent) end - it "should try and set the recipient when it does the sync" do + it 'tries and set the recipient when it does the sync' do expect(recipient_resource.retrieve_resource[:recipient]).to eq(:absent) - recipient_resource.property(:recipient).expects(:set).with(["yay"]) + recipient_resource.property(:recipient).expects(:set).with(['yay']) recipient_resource.property(:recipient).sync end - it "should try and set the included file when it does the sync" do + it 'tries and set the included file when it does the sync' do expect(file_resource.retrieve_resource[:file]).to eq(:absent) file_resource.property(:file).expects(:set).with(tmpfile_path) file_resource.property(:file).sync end - it "should fail when file is not an absolute path" do + it 'fails when file is not an absolute path' do expect { - Puppet::Type.type(:mailalias).new(:name => 'x', :file => 'afile') - }.to raise_error Puppet::Error, /File paths must be fully qualified/ + Puppet::Type.type(:mailalias).new(name: 'x', file: 'afile') + }.to raise_error Puppet::Error, %r{File paths must be fully qualified} end - it "should fail when both file and recipient are specified" do + it 'fails when both file and recipient are specified' do expect { - Puppet::Type.type(:mailalias).new(:name => 'x', :file => tmpfile_path, - :recipient => 'foo@example.com') - }.to raise_error Puppet::Error, /cannot specify both a recipient and a file/ + Puppet::Type.type(:mailalias).new(name: 'x', file: tmpfile_path, + recipient: 'foo@example.com') + }.to raise_error Puppet::Error, %r{cannot specify both a recipient and a file} end end |