diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2018-07-02 10:27:03 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2018-07-02 10:27:03 -0700 |
commit | dcac6762380d011f73cf53a50476d31dab0025ee (patch) | |
tree | 294fef3e2b4fea273c4bb11a086061872ed51598 /spec/unit/provider | |
parent | 35603c7ce1bd3ccf35334ed65152140f0ecaf080 (diff) | |
download | chef-dcac6762380d011f73cf53a50476d31dab0025ee.tar.gz |
fix Layout/IndentHeredoc
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec/unit/provider')
30 files changed, 1021 insertions, 1021 deletions
diff --git a/spec/unit/provider/apt_repository_spec.rb b/spec/unit/provider/apt_repository_spec.rb index 54f1f2df66..8ea2b9b823 100644 --- a/spec/unit/provider/apt_repository_spec.rb +++ b/spec/unit/provider/apt_repository_spec.rb @@ -23,25 +23,25 @@ require "spec_helper" # # Output of the command: # => apt-key adv --list-public-keys --with-fingerprint --with-colons -APT_KEY_FINGER = <<-EOF -tru:t:1:1488924856:0:3:1:5 -pub:-:1024:17:40976EAF437D05B5:2004-09-12:::-:Ubuntu Archive Automatic Signing Key <ftpmaster@ubuntu.com>::scESC: -fpr:::::::::630239CC130E1A7FD81A27B140976EAF437D05B5: -sub:-:2048:16:251BEFF479164387:2004-09-12::::::e: -pub:-:1024:17:46181433FBB75451:2004-12-30:::-:Ubuntu CD Image Automatic Signing Key <cdimage@ubuntu.com>::scSC: -fpr:::::::::C5986B4F1257FFA86632CBA746181433FBB75451: -pub:-:4096:1:3B4FE6ACC0B21F32:2012-05-11:::-:Ubuntu Archive Automatic Signing Key (2012) <ftpmaster@ubuntu.com>::scSC: -fpr:::::::::790BC7277767219C42C86F933B4FE6ACC0B21F32: -pub:-:4096:1:D94AA3F0EFE21092:2012-05-11:::-:Ubuntu CD Image Automatic Signing Key (2012) <cdimage@ubuntu.com>::scSC: -fpr:::::::::843938DF228D22F7B3742BC0D94AA3F0EFE21092: +APT_KEY_FINGER = <<~EOF + tru:t:1:1488924856:0:3:1:5 + pub:-:1024:17:40976EAF437D05B5:2004-09-12:::-:Ubuntu Archive Automatic Signing Key <ftpmaster@ubuntu.com>::scESC: + fpr:::::::::630239CC130E1A7FD81A27B140976EAF437D05B5: + sub:-:2048:16:251BEFF479164387:2004-09-12::::::e: + pub:-:1024:17:46181433FBB75451:2004-12-30:::-:Ubuntu CD Image Automatic Signing Key <cdimage@ubuntu.com>::scSC: + fpr:::::::::C5986B4F1257FFA86632CBA746181433FBB75451: + pub:-:4096:1:3B4FE6ACC0B21F32:2012-05-11:::-:Ubuntu Archive Automatic Signing Key (2012) <ftpmaster@ubuntu.com>::scSC: + fpr:::::::::790BC7277767219C42C86F933B4FE6ACC0B21F32: + pub:-:4096:1:D94AA3F0EFE21092:2012-05-11:::-:Ubuntu CD Image Automatic Signing Key (2012) <cdimage@ubuntu.com>::scSC: + fpr:::::::::843938DF228D22F7B3742BC0D94AA3F0EFE21092: EOF # Output of the command: # => gpg --with-fingerprint --with-colons [FILE] -GPG_FINGER = <<-EOF -pub:-:1024:17:327574EE02A818DD:2009-04-22:::-:Cloudera Apt Repository: -fpr:::::::::F36A89E33CC1BD0F71079007327574EE02A818DD: -sub:-:2048:16:84080586D1CA74A1:2009-04-22:::: +GPG_FINGER = <<~EOF + pub:-:1024:17:327574EE02A818DD:2009-04-22:::-:Cloudera Apt Repository: + fpr:::::::::F36A89E33CC1BD0F71079007327574EE02A818DD: + sub:-:2048:16:84080586D1CA74A1:2009-04-22:::: EOF describe Chef::Provider::AptRepository do diff --git a/spec/unit/provider/cron/unix_spec.rb b/spec/unit/provider/cron/unix_spec.rb index 843f3f3d8c..6c4caa4656 100644 --- a/spec/unit/provider/cron/unix_spec.rb +++ b/spec/unit/provider/cron/unix_spec.rb @@ -53,13 +53,13 @@ describe Chef::Provider::Cron::Unix do describe "read_crontab" do let(:stderr) { "" } let(:stdout) do - String.new(<<-CRONTAB) -0 2 * * * /some/other/command - -# Chef Name: something else -* 5 * * * /bin/true - -# Another comment + String.new(<<~CRONTAB) + 0 2 * * * /some/other/command + + # Chef Name: something else + * 5 * * * /bin/true + + # Another comment CRONTAB end diff --git a/spec/unit/provider/cron_spec.rb b/spec/unit/provider/cron_spec.rb index 5673ecc317..50ebff779d 100644 --- a/spec/unit/provider/cron_spec.rb +++ b/spec/unit/provider/cron_spec.rb @@ -42,15 +42,15 @@ describe Chef::Provider::Cron do context "with a matching entry in the user's crontab" do before :each do - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff -@reboot /bin/true param1 param2 -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff + @reboot /bin/true param1 param2 + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment CRONTAB end @@ -67,19 +67,19 @@ CRONTAB end it "should pull env vars out" do - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff -MAILTO=foo@example.com -SHELL=/bin/foosh -PATH=/bin:/foo -HOME=/home/foo -@reboot /bin/true param1 param2 -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff + MAILTO=foo@example.com + SHELL=/bin/foosh + PATH=/bin:/foo + HOME=/home/foo + @reboot /bin/true param1 param2 + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment CRONTAB cron = @provider.load_current_resource expect(cron.mailto).to eq("foo@example.com") @@ -91,12 +91,12 @@ CRONTAB end it "should parse and load generic and standard environment variables from cron entry" do - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -# Chef Name: cronhole some stuff -MAILTO=warn@example.com -TEST=lol -FLAG=1 -@reboot /bin/true + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + # Chef Name: cronhole some stuff + MAILTO=warn@example.com + TEST=lol + FLAG=1 + @reboot /bin/true CRONTAB cron = @provider.load_current_resource @@ -105,13 +105,13 @@ CRONTAB end it "should not break with variables that match the cron resource internals" do - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -# Chef Name: cronhole some stuff -MINUTE=40 -REBOOT=midnight -TEST=lol -ENVIRONMENT=production -@reboot /bin/true + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + # Chef Name: cronhole some stuff + MINUTE=40 + REBOOT=midnight + TEST=lol + ENVIRONMENT=production + @reboot /bin/true CRONTAB cron = @provider.load_current_resource @@ -137,9 +137,9 @@ CRONTAB end it "should create a crontab with the entry" do - expect(@provider).to receive(:write_crontab).with(<<-ENDCRON) -# Chef Name: cronhole some stuff -@reboot /bin/true + expect(@provider).to receive(:write_crontab).with(<<~ENDCRON) + # Chef Name: cronhole some stuff + @reboot /bin/true ENDCRON @provider.run_action(:create) end @@ -168,13 +168,13 @@ CRONTAB context "with no matching entry in the user's crontab" do before :each do - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -0 2 * * * /some/other/command - -# Chef Name: something else -* 5 * * * /bin/true - -# Another comment + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + 0 2 * * * /some/other/command + + # Chef Name: something else + * 5 * * * /bin/true + + # Another comment CRONTAB end @@ -190,9 +190,9 @@ CRONTAB end it "should not fail if there's an existing cron with a numerical argument" do - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -# Chef Name: foo[bar] (baz) -21 */4 * * * some_prog 1234567 + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + # Chef Name: foo[bar] (baz) + 21 */4 * * * some_prog 1234567 CRONTAB expect do @provider.load_current_resource @@ -202,15 +202,15 @@ CRONTAB context "with a matching entry in the user's crontab" do before :each do - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff -* 5 * 1 * /bin/true param1 param2 -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff + * 5 * 1 * /bin/true param1 param2 + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment CRONTAB end @@ -232,19 +232,19 @@ CRONTAB end it "should pull env vars out" do - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff -MAILTO=foo@example.com -SHELL=/bin/foosh -PATH=/bin:/foo -HOME=/home/foo -* 5 * 1 * /bin/true param1 param2 -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff + MAILTO=foo@example.com + SHELL=/bin/foosh + PATH=/bin:/foo + HOME=/home/foo + * 5 * 1 * /bin/true param1 param2 + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment CRONTAB cron = @provider.load_current_resource expect(cron.mailto).to eq("foo@example.com") @@ -261,12 +261,12 @@ CRONTAB end it "should parse and load generic and standard environment variables from cron entry" do - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -# Chef Name: cronhole some stuff -MAILTO=warn@example.com -TEST=lol -FLAG=1 -* 5 * * * /bin/true + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + # Chef Name: cronhole some stuff + MAILTO=warn@example.com + TEST=lol + FLAG=1 + * 5 * * * /bin/true CRONTAB cron = @provider.load_current_resource @@ -275,13 +275,13 @@ CRONTAB end it "should not break with variabels that match the cron resource internals" do - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -# Chef Name: cronhole some stuff -MINUTE=40 -HOUR=midnight -TEST=lol -ENVIRONMENT=production -* 5 * * * /bin/true + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + # Chef Name: cronhole some stuff + MINUTE=40 + HOUR=midnight + TEST=lol + ENVIRONMENT=production + * 5 * * * /bin/true CRONTAB cron = @provider.load_current_resource @@ -298,15 +298,15 @@ CRONTAB context "with a matching entry in the user's crontab using month names and weekday names (#CHEF-3178)" do before :each do - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff -* 5 * Jan Mon /bin/true param1 param2 -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff + * 5 * Jan Mon /bin/true param1 param2 + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment CRONTAB end @@ -334,10 +334,10 @@ CRONTAB context "with a matching entry without a crontab line" do it "should set cron_exists and leave current_resource values at defaults" do - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff CRONTAB cron = @provider.load_current_resource expect(@provider.cron_exists).to eq(true) @@ -351,11 +351,11 @@ CRONTAB end it "should not pick up a commented out crontab line" do - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff -#* 5 * 1 * /bin/true param1 param2 + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff + #* 5 * 1 * /bin/true param1 param2 CRONTAB cron = @provider.load_current_resource expect(@provider.cron_exists).to eq(true) @@ -369,15 +369,15 @@ CRONTAB end it "should not pick up a later crontab entry" do - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff -#* 5 * 1 * /bin/true param1 param2 -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff + #* 5 * 1 * /bin/true param1 param2 + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment CRONTAB cron = @provider.load_current_resource expect(@provider.cron_exists).to eq(true) @@ -442,9 +442,9 @@ CRONTAB end it "should create a crontab with the entry" do - expect(@provider).to receive(:write_crontab).with(<<-ENDCRON) -# Chef Name: cronhole some stuff -30 * * * * /bin/true + expect(@provider).to receive(:write_crontab).with(<<~ENDCRON) + # Chef Name: cronhole some stuff + 30 * * * * /bin/true ENDCRON @provider.run_action(:create) end @@ -455,14 +455,14 @@ CRONTAB @new_resource.shell "/bin/foosh" @new_resource.home "/home/foo" @new_resource.environment "TEST" => "LOL" - expect(@provider).to receive(:write_crontab).with(<<-ENDCRON) -# Chef Name: cronhole some stuff -MAILTO="foo@example.com" -PATH="/usr/bin:/my/custom/path" -SHELL="/bin/foosh" -HOME="/home/foo" -TEST=LOL -30 * * * * /bin/true + expect(@provider).to receive(:write_crontab).with(<<~ENDCRON) + # Chef Name: cronhole some stuff + MAILTO="foo@example.com" + PATH="/usr/bin:/my/custom/path" + SHELL="/bin/foosh" + HOME="/home/foo" + TEST=LOL + 30 * * * * /bin/true ENDCRON @provider.run_action(:create) end @@ -481,26 +481,26 @@ TEST=LOL context "when there is a crontab with no matching section" do before :each do @provider.cron_exists = false - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -0 2 * * * /some/other/command - -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + 0 2 * * * /some/other/command + + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment CRONTAB end it "should add the entry to the crontab" do - expect(@provider).to receive(:write_crontab).with(<<-ENDCRON) -0 2 * * * /some/other/command - -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment -# Chef Name: cronhole some stuff -30 * * * * /bin/true + expect(@provider).to receive(:write_crontab).with(<<~ENDCRON) + 0 2 * * * /some/other/command + + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment + # Chef Name: cronhole some stuff + 30 * * * * /bin/true ENDCRON @provider.run_action(:create) end @@ -511,20 +511,20 @@ TEST=LOL @new_resource.shell "/bin/foosh" @new_resource.home "/home/foo" @new_resource.environment "TEST" => "LOL" - expect(@provider).to receive(:write_crontab).with(<<-ENDCRON) -0 2 * * * /some/other/command - -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment -# Chef Name: cronhole some stuff -MAILTO="foo@example.com" -PATH="/usr/bin:/my/custom/path" -SHELL="/bin/foosh" -HOME="/home/foo" -TEST=LOL -30 * * * * /bin/true + expect(@provider).to receive(:write_crontab).with(<<~ENDCRON) + 0 2 * * * /some/other/command + + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment + # Chef Name: cronhole some stuff + MAILTO="foo@example.com" + PATH="/usr/bin:/my/custom/path" + SHELL="/bin/foosh" + HOME="/home/foo" + TEST=LOL + 30 * * * * /bin/true ENDCRON @provider.run_action(:create) end @@ -544,28 +544,28 @@ TEST=LOL before :each do @provider.cron_exists = true allow(@provider).to receive(:cron_different?).and_return(true) - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff -30 * * 3 * /bin/true -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff + 30 * * 3 * /bin/true + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment CRONTAB end it "should update the crontab entry" do - expect(@provider).to receive(:write_crontab).with(<<-ENDCRON) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff -30 * * * * /bin/true -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment + expect(@provider).to receive(:write_crontab).with(<<~ENDCRON) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff + 30 * * * * /bin/true + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment ENDCRON @provider.run_action(:create) end @@ -576,20 +576,20 @@ TEST=LOL @new_resource.shell "/bin/foosh" @new_resource.home "/home/foo" @new_resource.environment "TEST" => "LOL" - expect(@provider).to receive(:write_crontab).with(<<-ENDCRON) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff -MAILTO="foo@example.com" -PATH="/usr/bin:/my/custom/path" -SHELL="/bin/foosh" -HOME="/home/foo" -TEST=LOL -30 * * * * /bin/true -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment + expect(@provider).to receive(:write_crontab).with(<<~ENDCRON) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff + MAILTO="foo@example.com" + PATH="/usr/bin:/my/custom/path" + SHELL="/bin/foosh" + HOME="/home/foo" + TEST=LOL + 30 * * * * /bin/true + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment ENDCRON @provider.run_action(:create) end @@ -612,78 +612,78 @@ TEST=LOL end it "should add the crontab to the entry" do - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff CRONTAB - expect(@provider).to receive(:write_crontab).with(<<-ENDCRON) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff -30 * * * * /bin/true + expect(@provider).to receive(:write_crontab).with(<<~ENDCRON) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff + 30 * * * * /bin/true ENDCRON @provider.run_action(:create) end it "should not blat any following entries" do - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff -#30 * * * * /bin/true -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff + #30 * * * * /bin/true + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment CRONTAB - expect(@provider).to receive(:write_crontab).with(<<-ENDCRON) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff -30 * * * * /bin/true -#30 * * * * /bin/true -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment + expect(@provider).to receive(:write_crontab).with(<<~ENDCRON) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff + 30 * * * * /bin/true + #30 * * * * /bin/true + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment ENDCRON @provider.run_action(:create) end it "should handle env vars with no crontab" do - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff -MAILTO=bar@example.com -PATH=/usr/bin:/my/custom/path -SHELL=/bin/barsh -HOME=/home/foo - -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff + MAILTO=bar@example.com + PATH=/usr/bin:/my/custom/path + SHELL=/bin/barsh + HOME=/home/foo + + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment CRONTAB @new_resource.mailto "foo@example.com" @new_resource.path "/usr/bin:/my/custom/path" @new_resource.shell "/bin/foosh" @new_resource.home "/home/foo" - expect(@provider).to receive(:write_crontab).with(<<-ENDCRON) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff -MAILTO="foo@example.com" -PATH="/usr/bin:/my/custom/path" -SHELL="/bin/foosh" -HOME="/home/foo" -30 * * * * /bin/true - -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment + expect(@provider).to receive(:write_crontab).with(<<~ENDCRON) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff + MAILTO="foo@example.com" + PATH="/usr/bin:/my/custom/path" + SHELL="/bin/foosh" + HOME="/home/foo" + 30 * * * * /bin/true + + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment ENDCRON @provider.run_action(:create) end @@ -693,13 +693,13 @@ HOME="/home/foo" before :each do @provider.cron_exists = true allow(@provider).to receive(:cron_different?).and_return(false) - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff -* 5 * * * /bin/true - -# Another comment + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff + * 5 * * * /bin/true + + # Another comment CRONTAB end @@ -747,50 +747,50 @@ CRONTAB context "when the user has a crontab with a matching section" do before :each do @provider.cron_exists = true - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff -30 * * 3 * /bin/true -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff + 30 * * 3 * /bin/true + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment CRONTAB end it "should remove the entry" do - expect(@provider).to receive(:write_crontab).with(<<-ENDCRON) -0 2 * * * /some/other/command - -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment + expect(@provider).to receive(:write_crontab).with(<<~ENDCRON) + 0 2 * * * /some/other/command + + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment ENDCRON @provider.run_action(:delete) end it "should remove any env vars with the entry" do - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff -MAILTO=foo@example.com -FOO=test -30 * * 3 * /bin/true -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff + MAILTO=foo@example.com + FOO=test + 30 * * 3 * /bin/true + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment CRONTAB - expect(@provider).to receive(:write_crontab).with(<<-ENDCRON) -0 2 * * * /some/other/command - -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment + expect(@provider).to receive(:write_crontab).with(<<~ENDCRON) + 0 2 * * * /some/other/command + + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment ENDCRON @provider.run_action(:delete) end @@ -812,61 +812,61 @@ FOO=test end it "should remove the section" do - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff CRONTAB - expect(@provider).to receive(:write_crontab).with(<<-ENDCRON) -0 2 * * * /some/other/command - + expect(@provider).to receive(:write_crontab).with(<<~ENDCRON) + 0 2 * * * /some/other/command + ENDCRON @provider.run_action(:delete) end it "should not blat following sections" do - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff -#30 * * 3 * /bin/true -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff + #30 * * 3 * /bin/true + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment CRONTAB - expect(@provider).to receive(:write_crontab).with(<<-ENDCRON) -0 2 * * * /some/other/command - -#30 * * 3 * /bin/true -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment + expect(@provider).to receive(:write_crontab).with(<<~ENDCRON) + 0 2 * * * /some/other/command + + #30 * * 3 * /bin/true + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment ENDCRON @provider.run_action(:delete) end it "should remove any envvars with the section" do - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff -MAILTO=foo@example.com -#30 * * 3 * /bin/true -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff + MAILTO=foo@example.com + #30 * * 3 * /bin/true + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment CRONTAB - expect(@provider).to receive(:write_crontab).with(<<-ENDCRON) -0 2 * * * /some/other/command - -#30 * * 3 * /bin/true -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment + expect(@provider).to receive(:write_crontab).with(<<~ENDCRON) + 0 2 * * * /some/other/command + + #30 * * 3 * /bin/true + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment ENDCRON @provider.run_action(:delete) end @@ -875,13 +875,13 @@ MAILTO=foo@example.com describe "read_crontab" do before :each do - @stdout = <<-CRONTAB -0 2 * * * /some/other/command - -# Chef Name: something else -* 5 * * * /bin/true - -# Another comment + @stdout = <<~CRONTAB + 0 2 * * * /some/other/command + + # Chef Name: something else + * 5 * * * /bin/true + + # Another comment CRONTAB @status = double("Status", exitstatus: 0, stdout: @stdout) allow(@provider).to receive(:shell_out!).and_return(@status) @@ -894,13 +894,13 @@ MAILTO=foo@example.com it "should return the contents of the crontab" do crontab = @provider.send(:read_crontab) - expect(crontab).to eq <<-CRONTAB -0 2 * * * /some/other/command - -# Chef Name: something else -* 5 * * * /bin/true - -# Another comment + expect(crontab).to eq <<~CRONTAB + 0 2 * * * /some/other/command + + # Chef Name: something else + * 5 * * * /bin/true + + # Another comment CRONTAB end diff --git a/spec/unit/provider/git_spec.rb b/spec/unit/provider/git_spec.rb index fafb83f548..b1b556db1c 100644 --- a/spec/unit/provider/git_spec.rb +++ b/spec/unit/provider/git_spec.rb @@ -244,21 +244,21 @@ describe Chef::Provider::Git do end it "gives the latest HEAD revision SHA if nothing is specified" do - @stdout = <<-SHAS -28af684d8460ba4793eda3e7ac238c864a5d029a\tHEAD -503c22a5e41f5ae3193460cca044ed1435029f53\trefs/heads/0.8-alpha -28af684d8460ba4793eda3e7ac238c864a5d029a\trefs/heads/master -c44fe79bb5e36941ce799cee6b9de3a2ef89afee\trefs/tags/0.5.2 -14534f0e0bf133dc9ff6dbe74f8a0c863ff3ac6d\trefs/tags/0.5.4 -d36fddb4291341a1ff2ecc3c560494e398881354\trefs/tags/0.5.6 -9e5ce9031cbee81015de680d010b603bce2dd15f\trefs/tags/0.6.0 -9b4d8dc38dd471246e7cfb1c3c1ad14b0f2bee13\trefs/tags/0.6.2 -014a69af1cdce619de82afaf6cdb4e6ac658fede\trefs/tags/0.7.0 -fa8097ff666af3ce64761d8e1f1c2aa292a11378\trefs/tags/0.7.2 -44f9be0b33ba5c10027ddb030a5b2f0faa3eeb8d\trefs/tags/0.7.4 -d7b9957f67236fa54e660cc3ab45ffecd6e0ba38\trefs/tags/0.7.8 -b7d19519a1c15f1c1a324e2683bd728b6198ce5a\trefs/tags/0.7.8^{} -ebc1b392fe7e8f0fbabc305c299b4d365d2b4d9b\trefs/tags/chef-server-package + @stdout = <<~SHAS + 28af684d8460ba4793eda3e7ac238c864a5d029a\tHEAD + 503c22a5e41f5ae3193460cca044ed1435029f53\trefs/heads/0.8-alpha + 28af684d8460ba4793eda3e7ac238c864a5d029a\trefs/heads/master + c44fe79bb5e36941ce799cee6b9de3a2ef89afee\trefs/tags/0.5.2 + 14534f0e0bf133dc9ff6dbe74f8a0c863ff3ac6d\trefs/tags/0.5.4 + d36fddb4291341a1ff2ecc3c560494e398881354\trefs/tags/0.5.6 + 9e5ce9031cbee81015de680d010b603bce2dd15f\trefs/tags/0.6.0 + 9b4d8dc38dd471246e7cfb1c3c1ad14b0f2bee13\trefs/tags/0.6.2 + 014a69af1cdce619de82afaf6cdb4e6ac658fede\trefs/tags/0.7.0 + fa8097ff666af3ce64761d8e1f1c2aa292a11378\trefs/tags/0.7.2 + 44f9be0b33ba5c10027ddb030a5b2f0faa3eeb8d\trefs/tags/0.7.4 + d7b9957f67236fa54e660cc3ab45ffecd6e0ba38\trefs/tags/0.7.8 + b7d19519a1c15f1c1a324e2683bd728b6198ce5a\trefs/tags/0.7.8^{} + ebc1b392fe7e8f0fbabc305c299b4d365d2b4d9b\trefs/tags/chef-server-package SHAS @resource.revision "" expect(@provider).to receive(:shell_out!).with(@git_ls_remote + "\"HEAD\"", { log_tag: "git[web2.0 app]" }).and_return(double("ShellOut result", stdout: @stdout)) diff --git a/spec/unit/provider/group/dscl_spec.rb b/spec/unit/provider/group/dscl_spec.rb index b6748fd5f8..4d18a8c2b0 100644 --- a/spec/unit/provider/group/dscl_spec.rb +++ b/spec/unit/provider/group/dscl_spec.rb @@ -309,19 +309,19 @@ describe "Test DSCL loading" do @new_resource = Chef::Resource::Group.new("group name aj") @new_resource.group_name("aj") @provider = Chef::Provider::Group::Dscl.new(@new_resource, @run_context) - @output = <<-EOF -AppleMetaNodeLocation: /Local/Default -Comment: - Test Group -GeneratedUID: AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA -NestedGroups: AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAB -Password: * -PrimaryGroupID: 999 -RealName: - TestGroup -RecordName: com.apple.aj -RecordType: dsRecTypeStandard:Groups -GroupMembership: waka bar + @output = <<~EOF + AppleMetaNodeLocation: /Local/Default + Comment: + Test Group + GeneratedUID: AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA + NestedGroups: AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAB + Password: * + PrimaryGroupID: 999 + RealName: + TestGroup + RecordName: com.apple.aj + RecordType: dsRecTypeStandard:Groups + GroupMembership: waka bar EOF allow(@provider).to receive(:safe_dscl).with(*"read /Groups/aj".split(" ")).and_return(@output) @current_resource = @provider.load_current_resource diff --git a/spec/unit/provider/ifconfig/aix_spec.rb b/spec/unit/provider/ifconfig/aix_spec.rb index 3eb4228c51..654b08b2c9 100644 --- a/spec/unit/provider/ifconfig/aix_spec.rb +++ b/spec/unit/provider/ifconfig/aix_spec.rb @@ -22,16 +22,16 @@ require "chef/exceptions" describe Chef::Provider::Ifconfig::Aix do before(:all) do - @ifconfig_output = <<-IFCONFIG -en1: flags=1e080863,480<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD(ACTIVE),CHAIN> - inet 10.153.11.59 netmask 0xffff0000 broadcast 10.153.255.255 - tcp_sendspace 262144 tcp_recvspace 262144 rfc1323 1 -en0: flags=1e080863,480<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD(ACTIVE),CHAIN> metric 1 - inet 172.29.174.58 netmask 0xffffc000 broadcast 172.29.191.255 - tcp_sendspace 262144 tcp_recvspace 262144 rfc1323 1 -lo0: flags=e08084b,c0<UP,BROADCAST,LOOPBACK,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,LARGESEND,CHAIN> - inet 127.0.0.1 netmask 0xff000000 broadcast 127.255.255.255 - inet6 ::1%1/0 + @ifconfig_output = <<~IFCONFIG + en1: flags=1e080863,480<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD(ACTIVE),CHAIN> + inet 10.153.11.59 netmask 0xffff0000 broadcast 10.153.255.255 + tcp_sendspace 262144 tcp_recvspace 262144 rfc1323 1 + en0: flags=1e080863,480<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD(ACTIVE),CHAIN> metric 1 + inet 172.29.174.58 netmask 0xffffc000 broadcast 172.29.191.255 + tcp_sendspace 262144 tcp_recvspace 262144 rfc1323 1 + lo0: flags=e08084b,c0<UP,BROADCAST,LOOPBACK,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,LARGESEND,CHAIN> + inet 127.0.0.1 netmask 0xff000000 broadcast 127.255.255.255 + inet6 ::1%1/0 IFCONFIG end diff --git a/spec/unit/provider/ifconfig/debian_spec.rb b/spec/unit/provider/ifconfig/debian_spec.rb index 9a90dc1e0a..93b0008e8b 100644 --- a/spec/unit/provider/ifconfig/debian_spec.rb +++ b/spec/unit/provider/ifconfig/debian_spec.rb @@ -119,10 +119,10 @@ describe Chef::Provider::Ifconfig::Debian do context "when the /etc/network/interfaces file has the source line" do let(:expected_string) do - <<-EOF -a line -source #{tempdir_path}/* -another line + <<~EOF + a line + source #{tempdir_path}/* + another line EOF end @@ -142,10 +142,10 @@ EOF context "when the /etc/network/interfaces file does not have the source line" do let(:expected_string) do - <<-EOF -a line -another line -source #{tempdir_path}/* + <<~EOF + a line + another line + source #{tempdir_path}/* EOF end @@ -246,10 +246,10 @@ EOF context "when the /etc/network/interfaces file has the source line" do let(:expected_string) do - <<-EOF -a line -source #{tempdir_path}/* -another line + <<~EOF + a line + source #{tempdir_path}/* + another line EOF end @@ -267,10 +267,10 @@ another line context "when the /etc/network/interfaces file does not have the source line" do let(:expected_string) do - <<-EOF -a line -another line -source #{tempdir_path}/* + <<~EOF + a line + another line + source #{tempdir_path}/* EOF end diff --git a/spec/unit/provider/ifconfig_spec.rb b/spec/unit/provider/ifconfig_spec.rb index 748b4d897e..0b8db90428 100644 --- a/spec/unit/provider/ifconfig_spec.rb +++ b/spec/unit/provider/ifconfig_spec.rb @@ -41,9 +41,9 @@ describe Chef::Provider::Ifconfig do end describe Chef::Provider::Ifconfig, "load_current_resource" do - let(:net_tools_version) { StringIO.new <<-EOS } -net-tools 1.60 -ifconfig 1.42 (2001-04-13) + let(:net_tools_version) { StringIO.new <<~EOS } + net-tools 1.60 + ifconfig 1.42 (2001-04-13) EOS before do diff --git a/spec/unit/provider/launchd_spec.rb b/spec/unit/provider/launchd_spec.rb index 693801f99b..97883fc04c 100644 --- a/spec/unit/provider/launchd_spec.rb +++ b/spec/unit/provider/launchd_spec.rb @@ -29,55 +29,55 @@ describe Chef::Provider::Launchd do let(:label) { "call.mom.weekly" } let(:new_resource) { Chef::Resource::Launchd.new(label) } let!(:current_resource) { Chef::Resource::Launchd.new(label) } - let(:test_plist) { String.new <<-XML } -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> -\t<key>Label</key> -\t<string>call.mom.weekly</string> -\t<key>Program</key> -\t<string>/Library/scripts/call_mom.sh</string> -\t<key>StartCalendarInterval</key> -\t<dict> -\t\t<key>Hour</key> -\t\t<integer>10</integer> -\t\t<key>Weekday</key> -\t\t<integer>7</integer> -\t</dict> -\t<key>TimeOut</key> -\t<integer>300</integer> -</dict> -</plist> + let(:test_plist) { String.new <<~XML } + <?xml version="1.0" encoding="UTF-8"?> + <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> + <plist version="1.0"> + <dict> + \t<key>Label</key> + \t<string>call.mom.weekly</string> + \t<key>Program</key> + \t<string>/Library/scripts/call_mom.sh</string> + \t<key>StartCalendarInterval</key> + \t<dict> + \t\t<key>Hour</key> + \t\t<integer>10</integer> + \t\t<key>Weekday</key> + \t\t<integer>7</integer> + \t</dict> + \t<key>TimeOut</key> + \t<integer>300</integer> + </dict> + </plist> XML - let(:test_plist_multiple_intervals) { String.new <<-XML } -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> -\t<key>Label</key> -\t<string>call.mom.weekly</string> -\t<key>Program</key> -\t<string>/Library/scripts/call_mom.sh</string> -\t<key>StartCalendarInterval</key> -\t<array> -\t\t<dict> -\t\t\t<key>Hour</key> -\t\t\t<integer>11</integer> -\t\t\t<key>Weekday</key> -\t\t\t<integer>1</integer> -\t\t</dict> -\t\t<dict> -\t\t\t<key>Hour</key> -\t\t\t<integer>12</integer> -\t\t\t<key>Weekday</key> -\t\t\t<integer>2</integer> -\t\t</dict> -\t</array> -\t<key>TimeOut</key> -\t<integer>300</integer> -</dict> -</plist> + let(:test_plist_multiple_intervals) { String.new <<~XML } + <?xml version="1.0" encoding="UTF-8"?> + <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> + <plist version="1.0"> + <dict> + \t<key>Label</key> + \t<string>call.mom.weekly</string> + \t<key>Program</key> + \t<string>/Library/scripts/call_mom.sh</string> + \t<key>StartCalendarInterval</key> + \t<array> + \t\t<dict> + \t\t\t<key>Hour</key> + \t\t\t<integer>11</integer> + \t\t\t<key>Weekday</key> + \t\t\t<integer>1</integer> + \t\t</dict> + \t\t<dict> + \t\t\t<key>Hour</key> + \t\t\t<integer>12</integer> + \t\t\t<key>Weekday</key> + \t\t\t<integer>2</integer> + \t\t</dict> + \t</array> + \t<key>TimeOut</key> + \t<integer>300</integer> + </dict> + </plist> XML let(:test_hash) do diff --git a/spec/unit/provider/mount/aix_spec.rb b/spec/unit/provider/mount/aix_spec.rb index d807409d05..409bd46ecc 100644 --- a/spec/unit/provider/mount/aix_spec.rb +++ b/spec/unit/provider/mount/aix_spec.rb @@ -22,32 +22,32 @@ require "ostruct" describe Chef::Provider::Mount::Aix do before(:all) do - @mounted_output = <<-MOUNT - node mounted mounted over vfs date options --------- --------------- --------------- ------ ------------ --------------- - /dev/sdz1 /tmp/foo jfs2 Jul 17 13:22 rw,log=/dev/hd8 + @mounted_output = <<~MOUNT + node mounted mounted over vfs date options + -------- --------------- --------------- ------ ------------ --------------- + /dev/sdz1 /tmp/foo jfs2 Jul 17 13:22 rw,log=/dev/hd8 MOUNT - @unmounted_output = <<-UNMOUNTED - node mounted mounted over vfs date options --------- --------------- --------------- ------ ------------ --------------- - /dev/sdz2 / jfs2 Jul 17 13:22 rw,log=/dev/hd8 + @unmounted_output = <<~UNMOUNTED + node mounted mounted over vfs date options + -------- --------------- --------------- ------ ------------ --------------- + /dev/sdz2 / jfs2 Jul 17 13:22 rw,log=/dev/hd8 UNMOUNTED - @conflict_mounted_output = <<-MOUNT - node mounted mounted over vfs date options --------- --------------- --------------- ------ ------------ --------------- - /dev/sdz3 /tmp/foo jfs2 Jul 17 13:22 rw,log=/dev/hd8 + @conflict_mounted_output = <<~MOUNT + node mounted mounted over vfs date options + -------- --------------- --------------- ------ ------------ --------------- + /dev/sdz3 /tmp/foo jfs2 Jul 17 13:22 rw,log=/dev/hd8 MOUNT - @enabled_output = <<-ENABLED -#MountPoint:Device:Vfs:Nodename:Type:Size:Options:AutoMount:Acct -/tmp/foo:/dev/sdz1:jfs2::bootfs:10485760:rw:yes:no + @enabled_output = <<~ENABLED + #MountPoint:Device:Vfs:Nodename:Type:Size:Options:AutoMount:Acct + /tmp/foo:/dev/sdz1:jfs2::bootfs:10485760:rw:yes:no ENABLED - @test_wrong_output = <<-WRONG -#MountPoint:Device:Vfs:Nodename:Type:Size:Options:AutoMount:Acct -/tmp/foo::/dev/sdz1:jfs2:bootfs:10485760:rw:yes:no + @test_wrong_output = <<~WRONG + #MountPoint:Device:Vfs:Nodename:Type:Size:Options:AutoMount:Acct + /tmp/foo::/dev/sdz1:jfs2:bootfs:10485760:rw:yes:no WRONG end @@ -232,22 +232,22 @@ WRONG it "should disable mount if it is mounted and enabled" do stub_mounted_enabled(@provider, @mounted_output, @enabled_output) - allow(::File).to receive(:open).with("/etc/filesystems", "r").and_return(<<-ETCFILESYSTEMS) -/tmp/foo: - dev = /dev/sdz1 - vfs = jfs2 - log = /dev/hd8 - mount = true - check = true - vol = /opt - free = false - quota = no - -/tmp/abc: - dev = /dev/sdz2 - vfs = jfs2 - mount = true - options = rw + allow(::File).to receive(:open).with("/etc/filesystems", "r").and_return(<<~ETCFILESYSTEMS) + /tmp/foo: + dev = /dev/sdz1 + vfs = jfs2 + log = /dev/hd8 + mount = true + check = true + vol = /opt + free = false + quota = no + + /tmp/abc: + dev = /dev/sdz2 + vfs = jfs2 + mount = true + options = rw ETCFILESYSTEMS filesystems = StringIO.new diff --git a/spec/unit/provider/package/apt_spec.rb b/spec/unit/provider/package/apt_spec.rb index 1047534f98..97eda1d774 100644 --- a/spec/unit/provider/package/apt_spec.rb +++ b/spec/unit/provider/package/apt_spec.rb @@ -34,13 +34,13 @@ describe Chef::Provider::Package::Apt do @status = double("Status", exitstatus: 0) @provider = Chef::Provider::Package::Apt.new(@new_resource, @run_context) @stdin = StringIO.new - @stdout = <<-PKG_STATUS -irssi: - Installed: (none) - Candidate: 0.8.14-1ubuntu4 - Version table: - 0.8.14-1ubuntu4 0 - 500 http://us.archive.ubuntu.com/ubuntu/ lucid/main Packages + @stdout = <<~PKG_STATUS + irssi: + Installed: (none) + Candidate: 0.8.14-1ubuntu4 + Version table: + 0.8.14-1ubuntu4 0 + 500 http://us.archive.ubuntu.com/ubuntu/ lucid/main Packages PKG_STATUS @stderr = "" @shell_out = OpenStruct.new(stdout: @stdout, stdin: @stdin, stderr: @stderr, status: @status, exitstatus: 0) @@ -65,17 +65,17 @@ irssi: end it "should set the installed version if package has one" do - @stdout.replace(<<-INSTALLED) -sudo: - Installed: 1.7.2p1-1ubuntu5.3 - Candidate: 1.7.2p1-1ubuntu5.3 - Version table: - *** 1.7.2p1-1ubuntu5.3 0 - 500 http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main Packages - 500 http://security.ubuntu.com/ubuntu/ lucid-security/main Packages - 100 /var/lib/dpkg/status - 1.7.2p1-1ubuntu5 0 - 500 http://us.archive.ubuntu.com/ubuntu/ lucid/main Packages + @stdout.replace(<<~INSTALLED) + sudo: + Installed: 1.7.2p1-1ubuntu5.3 + Candidate: 1.7.2p1-1ubuntu5.3 + Version table: + *** 1.7.2p1-1ubuntu5.3 0 + 500 http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main Packages + 500 http://security.ubuntu.com/ubuntu/ lucid-security/main Packages + 100 /var/lib/dpkg/status + 1.7.2p1-1ubuntu5 0 + 500 http://us.archive.ubuntu.com/ubuntu/ lucid/main Packages INSTALLED expect(@provider).to receive(:shell_out_compacted!).and_return(@shell_out) @provider.load_current_resource @@ -86,8 +86,8 @@ sudo: # it is the superclasses responsibility to throw most exceptions it "if the package does not exist in the cache sets installed + candidate version to nil" do @new_resource.package_name("conic-smarms") - policy_out = <<-POLICY_STDOUT -N: Unable to locate package conic-smarms + policy_out = <<~POLICY_STDOUT + N: Unable to locate package conic-smarms POLICY_STDOUT policy = double(stdout: policy_out, exitstatus: 0) expect(@provider).to receive(:shell_out_compacted!).with( @@ -95,8 +95,8 @@ N: Unable to locate package conic-smarms env: { "DEBIAN_FRONTEND" => "noninteractive" }, timeout: @timeout ).and_return(policy) - showpkg_out = <<-SHOWPKG_STDOUT -N: Unable to locate package conic-smarms + showpkg_out = <<~SHOWPKG_STDOUT + N: Unable to locate package conic-smarms SHOWPKG_STDOUT showpkg = double(stdout: showpkg_out, exitstatus: 0) expect(@provider).to receive(:shell_out_compacted!).with( @@ -111,11 +111,11 @@ N: Unable to locate package conic-smarms # list of virtual packages: http://www.debian.org/doc/packaging-manuals/virtual-package-names-list.txt it "should not install the virtual package there is a single provider package and it is installed" do @new_resource.package_name("libmysqlclient15-dev") - virtual_package_out = <<-VPKG_STDOUT -libmysqlclient15-dev: - Installed: (none) - Candidate: (none) - Version table: + virtual_package_out = <<~VPKG_STDOUT + libmysqlclient15-dev: + Installed: (none) + Candidate: (none) + Version table: VPKG_STDOUT virtual_package = double(stdout: virtual_package_out, exitstatus: 0) expect(@provider).to receive(:shell_out_compacted!).with( @@ -123,23 +123,23 @@ libmysqlclient15-dev: env: { "DEBIAN_FRONTEND" => "noninteractive" }, timeout: @timeout ).and_return(virtual_package) - showpkg_out = <<-SHOWPKG_STDOUT -Package: libmysqlclient15-dev -Versions: - -Reverse Depends: - libmysqlclient-dev,libmysqlclient15-dev - libmysqlclient-dev,libmysqlclient15-dev - libmysqlclient-dev,libmysqlclient15-dev - libmysqlclient-dev,libmysqlclient15-dev - libmysqlclient-dev,libmysqlclient15-dev - libmysqlclient-dev,libmysqlclient15-dev -Dependencies: -Provides: -Reverse Provides: -libmysqlclient-dev 5.1.41-3ubuntu12.7 -libmysqlclient-dev 5.1.41-3ubuntu12.10 -libmysqlclient-dev 5.1.41-3ubuntu12 + showpkg_out = <<~SHOWPKG_STDOUT + Package: libmysqlclient15-dev + Versions: + + Reverse Depends: + libmysqlclient-dev,libmysqlclient15-dev + libmysqlclient-dev,libmysqlclient15-dev + libmysqlclient-dev,libmysqlclient15-dev + libmysqlclient-dev,libmysqlclient15-dev + libmysqlclient-dev,libmysqlclient15-dev + libmysqlclient-dev,libmysqlclient15-dev + Dependencies: + Provides: + Reverse Provides: + libmysqlclient-dev 5.1.41-3ubuntu12.7 + libmysqlclient-dev 5.1.41-3ubuntu12.10 + libmysqlclient-dev 5.1.41-3ubuntu12 SHOWPKG_STDOUT showpkg = double(stdout: showpkg_out, exitstatus: 0) expect(@provider).to receive(:shell_out_compacted!).with( @@ -147,18 +147,18 @@ libmysqlclient-dev 5.1.41-3ubuntu12 env: { "DEBIAN_FRONTEND" => "noninteractive" }, timeout: @timeout ).and_return(showpkg) - real_package_out = <<-RPKG_STDOUT -libmysqlclient-dev: - Installed: 5.1.41-3ubuntu12.10 - Candidate: 5.1.41-3ubuntu12.10 - Version table: - *** 5.1.41-3ubuntu12.10 0 - 500 http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main Packages - 100 /var/lib/dpkg/status - 5.1.41-3ubuntu12.7 0 - 500 http://security.ubuntu.com/ubuntu/ lucid-security/main Packages - 5.1.41-3ubuntu12 0 - 500 http://us.archive.ubuntu.com/ubuntu/ lucid/main Packages + real_package_out = <<~RPKG_STDOUT + libmysqlclient-dev: + Installed: 5.1.41-3ubuntu12.10 + Candidate: 5.1.41-3ubuntu12.10 + Version table: + *** 5.1.41-3ubuntu12.10 0 + 500 http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main Packages + 100 /var/lib/dpkg/status + 5.1.41-3ubuntu12.7 0 + 500 http://security.ubuntu.com/ubuntu/ lucid-security/main Packages + 5.1.41-3ubuntu12 0 + 500 http://us.archive.ubuntu.com/ubuntu/ lucid/main Packages RPKG_STDOUT real_package = double(stdout: real_package_out, exitstatus: 0) expect(@provider).to receive(:shell_out_compacted!).with( @@ -171,11 +171,11 @@ libmysqlclient-dev: it "should raise an exception if you specify a virtual package with multiple provider packages" do @new_resource.package_name("mp3-decoder") - virtual_package_out = <<-VPKG_STDOUT -mp3-decoder: - Installed: (none) - Candidate: (none) - Version table: + virtual_package_out = <<~VPKG_STDOUT + mp3-decoder: + Installed: (none) + Candidate: (none) + Version table: VPKG_STDOUT virtual_package = double(stdout: virtual_package_out, exitstatus: 0) expect(@provider).to receive(:shell_out_compacted!).with( @@ -183,26 +183,26 @@ mp3-decoder: env: { "DEBIAN_FRONTEND" => "noninteractive" }, timeout: @timeout ).and_return(virtual_package) - showpkg_out = <<-SHOWPKG_STDOUT -Package: mp3-decoder -Versions: - -Reverse Depends: - nautilus,mp3-decoder - vux,mp3-decoder - plait,mp3-decoder - ecasound,mp3-decoder - nautilus,mp3-decoder -Dependencies: -Provides: -Reverse Provides: -vlc-nox 1.0.6-1ubuntu1.8 -vlc 1.0.6-1ubuntu1.8 -vlc-nox 1.0.6-1ubuntu1 -vlc 1.0.6-1ubuntu1 -opencubicplayer 1:0.1.17-2 -mpg321 0.2.10.6 -mpg123 1.12.1-0ubuntu1 + showpkg_out = <<~SHOWPKG_STDOUT + Package: mp3-decoder + Versions: + + Reverse Depends: + nautilus,mp3-decoder + vux,mp3-decoder + plait,mp3-decoder + ecasound,mp3-decoder + nautilus,mp3-decoder + Dependencies: + Provides: + Reverse Provides: + vlc-nox 1.0.6-1ubuntu1.8 + vlc 1.0.6-1ubuntu1.8 + vlc-nox 1.0.6-1ubuntu1 + vlc 1.0.6-1ubuntu1 + opencubicplayer 1:0.1.17-2 + mpg321 0.2.10.6 + mpg123 1.12.1-0ubuntu1 SHOWPKG_STDOUT showpkg = double(stdout: showpkg_out, exitstatus: 0) expect(@provider).to receive(:shell_out_compacted!).with( diff --git a/spec/unit/provider/package/cab_spec.rb b/spec/unit/provider/package/cab_spec.rb index 5c86f781f3..bdfcd06be3 100644 --- a/spec/unit/provider/package/cab_spec.rb +++ b/spec/unit/provider/package/cab_spec.rb @@ -31,20 +31,20 @@ describe Chef::Provider::Package::Cab do end let(:installed_package_list_stdout) do - <<-EOF -Packages listing: -Package Identity : Package_for_KB2999486~31bf3856ad364e35~amd64~~6.1.9768.0 -Package Identity : Package_for_KB2994825~31bf3856ad364e35~amd64~~6.1.7601.0 + <<~EOF + Packages listing: + Package Identity : Package_for_KB2999486~31bf3856ad364e35~amd64~~6.1.9768.0 + Package Identity : Package_for_KB2994825~31bf3856ad364e35~amd64~~6.1.7601.0 EOF end let(:package_version_stdout) do - <<-EOF -Package information: -Package Identity : Package_for_KB2664825~31bf3856ad364e35~amd64~~6.1.3.0 -State : Installed -Dependency : Language Pack -The operation completed successfully + <<~EOF + Package information: + Package Identity : Package_for_KB2664825~31bf3856ad364e35~amd64~~6.1.3.0 + State : Installed + Dependency : Language Pack + The operation completed successfully EOF end @@ -57,20 +57,20 @@ The operation completed successfully end def allow_package_info(package_path = nil, package_name = nil) - get_package_info_stdout = <<-EOF -Deployment Image Servicing and Management tool -Version: 6.1.7600.16385 - -Image Version: 6.1.7600.16385 - -Package information: -Package Identity : Package_for_KB2664825~31bf3856ad364e35~amd64~~6.1.3.0 -Applicable : Yes -Copyright : Microsoft Corporation -Company : Microsoft Corporation -State : Installed -Dependency : Language Pack -The operation completed successfully + get_package_info_stdout = <<~EOF + Deployment Image Servicing and Management tool + Version: 6.1.7600.16385 + + Image Version: 6.1.7600.16385 + + Package information: + Package Identity : Package_for_KB2664825~31bf3856ad364e35~amd64~~6.1.3.0 + Applicable : Yes + Copyright : Microsoft Corporation + Company : Microsoft Corporation + State : Installed + Dependency : Language Pack + The operation completed successfully EOF get_package_info_obj = double(stdout: get_package_info_stdout) if package_path @@ -81,30 +81,30 @@ The operation completed successfully end def allow_get_packages - get_packages_stdout = <<-EOF -Deployment Image Servicing and Management tool -Version: 6.1.7600.16385 - -Image Version: 6.1.7600.16385 - -Packages listing: - -Package Identity : Package_for_KB2999486~31bf3856ad364e35~amd64~~6.1.9768.0 -State : Installed -Release Type : Language Pack -Install Time : 2/11/2015 11:33 PM - -Package Identity : Package_for_KB2994825~31bf3856ad364e35~amd64~~6.1.7601.0 -State : Installed -Release Type : Language Pack -Install Time : 2/11/2015 11:33 PM - -Package Identity : Package_for_KB2664825~31bf3856ad364e35~amd64~~6.1.3.0 -State : Installed -Release Type : Feature Pack -Install Time : 11/21/2010 3:40 AM - -The operation completed successfully. + get_packages_stdout = <<~EOF + Deployment Image Servicing and Management tool + Version: 6.1.7600.16385 + + Image Version: 6.1.7600.16385 + + Packages listing: + + Package Identity : Package_for_KB2999486~31bf3856ad364e35~amd64~~6.1.9768.0 + State : Installed + Release Type : Language Pack + Install Time : 2/11/2015 11:33 PM + + Package Identity : Package_for_KB2994825~31bf3856ad364e35~amd64~~6.1.7601.0 + State : Installed + Release Type : Language Pack + Install Time : 2/11/2015 11:33 PM + + Package Identity : Package_for_KB2664825~31bf3856ad364e35~amd64~~6.1.3.0 + State : Installed + Release Type : Feature Pack + Install Time : 11/21/2010 3:40 AM + + The operation completed successfully. EOF get_packages_obj = double(stdout: get_packages_stdout) allow(provider).to receive(:dism_command).with("/Get-Packages").and_return(get_packages_obj) @@ -248,14 +248,14 @@ The operation completed successfully. context "Invalid package source" do def package_version_stdout - package_version_stdout = <<-EOF -Deployment Image Servicing and Management tool -Version: 6.1.7600.16385 -Image Version: 6.1.7600.16385 -An error occurred trying to open - c:\\temp\\test6.1-KB2664825-v3-x64.cab Error: 0x80070003 -Error: 3 -The system cannot find the path specified. -The DISM log file can be found at C:\\Windows\\Logs\\DISM\\dism.log. + package_version_stdout = <<~EOF + Deployment Image Servicing and Management tool + Version: 6.1.7600.16385 + Image Version: 6.1.7600.16385 + An error occurred trying to open - c:\\temp\\test6.1-KB2664825-v3-x64.cab Error: 0x80070003 + Error: 3 + The system cannot find the path specified. + The DISM log file can be found at C:\\Windows\\Logs\\DISM\\dism.log. EOF end diff --git a/spec/unit/provider/package/chocolatey_spec.rb b/spec/unit/provider/package/chocolatey_spec.rb index 40fca821d9..48f8a562de 100644 --- a/spec/unit/provider/package/chocolatey_spec.rb +++ b/spec/unit/provider/package/chocolatey_spec.rb @@ -35,10 +35,10 @@ describe Chef::Provider::Package::Chocolatey do # installed packages (ConEmu is upgradable) let(:local_list_stdout) do - <<-EOF -Chocolatey v0.9.9.11 -chocolatey|0.9.9.11 -ConEmu|15.10.25.0 + <<~EOF + Chocolatey v0.9.9.11 + chocolatey|0.9.9.11 + ConEmu|15.10.25.0 EOF end @@ -50,13 +50,13 @@ ConEmu|15.10.25.0 end def allow_remote_list(package_names, args = nil) - remote_list_stdout = <<-EOF -Chocolatey v0.9.9.11 -chocolatey|0.9.9.11 -ConEmu|15.10.25.1 -Git|2.6.1 -Git|2.6.2 -munin-node|1.6.1.20130823 + remote_list_stdout = <<~EOF + Chocolatey v0.9.9.11 + chocolatey|0.9.9.11 + ConEmu|15.10.25.1 + Git|2.6.1 + Git|2.6.2 + munin-node|1.6.1.20130823 EOF remote_list_obj = double(stdout: remote_list_stdout) package_names.each do |pkg| diff --git a/spec/unit/provider/package/dpkg_spec.rb b/spec/unit/provider/package/dpkg_spec.rb index cf8f5097f0..9df19f0f1b 100644 --- a/spec/unit/provider/package/dpkg_spec.rb +++ b/spec/unit/provider/package/dpkg_spec.rb @@ -34,18 +34,18 @@ describe Chef::Provider::Package::Dpkg do let(:dpkg_deb_status) { status = double(stdout: "#{package}\t#{dpkg_deb_version}", exitstatus: 0) } let(:dpkg_s_version) { "1.11.4-1ubuntu1" } let(:dpkg_s_status) do - stdout = <<-DPKG_S -Package: #{package} -Status: install ok installed -Priority: important -Section: web -Installed-Size: 1944 -Maintainer: Ubuntu Core developers <ubuntu-devel-discuss@lists.ubuntu.com> -Architecture: amd64 -Version: #{dpkg_s_version} -Config-Version: #{dpkg_s_version} -Depends: libc6 (>= 2.8~20080505), libssl0.9.8 (>= 0.9.8f-5) -Conflicts: wget-ssl + stdout = <<~DPKG_S + Package: #{package} + Status: install ok installed + Priority: important + Section: web + Installed-Size: 1944 + Maintainer: Ubuntu Core developers <ubuntu-devel-discuss@lists.ubuntu.com> + Architecture: amd64 + Version: #{dpkg_s_version} + Config-Version: #{dpkg_s_version} + Depends: libc6 (>= 2.8~20080505), libssl0.9.8 (>= 0.9.8f-5) + Conflicts: wget-ssl DPKG_S status = double(stdout: stdout, exitstatus: 1) end @@ -172,10 +172,10 @@ Conflicts: wget-ssl it "on new debian/ubuntu we get an exit(1) and no stdout from dpkg -s for uninstalled" do dpkg_s_status = double( - exitstatus: 1, stdout: "", stderr: <<-EOF -dpkg-query: package '#{package}' is not installed and no information is available -Use dpkg --info (= dpkg-deb --info) to examine archive files, -and dpkg --contents (= dpkg-deb --contents) to list their contents. + exitstatus: 1, stdout: "", stderr: <<~EOF + dpkg-query: package '#{package}' is not installed and no information is available + Use dpkg --info (= dpkg-deb --info) to examine archive files, + and dpkg --contents (= dpkg-deb --contents) to list their contents. EOF ) expect(provider).to receive(:shell_out_compacted!).with("dpkg", "-s", package, returns: [0, 1], timeout: 900).and_return(dpkg_s_status) @@ -185,11 +185,11 @@ and dpkg --contents (= dpkg-deb --contents) to list their contents. it "on old debian/ubuntu we get an exit(0) and we get info on stdout from dpkg -s for uninstalled" do dpkg_s_status = double( - exitstatus: 0, stderr: "", stdout: <<-EOF -Package: #{package} -Status: unknown ok not-installed -Priority: extra -Section: ruby + exitstatus: 0, stderr: "", stdout: <<~EOF + Package: #{package} + Status: unknown ok not-installed + Priority: extra + Section: ruby EOF ) expect(provider).to receive(:shell_out_compacted!).with("dpkg", "-s", package, returns: [0, 1], timeout: 900).and_return(dpkg_s_status) diff --git a/spec/unit/provider/package/ips_spec.rb b/spec/unit/provider/package/ips_spec.rb index 46f0c72399..b5fb05f7ec 100644 --- a/spec/unit/provider/package/ips_spec.rb +++ b/spec/unit/provider/package/ips_spec.rb @@ -35,27 +35,27 @@ describe Chef::Provider::Package::Ips do def local_output stdin = StringIO.new stdout = "" - stderr = <<-PKG_STATUS -pkg: info: no packages matching the following patterns you specified are -installed on the system. Try specifying -r to query remotely: - - crypto/gnupg + stderr = <<~PKG_STATUS + pkg: info: no packages matching the following patterns you specified are + installed on the system. Try specifying -r to query remotely: + + crypto/gnupg PKG_STATUS OpenStruct.new(stdout: stdout, stdin: stdin, stderr: stderr, status: @status, exitstatus: 1) end def remote_output - stdout = <<-PKG_STATUS - Name: security/sudo - Summary: sudo - authority delegation tool - State: Not Installed - Publisher: omnios - Version: 1.8.4.1 (1.8.4p1) - Build Release: 5.11 - Branch: 0.151002 -Packaging Date: April 1, 2012 05:55:52 PM - Size: 2.57 MB - FMRI: pkg://omnios/security/sudo@1.8.4.1,5.11-0.151002:20120401T175552Z + stdout = <<~PKG_STATUS + Name: security/sudo + Summary: sudo - authority delegation tool + State: Not Installed + Publisher: omnios + Version: 1.8.4.1 (1.8.4p1) + Build Release: 5.11 + Branch: 0.151002 + Packaging Date: April 1, 2012 05:55:52 PM + Size: 2.57 MB + FMRI: pkg://omnios/security/sudo@1.8.4.1,5.11-0.151002:20120401T175552Z PKG_STATUS stdin = StringIO.new stderr = "" @@ -92,20 +92,20 @@ PKG_STATUS it "should set the installed version if package has one" do local = local_output - local.stdout = <<-INSTALLED - Name: crypto/gnupg - Summary: GNU Privacy Guard - Description: A complete and free implementation of the OpenPGP Standard as - defined by RFC4880. - Category: Applications/System Utilities - State: Installed - Publisher: solaris - Version: 2.0.17 - Build Release: 5.11 - Branch: 0.175.0.0.0.2.537 -Packaging Date: October 19, 2011 09:14:50 AM - Size: 8.07 MB - FMRI: pkg://solaris/crypto/gnupg@2.0.17,5.11-0.175.0.0.0.2.537:20111019T091450Z + local.stdout = <<~INSTALLED + Name: crypto/gnupg + Summary: GNU Privacy Guard + Description: A complete and free implementation of the OpenPGP Standard as + defined by RFC4880. + Category: Applications/System Utilities + State: Installed + Publisher: solaris + Version: 2.0.17 + Build Release: 5.11 + Branch: 0.175.0.0.0.2.537 + Packaging Date: October 19, 2011 09:14:50 AM + Size: 8.07 MB + FMRI: pkg://solaris/crypto/gnupg@2.0.17,5.11-0.175.0.0.0.2.537:20111019T091450Z INSTALLED expect(@provider).to receive(:shell_out_compacted).with("pkg", "info", @new_resource.package_name, timeout: 900).and_return(local) expect(@provider).to receive(:shell_out_compacted!).with("pkg", "info", "-r", @new_resource.package_name, timeout: 900).and_return(remote_output) @@ -140,17 +140,17 @@ INSTALLED it "should not include the human-readable version in the candidate_version" do remote = remote_output - remote.stdout = <<-PKG_STATUS - Name: security/sudo - Summary: sudo - authority delegation tool - State: Not Installed - Publisher: omnios - Version: 1.8.4.1 (1.8.4p1) - Build Release: 5.11 - Branch: 0.151002 -Packaging Date: April 1, 2012 05:55:52 PM - Size: 2.57 MB - FMRI: pkg://omnios/security/sudo@1.8.4.1,5.11-0.151002:20120401T175552Z + remote.stdout = <<~PKG_STATUS + Name: security/sudo + Summary: sudo - authority delegation tool + State: Not Installed + Publisher: omnios + Version: 1.8.4.1 (1.8.4p1) + Build Release: 5.11 + Branch: 0.151002 + Packaging Date: April 1, 2012 05:55:52 PM + Size: 2.57 MB + FMRI: pkg://omnios/security/sudo@1.8.4.1,5.11-0.151002:20120401T175552Z PKG_STATUS expect(@provider).to receive(:shell_out_compacted).with("pkg", "info", @new_resource.package_name, timeout: 900).and_return(local_output) expect(@provider).to receive(:shell_out_compacted!).with("pkg", "info", "-r", @new_resource.package_name, timeout: 900).and_return(remote) @@ -161,36 +161,36 @@ PKG_STATUS it "should not upgrade the package if it is already installed" do local = local_output - local.stdout = <<-INSTALLED - Name: crypto/gnupg - Summary: GNU Privacy Guard - Description: A complete and free implementation of the OpenPGP Standard as - defined by RFC4880. - Category: Applications/System Utilities - State: Installed - Publisher: solaris - Version: 2.0.17 - Build Release: 5.11 - Branch: 0.175.0.0.0.2.537 -Packaging Date: October 19, 2011 09:14:50 AM - Size: 8.07 MB - FMRI: pkg://solaris/crypto/gnupg@2.0.17,5.11-0.175.0.0.0.2.537:20111019T091450Z + local.stdout = <<~INSTALLED + Name: crypto/gnupg + Summary: GNU Privacy Guard + Description: A complete and free implementation of the OpenPGP Standard as + defined by RFC4880. + Category: Applications/System Utilities + State: Installed + Publisher: solaris + Version: 2.0.17 + Build Release: 5.11 + Branch: 0.175.0.0.0.2.537 + Packaging Date: October 19, 2011 09:14:50 AM + Size: 8.07 MB + FMRI: pkg://solaris/crypto/gnupg@2.0.17,5.11-0.175.0.0.0.2.537:20111019T091450Z INSTALLED remote = remote_output - remote.stdout = <<-REMOTE - Name: crypto/gnupg - Summary: GNU Privacy Guard - Description: A complete and free implementation of the OpenPGP Standard as - defined by RFC4880. - Category: Applications/System Utilities - State: Not Installed - Publisher: solaris - Version: 2.0.18 - Build Release: 5.11 - Branch: 0.175.0.0.0.2.537 -Packaging Date: October 19, 2011 09:14:50 AM - Size: 8.07 MB - FMRI: pkg://solaris/crypto/gnupg@2.0.18,5.11-0.175.0.0.0.2.537:20111019T091450Z + remote.stdout = <<~REMOTE + Name: crypto/gnupg + Summary: GNU Privacy Guard + Description: A complete and free implementation of the OpenPGP Standard as + defined by RFC4880. + Category: Applications/System Utilities + State: Not Installed + Publisher: solaris + Version: 2.0.18 + Build Release: 5.11 + Branch: 0.175.0.0.0.2.537 + Packaging Date: October 19, 2011 09:14:50 AM + Size: 8.07 MB + FMRI: pkg://solaris/crypto/gnupg@2.0.18,5.11-0.175.0.0.0.2.537:20111019T091450Z REMOTE expect(@provider).to receive(:shell_out_compacted).with("pkg", "info", @new_resource.package_name, timeout: 900).and_return(local) diff --git a/spec/unit/provider/package/macports_spec.rb b/spec/unit/provider/package/macports_spec.rb index 54c5340d72..8b75e40d72 100644 --- a/spec/unit/provider/package/macports_spec.rb +++ b/spec/unit/provider/package/macports_spec.rb @@ -70,9 +70,9 @@ describe Chef::Provider::Package::Macports do describe "current_installed_version" do it "should return the current version if the package is installed" do - stdout = <<EOF -The following ports are currently installed: - openssl @0.9.8k_0 (active) + stdout = <<~EOF + The following ports are currently installed: + openssl @0.9.8k_0 (active) EOF status = double(stdout: stdout, exitstatus: 0) diff --git a/spec/unit/provider/package/msu_spec.rb b/spec/unit/provider/package/msu_spec.rb index de805fcb39..49b723e572 100644 --- a/spec/unit/provider/package/msu_spec.rb +++ b/spec/unit/provider/package/msu_spec.rb @@ -31,66 +31,66 @@ describe Chef::Provider::Package::Msu, :windows_only do end let(:installed_package_list_stdout) do - <<-EOF -Packages listing: -Package Identity : Package_for_KB2999486~31bf3856ad364e35~amd64~~6.1.9768.0 -Package Identity : Package_for_KB2994825~31bf3856ad364e35~amd64~~6.1.7601.0 + <<~EOF + Packages listing: + Package Identity : Package_for_KB2999486~31bf3856ad364e35~amd64~~6.1.9768.0 + Package Identity : Package_for_KB2994825~31bf3856ad364e35~amd64~~6.1.7601.0 EOF end let(:package_version_stdout) do - <<-EOF -Package information: -Package Identity : Package_for_KB2664825~31bf3856ad364e35~amd64~~6.1.3.0 -State : Installed -Dependency : Language Pack -The operation completed successfully + <<~EOF + Package information: + Package Identity : Package_for_KB2664825~31bf3856ad364e35~amd64~~6.1.3.0 + State : Installed + Dependency : Language Pack + The operation completed successfully EOF end let(:get_package_info_stdout) do - <<-EOF -Deployment Image Servicing and Management tool -Version: 6.1.7600.16385 - -Image Version: 6.1.7600.16385 - -Package information: -Package Identity : Package_for_KB2664825~31bf3856ad364e35~amd64~~6.1.3.0 -Applicable : Yes -Copyright : Microsoft Corporation -Company : Microsoft Corporation -State : Installed -Dependency : Language Pack -The operation completed successfully + <<~EOF + Deployment Image Servicing and Management tool + Version: 6.1.7600.16385 + + Image Version: 6.1.7600.16385 + + Package information: + Package Identity : Package_for_KB2664825~31bf3856ad364e35~amd64~~6.1.3.0 + Applicable : Yes + Copyright : Microsoft Corporation + Company : Microsoft Corporation + State : Installed + Dependency : Language Pack + The operation completed successfully EOF end def allow_get_packages - get_packages_stdout = <<-EOF -Deployment Image Servicing and Management tool -Version: 6.1.7600.16385 - -Image Version: 6.1.7600.16385 - -Packages listing: - -Package Identity : Package_for_KB2999486~31bf3856ad364e35~amd64~~6.1.9768.0 -State : Installed -Release Type : Language Pack -Install Time : 2/11/2015 11:33 PM - -Package Identity : Package_for_KB2994825~31bf3856ad364e35~amd64~~6.1.7601.0 -State : Installed -Release Type : Language Pack -Install Time : 2/11/2015 11:33 PM - -Package Identity : Package_for_KB2664825~31bf3856ad364e35~amd64~~6.1.3.0 -State : Installed -Release Type : Feature Pack -Install Time : 11/21/2010 3:40 AM - -The operation completed successfully. + get_packages_stdout = <<~EOF + Deployment Image Servicing and Management tool + Version: 6.1.7600.16385 + + Image Version: 6.1.7600.16385 + + Packages listing: + + Package Identity : Package_for_KB2999486~31bf3856ad364e35~amd64~~6.1.9768.0 + State : Installed + Release Type : Language Pack + Install Time : 2/11/2015 11:33 PM + + Package Identity : Package_for_KB2994825~31bf3856ad364e35~amd64~~6.1.7601.0 + State : Installed + Release Type : Language Pack + Install Time : 2/11/2015 11:33 PM + + Package Identity : Package_for_KB2664825~31bf3856ad364e35~amd64~~6.1.3.0 + State : Installed + Release Type : Feature Pack + Install Time : 11/21/2010 3:40 AM + + The operation completed successfully. EOF get_packages_obj = double(stdout: get_packages_stdout) allow_any_instance_of(Chef::Provider::Package::Cab).to receive(:dism_command).with("/Get-Packages").and_return(get_packages_obj) diff --git a/spec/unit/provider/package/pacman_spec.rb b/spec/unit/provider/package/pacman_spec.rb index 9fbba202f5..a07c3b236d 100644 --- a/spec/unit/provider/package/pacman_spec.rb +++ b/spec/unit/provider/package/pacman_spec.rb @@ -32,8 +32,8 @@ describe Chef::Provider::Package::Pacman do allow(@provider).to receive(:shell_out_compacted).and_return(@status) @stdin = StringIO.new - @stdout = StringIO.new(<<-ERR) -error: package "nano" not found + @stdout = StringIO.new(<<~ERR) + error: package "nano" not found ERR @stderr = StringIO.new @pid = 2342 @@ -66,26 +66,26 @@ ERR end it "should set the installed version if pacman has one" do - stdout = <<-PACMAN -Name : nano -Version : 2.2.2-1 -URL : http://www.nano-editor.org -Licenses : GPL -Groups : base -Provides : None -Depends On : glibc ncurses -Optional Deps : None -Required By : None -Conflicts With : None -Replaces : None -Installed Size : 1496.00 K -Packager : Andreas Radke <andyrtr@archlinux.org> -Architecture : i686 -Build Date : Mon 18 Jan 2010 06:16:16 PM CET -Install Date : Mon 01 Feb 2010 10:06:30 PM CET -Install Reason : Explicitly installed -Install Script : Yes -Description : Pico editor clone with enhancements + stdout = <<~PACMAN + Name : nano + Version : 2.2.2-1 + URL : http://www.nano-editor.org + Licenses : GPL + Groups : base + Provides : None + Depends On : glibc ncurses + Optional Deps : None + Required By : None + Conflicts With : None + Replaces : None + Installed Size : 1496.00 K + Packager : Andreas Radke <andyrtr@archlinux.org> + Architecture : i686 + Build Date : Mon 18 Jan 2010 06:16:16 PM CET + Install Date : Mon 01 Feb 2010 10:06:30 PM CET + Install Reason : Explicitly installed + Install Script : Yes + Description : Pico editor clone with enhancements PACMAN status = double(stdout: stdout, exitstatus: 0) @@ -102,22 +102,22 @@ PACMAN end it "should use pacman.conf to determine valid repo names for package versions" do - @pacman_conf = <<-PACMAN_CONF -[options] -HoldPkg = pacman glibc -Architecture = auto - -[customrepo] -Server = https://my.custom.repo - -[core] -Include = /etc/pacman.d/mirrorlist - -[extra] -Include = /etc/pacman.d/mirrorlist - -[community] -Include = /etc/pacman.d/mirrorlist + @pacman_conf = <<~PACMAN_CONF + [options] + HoldPkg = pacman glibc + Architecture = auto + + [customrepo] + Server = https://my.custom.repo + + [core] + Include = /etc/pacman.d/mirrorlist + + [extra] + Include = /etc/pacman.d/mirrorlist + + [community] + Include = /etc/pacman.d/mirrorlist PACMAN_CONF status = double(stdout: "customrepo nano 1.2.3-4", exitstatus: 0) diff --git a/spec/unit/provider/package/paludis_spec.rb b/spec/unit/provider/package/paludis_spec.rb index a9ae5bf9d3..10c0d0f7e8 100644 --- a/spec/unit/provider/package/paludis_spec.rb +++ b/spec/unit/provider/package/paludis_spec.rb @@ -33,13 +33,13 @@ describe Chef::Provider::Package::Paludis do @stdin = StringIO.new @stderr = StringIO.new - @stdout = <<-PKG_STATUS -group/ntp 0 accounts -group/ntp 0 installed-accounts -net/ntp 4.2.6_p5-r2 arbor -user/ntp 0 accounts -user/ntp 0 installed-accounts -net/ntp 4.2.6_p5-r1 installed + @stdout = <<~PKG_STATUS + group/ntp 0 accounts + group/ntp 0 installed-accounts + net/ntp 4.2.6_p5-r2 arbor + user/ntp 0 accounts + user/ntp 0 installed-accounts + net/ntp 4.2.6_p5-r1 installed PKG_STATUS @pid = 12345 @shell_out = OpenStruct.new(stdout: @stdout, stdin: @stdin, stderr: @stderr, status: @status, exitstatus: 0) @@ -64,13 +64,13 @@ PKG_STATUS end it "should return new version if package is installed" do - @stdout.replace(<<-INSTALLED) -group/ntp 0 accounts -group/ntp 0 installed-accounts -net/ntp 4.2.6_p5-r2 arbor -user/ntp 0 accounts -user/ntp 0 installed-accounts -net/ntp 4.2.6_p5-r1 installed + @stdout.replace(<<~INSTALLED) + group/ntp 0 accounts + group/ntp 0 installed-accounts + net/ntp 4.2.6_p5-r2 arbor + user/ntp 0 accounts + user/ntp 0 installed-accounts + net/ntp 4.2.6_p5-r1 installed INSTALLED expect(@provider).to receive(:shell_out_compacted!).and_return(@shell_out) @provider.load_current_resource @@ -97,18 +97,18 @@ INSTALLED end it "should not contain invalid characters for the version string" do - @stdout.replace(<<-PKG_STATUS) -sys-process/lsof 4.87 arbor -sys-process/lsof 4.87 x86_64 + @stdout.replace(<<~PKG_STATUS) + sys-process/lsof 4.87 arbor + sys-process/lsof 4.87 x86_64 PKG_STATUS expect(@provider).to receive(:shell_out_compacted!).with("cave", "-L", "warning", "resolve", "-x", "=sys-process/lsof-4.87", { timeout: @new_resource.timeout || 900 }) @provider.install_package("sys-process/lsof", "4.87") end it "should not include the human-readable version in the candidate_version" do - @stdout.replace(<<-PKG_STATUS) -sys-process/lsof 4.87 arbor -sys-process/lsof 4.87 x86_64 + @stdout.replace(<<~PKG_STATUS) + sys-process/lsof 4.87 arbor + sys-process/lsof 4.87 x86_64 PKG_STATUS expect(@provider).to receive(:shell_out_compacted!).and_return(@shell_out) @provider.load_current_resource diff --git a/spec/unit/provider/package/portage_spec.rb b/spec/unit/provider/package/portage_spec.rb index 889053e826..08d80d3a7d 100644 --- a/spec/unit/provider/package/portage_spec.rb +++ b/spec/unit/provider/package/portage_spec.rb @@ -132,12 +132,12 @@ describe Chef::Provider::Package::Portage, "load_current_resource" do end it "should throw an exception if a category is not specified and there are duplicates" do - stderr_output = <<EOF -You specified an unqualified atom that matched multiple packages: -* app-misc/sphinx -* dev-python/sphinx - -Please use a more specific atom. + stderr_output = <<~EOF + You specified an unqualified atom that matched multiple packages: + * app-misc/sphinx + * dev-python/sphinx + + Please use a more specific atom. EOF status = double(stdout: "", stderr: stderr_output, exitstatus: 1) @provider = Chef::Provider::Package::Portage.new(@new_resource_without_category, @run_context) diff --git a/spec/unit/provider/package/rubygems_spec.rb b/spec/unit/provider/package/rubygems_spec.rb index 3b1a13e49c..6b33ab97f9 100644 --- a/spec/unit/provider/package/rubygems_spec.rb +++ b/spec/unit/provider/package/rubygems_spec.rb @@ -253,32 +253,32 @@ describe Chef::Provider::Package::Rubygems::AlternateGemEnvironment do end it "detects when the target gem environment is the jruby platform" do - gem_env_out = <<-JRUBY_GEM_ENV -RubyGems Environment: - - RUBYGEMS VERSION: 1.3.6 - - RUBY VERSION: 1.8.7 (2010-05-12 patchlevel 249) [java] - - INSTALLATION DIRECTORY: /Users/you/.rvm/gems/jruby-1.5.0 - - RUBY EXECUTABLE: /Users/you/.rvm/rubies/jruby-1.5.0/bin/jruby - - EXECUTABLE DIRECTORY: /Users/you/.rvm/gems/jruby-1.5.0/bin - - RUBYGEMS PLATFORMS: - - ruby - - universal-java-1.6 - - GEM PATHS: - - /Users/you/.rvm/gems/jruby-1.5.0 - - /Users/you/.rvm/gems/jruby-1.5.0@global - - GEM CONFIGURATION: - - :update_sources => true - - :verbose => true - - :benchmark => false - - :backtrace => false - - :bulk_threshold => 1000 - - "install" => "--env-shebang" - - "update" => "--env-shebang" - - "gem" => "--no-rdoc --no-ri" - - :sources => ["https://rubygems.org/", "http://gems.github.com/"] - - REMOTE SOURCES: - - https://rubygems.org/ - - http://gems.github.com/ + gem_env_out = <<~JRUBY_GEM_ENV + RubyGems Environment: + - RUBYGEMS VERSION: 1.3.6 + - RUBY VERSION: 1.8.7 (2010-05-12 patchlevel 249) [java] + - INSTALLATION DIRECTORY: /Users/you/.rvm/gems/jruby-1.5.0 + - RUBY EXECUTABLE: /Users/you/.rvm/rubies/jruby-1.5.0/bin/jruby + - EXECUTABLE DIRECTORY: /Users/you/.rvm/gems/jruby-1.5.0/bin + - RUBYGEMS PLATFORMS: + - ruby + - universal-java-1.6 + - GEM PATHS: + - /Users/you/.rvm/gems/jruby-1.5.0 + - /Users/you/.rvm/gems/jruby-1.5.0@global + - GEM CONFIGURATION: + - :update_sources => true + - :verbose => true + - :benchmark => false + - :backtrace => false + - :bulk_threshold => 1000 + - "install" => "--env-shebang" + - "update" => "--env-shebang" + - "gem" => "--no-rdoc --no-ri" + - :sources => ["https://rubygems.org/", "http://gems.github.com/"] + - REMOTE SOURCES: + - https://rubygems.org/ + - http://gems.github.com/ JRUBY_GEM_ENV expect(@gem_env).to receive(:shell_out_compacted!).with("/usr/weird/bin/gem env").and_return(double("jruby_gem_env", stdout: gem_env_out)) expected = ["ruby", Gem::Platform.new("universal-java-1.6")] @@ -295,32 +295,32 @@ RubyGems Environment: end it "uses the current gem platforms when the target env is not jruby" do - gem_env_out = <<-RBX_GEM_ENV -RubyGems Environment: - - RUBYGEMS VERSION: 1.3.6 - - RUBY VERSION: 1.8.7 (2010-05-14 patchlevel 174) [x86_64-apple-darwin10.3.0] - - INSTALLATION DIRECTORY: /Users/ddeleo/.rvm/gems/rbx-1.0.0-20100514 - - RUBYGEMS PREFIX: /Users/ddeleo/.rvm/rubies/rbx-1.0.0-20100514 - - RUBY EXECUTABLE: /Users/ddeleo/.rvm/rubies/rbx-1.0.0-20100514/bin/rbx - - EXECUTABLE DIRECTORY: /Users/ddeleo/.rvm/gems/rbx-1.0.0-20100514/bin - - RUBYGEMS PLATFORMS: - - ruby - - x86_64-darwin-10 - - x86_64-rubinius-1.0 - - GEM PATHS: - - /Users/ddeleo/.rvm/gems/rbx-1.0.0-20100514 - - /Users/ddeleo/.rvm/gems/rbx-1.0.0-20100514@global - - GEM CONFIGURATION: - - :update_sources => true - - :verbose => true - - :benchmark => false - - :backtrace => false - - :bulk_threshold => 1000 - - :sources => ["https://rubygems.org/", "http://gems.github.com/"] - - "gem" => "--no-rdoc --no-ri" - - REMOTE SOURCES: - - https://rubygems.org/ - - http://gems.github.com/ + gem_env_out = <<~RBX_GEM_ENV + RubyGems Environment: + - RUBYGEMS VERSION: 1.3.6 + - RUBY VERSION: 1.8.7 (2010-05-14 patchlevel 174) [x86_64-apple-darwin10.3.0] + - INSTALLATION DIRECTORY: /Users/ddeleo/.rvm/gems/rbx-1.0.0-20100514 + - RUBYGEMS PREFIX: /Users/ddeleo/.rvm/rubies/rbx-1.0.0-20100514 + - RUBY EXECUTABLE: /Users/ddeleo/.rvm/rubies/rbx-1.0.0-20100514/bin/rbx + - EXECUTABLE DIRECTORY: /Users/ddeleo/.rvm/gems/rbx-1.0.0-20100514/bin + - RUBYGEMS PLATFORMS: + - ruby + - x86_64-darwin-10 + - x86_64-rubinius-1.0 + - GEM PATHS: + - /Users/ddeleo/.rvm/gems/rbx-1.0.0-20100514 + - /Users/ddeleo/.rvm/gems/rbx-1.0.0-20100514@global + - GEM CONFIGURATION: + - :update_sources => true + - :verbose => true + - :benchmark => false + - :backtrace => false + - :bulk_threshold => 1000 + - :sources => ["https://rubygems.org/", "http://gems.github.com/"] + - "gem" => "--no-rdoc --no-ri" + - REMOTE SOURCES: + - https://rubygems.org/ + - http://gems.github.com/ RBX_GEM_ENV expect(@gem_env).to receive(:shell_out_compacted!).with("/usr/weird/bin/gem env").and_return(double("rbx_gem_env", stdout: gem_env_out)) expect(@gem_env.gem_platforms).to eq(Gem.platforms) diff --git a/spec/unit/provider/package/solaris_spec.rb b/spec/unit/provider/package/solaris_spec.rb index 2ebf8fe4be..2aa37fe8b3 100644 --- a/spec/unit/provider/package/solaris_spec.rb +++ b/spec/unit/provider/package/solaris_spec.rb @@ -32,18 +32,18 @@ describe Chef::Provider::Package::Solaris do describe "assessing the current package status" do before do - @pkginfo = <<-PKGINFO -PKGINST: SUNWbash -NAME: GNU Bourne-Again shell (bash) -CATEGORY: system -ARCH: sparc -VERSION: 11.10.0,REV=2005.01.08.05.16 -BASEDIR: / -VENDOR: Sun Microsystems, Inc. -DESC: GNU Bourne-Again shell (bash) version 3.0 -PSTAMP: sfw10-patch20070430084444 -INSTDATE: Nov 04 2009 01:02 -HOTLINE: Please contact your local service provider + @pkginfo = <<~PKGINFO + PKGINST: SUNWbash + NAME: GNU Bourne-Again shell (bash) + CATEGORY: system + ARCH: sparc + VERSION: 11.10.0,REV=2005.01.08.05.16 + BASEDIR: / + VENDOR: Sun Microsystems, Inc. + DESC: GNU Bourne-Again shell (bash) version 3.0 + PSTAMP: sfw10-patch20070430084444 + INSTDATE: Nov 04 2009 01:02 + HOTLINE: Please contact your local service provider PKGINFO @status = double("Status", stdout: "", exitstatus: 0) diff --git a/spec/unit/provider/service/arch_service_spec.rb b/spec/unit/provider/service/arch_service_spec.rb index 818c2ccb27..18db25fef9 100644 --- a/spec/unit/provider/service/arch_service_spec.rb +++ b/spec/unit/provider/service/arch_service_spec.rb @@ -117,10 +117,10 @@ describe Chef::Provider::Service::Arch, "load_current_resource" do describe "when discovering service status with ps" do before do - @stdout = StringIO.new(<<-DEFAULT_PS) -aj 7842 5057 0 21:26 pts/2 00:00:06 vi init.rb -aj 7903 5016 0 21:26 pts/5 00:00:00 /bin/bash -aj 8119 6041 0 21:34 pts/3 00:00:03 vi init_service_spec.rb + @stdout = StringIO.new(<<~DEFAULT_PS) + aj 7842 5057 0 21:26 pts/2 00:00:06 vi init.rb + aj 7903 5016 0 21:26 pts/5 00:00:00 /bin/bash + aj 8119 6041 0 21:34 pts/3 00:00:03 vi init_service_spec.rb DEFAULT_PS @status = double("Status", exitstatus: 0, stdout: @stdout) allow(@provider).to receive(:shell_out!).and_return(@status) @@ -129,9 +129,9 @@ DEFAULT_PS end it "determines the service is running when it appears in ps" do - @stdout = StringIO.new(<<-RUNNING_PS) -aj 7842 5057 0 21:26 pts/2 00:00:06 chef -aj 7842 5057 0 21:26 pts/2 00:00:06 poos + @stdout = StringIO.new(<<~RUNNING_PS) + aj 7842 5057 0 21:26 pts/2 00:00:06 chef + aj 7842 5057 0 21:26 pts/2 00:00:06 poos RUNNING_PS allow(@status).to receive(:stdout).and_return(@stdout) @provider.load_current_resource diff --git a/spec/unit/provider/service/freebsd_service_spec.rb b/spec/unit/provider/service/freebsd_service_spec.rb index 11a02c3421..954ef3d153 100644 --- a/spec/unit/provider/service/freebsd_service_spec.rb +++ b/spec/unit/provider/service/freebsd_service_spec.rb @@ -138,10 +138,10 @@ describe Chef::Provider::Service::Freebsd do context "when we have a 'ps' attribute" do let(:stdout) do - StringIO.new(<<-PS_SAMPLE) -413 ?? Ss 0:02.51 /usr/sbin/syslogd -s -539 ?? Is 0:00.14 /usr/sbin/sshd -545 ?? Ss 0:17.53 sendmail: accepting connections (sendmail) + StringIO.new(<<~PS_SAMPLE) + 413 ?? Ss 0:02.51 /usr/sbin/syslogd -s + 539 ?? Is 0:00.14 /usr/sbin/sshd + 545 ?? Ss 0:17.53 sendmail: accepting connections (sendmail) PS_SAMPLE end let(:status) { double(stdout: stdout, exitstatus: 0) } @@ -163,9 +163,9 @@ PS_SAMPLE context "when the regex matches the output" do let(:stdout) do - StringIO.new(<<-PS_SAMPLE) -555 ?? Ss 0:05.16 /usr/sbin/cron -s - 9881 ?? Ss 0:06.67 /usr/local/sbin/httpd -DNOHTTPACCEPT + StringIO.new(<<~PS_SAMPLE) + 555 ?? Ss 0:05.16 /usr/sbin/cron -s + 9881 ?? Ss 0:06.67 /usr/local/sbin/httpd -DNOHTTPACCEPT PS_SAMPLE end @@ -341,9 +341,9 @@ PS_SAMPLE context "when the rc script has a 'name' variable" do let(:rcscript) do - StringIO.new(<<-EOF) -name="#{new_resource.service_name}" -rcvar=`set_rcvar` + StringIO.new(<<~EOF) + name="#{new_resource.service_name}" + rcvar=`set_rcvar` EOF end @@ -363,8 +363,8 @@ EOF describe "when the rcscript does not have a name variable" do let(:rcscript) do - StringIO.new <<-EOF -rcvar=`set_rcvar` + StringIO.new <<~EOF + rcvar=`set_rcvar` EOF end @@ -375,11 +375,11 @@ EOF describe "when rcvar returns foobar_enable" do let(:rcvar_stdout) do - rcvar_stdout = <<-EOF -# apache22 -# -# #{new_resource.service_name}_enable="YES" -# (default: "") + rcvar_stdout = <<~EOF + # apache22 + # + # #{new_resource.service_name}_enable="YES" + # (default: "") EOF end @@ -394,9 +394,9 @@ EOF describe "when rcvar does not return foobar_enable" do let(:rcvar_stdout) do - rcvar_stdout = <<-EOF -# service_with_noname -# + rcvar_stdout = <<~EOF + # service_with_noname + # EOF end diff --git a/spec/unit/provider/service/init_service_spec.rb b/spec/unit/provider/service/init_service_spec.rb index 5d403c6898..7bbe2c6363 100644 --- a/spec/unit/provider/service/init_service_spec.rb +++ b/spec/unit/provider/service/init_service_spec.rb @@ -32,10 +32,10 @@ describe Chef::Provider::Service::Init, "load_current_resource" do @provider = Chef::Provider::Service::Init.new(@new_resource, @run_context) allow(Chef::Resource::Service).to receive(:new).and_return(@current_resource) - @stdout = StringIO.new(<<-PS) -aj 7842 5057 0 21:26 pts/2 00:00:06 vi init.rb -aj 7903 5016 0 21:26 pts/5 00:00:00 /bin/bash -aj 8119 6041 0 21:34 pts/3 00:00:03 vi init_service_spec.rb + @stdout = StringIO.new(<<~PS) + aj 7842 5057 0 21:26 pts/2 00:00:06 vi init.rb + aj 7903 5016 0 21:26 pts/5 00:00:00 /bin/bash + aj 8119 6041 0 21:34 pts/3 00:00:03 vi init_service_spec.rb PS @status = double("Status", exitstatus: 0, stdout: @stdout) allow(@provider).to receive(:shell_out!).and_return(@status) @@ -133,9 +133,9 @@ PS end it "should set running to true if the regex matches the output" do - @stdout = StringIO.new(<<-RUNNING_PS) -aj 7842 5057 0 21:26 pts/2 00:00:06 chef -aj 7842 5057 0 21:26 pts/2 00:00:06 poos + @stdout = StringIO.new(<<~RUNNING_PS) + aj 7842 5057 0 21:26 pts/2 00:00:06 chef + aj 7842 5057 0 21:26 pts/2 00:00:06 poos RUNNING_PS allow(@status).to receive(:stdout).and_return(@stdout) @provider.load_current_resource diff --git a/spec/unit/provider/service/invokercd_service_spec.rb b/spec/unit/provider/service/invokercd_service_spec.rb index a63e3e1afb..2e30c16da4 100644 --- a/spec/unit/provider/service/invokercd_service_spec.rb +++ b/spec/unit/provider/service/invokercd_service_spec.rb @@ -32,10 +32,10 @@ describe Chef::Provider::Service::Invokercd, "load_current_resource" do @provider = Chef::Provider::Service::Invokercd.new(@new_resource, @run_context) allow(Chef::Resource::Service).to receive(:new).and_return(@current_resource) - @stdout = StringIO.new(<<-PS) -aj 7842 5057 0 21:26 pts/2 00:00:06 vi init.rb -aj 7903 5016 0 21:26 pts/5 00:00:00 /bin/bash -aj 8119 6041 0 21:34 pts/3 00:00:03 vi init_service_spec.rb + @stdout = StringIO.new(<<~PS) + aj 7842 5057 0 21:26 pts/2 00:00:06 vi init.rb + aj 7903 5016 0 21:26 pts/5 00:00:00 /bin/bash + aj 8119 6041 0 21:34 pts/3 00:00:03 vi init_service_spec.rb PS @status = double("Status", exitstatus: 0, stdout: @stdout) allow(@provider).to receive(:shell_out!).and_return(@status) @@ -118,9 +118,9 @@ PS end it "should set running to true if the regex matches the output" do - @stdout = StringIO.new(<<-RUNNING_PS) -aj 7842 5057 0 21:26 pts/2 00:00:06 chef -aj 7842 5057 0 21:26 pts/2 00:00:06 poos + @stdout = StringIO.new(<<~RUNNING_PS) + aj 7842 5057 0 21:26 pts/2 00:00:06 chef + aj 7842 5057 0 21:26 pts/2 00:00:06 poos RUNNING_PS @status = double("Status", exitstatus: 0, stdout: @stdout) expect(@provider).to receive(:shell_out!).and_return(@status) diff --git a/spec/unit/provider/service/macosx_spec.rb b/spec/unit/provider/service/macosx_spec.rb index 5ca06d9ec8..0c71eb604f 100644 --- a/spec/unit/provider/service/macosx_spec.rb +++ b/spec/unit/provider/service/macosx_spec.rb @@ -48,15 +48,15 @@ describe Chef::Provider::Service::Macosx do let(:run_context) { Chef::RunContext.new(node, {}, events) } let(:provider) { described_class.new(new_resource, run_context) } let(:launchctl_stdout) { StringIO.new } - let(:plutil_stdout) { String.new <<-XML } -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>Label</key> - <string>io.redis.redis-server</string> -</dict> -</plist> + let(:plutil_stdout) { String.new <<~XML } + <?xml version="1.0" encoding="UTF-8"?> + <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> + <plist version="1.0"> + <dict> + <key>Label</key> + <string>io.redis.redis-server</string> + </dict> + </plist> XML %w{Daemon Agent}.each do |service_type| @@ -136,20 +136,20 @@ XML end context "when launchctl returns pid in service list" do - let(:launchctl_stdout) { StringIO.new <<-SVC_LIST } -{ - "LimitLoadToSessionType" = "System"; - "Label" = "io.redis.redis-server"; - "TimeOut" = 30; - "OnDemand" = false; - "LastExitStatus" = 0; - "PID" = 62803; - "Program" = "do_some.sh"; - "ProgramArguments" = ( - "path/to/do_something.sh"; - "-f"; - ); -}; + let(:launchctl_stdout) { StringIO.new <<~SVC_LIST } + { + "LimitLoadToSessionType" = "System"; + "Label" = "io.redis.redis-server"; + "TimeOut" = 30; + "OnDemand" = false; + "LastExitStatus" = 0; + "PID" = 62803; + "Program" = "do_some.sh"; + "ProgramArguments" = ( + "path/to/do_something.sh"; + "-f"; + ); + }; SVC_LIST before do @@ -175,19 +175,19 @@ SVC_LIST end end context "when launchctl returns empty service pid" do - let(:launchctl_stdout) { StringIO.new <<-SVC_LIST } -{ - "LimitLoadToSessionType" = "System"; - "Label" = "io.redis.redis-server"; - "TimeOut" = 30; - "OnDemand" = false; - "LastExitStatus" = 0; - "Program" = "do_some.sh"; - "ProgramArguments" = ( - "path/to/do_something.sh"; - "-f"; - ); -}; + let(:launchctl_stdout) { StringIO.new <<~SVC_LIST } + { + "LimitLoadToSessionType" = "System"; + "Label" = "io.redis.redis-server"; + "TimeOut" = 30; + "OnDemand" = false; + "LastExitStatus" = 0; + "Program" = "do_some.sh"; + "ProgramArguments" = ( + "path/to/do_something.sh"; + "-f"; + ); + }; SVC_LIST before do @@ -204,8 +204,8 @@ SVC_LIST end context "when launchctl doesn't return service entry at all" do - let(:launchctl_stdout) { StringIO.new <<-SVC_LIST } -Could not find service "io.redis.redis-server" in domain for system + let(:launchctl_stdout) { StringIO.new <<~SVC_LIST } + Could not find service "io.redis.redis-server" in domain for system SVC_LIST it "sets service running state to false" do diff --git a/spec/unit/provider/service/simple_service_spec.rb b/spec/unit/provider/service/simple_service_spec.rb index e9fe1b0482..4481a7c0e3 100644 --- a/spec/unit/provider/service/simple_service_spec.rb +++ b/spec/unit/provider/service/simple_service_spec.rb @@ -31,10 +31,10 @@ describe Chef::Provider::Service::Simple, "load_current_resource" do @provider = Chef::Provider::Service::Simple.new(@new_resource, @run_context) allow(Chef::Resource::Service).to receive(:new).and_return(@current_resource) - @stdout = StringIO.new(<<-NOMOCKINGSTRINGSPLZ) -aj 7842 5057 0 21:26 pts/2 00:00:06 vi init.rb -aj 7903 5016 0 21:26 pts/5 00:00:00 /bin/bash -aj 8119 6041 0 21:34 pts/3 00:00:03 vi simple_service_spec.rb + @stdout = StringIO.new(<<~NOMOCKINGSTRINGSPLZ) + aj 7842 5057 0 21:26 pts/2 00:00:06 vi init.rb + aj 7903 5016 0 21:26 pts/5 00:00:00 /bin/bash + aj 8119 6041 0 21:34 pts/3 00:00:03 vi simple_service_spec.rb NOMOCKINGSTRINGSPLZ @status = double("Status", exitstatus: 0, stdout: @stdout) allow(@provider).to receive(:shell_out!).and_return(@status) @@ -75,9 +75,9 @@ NOMOCKINGSTRINGSPLZ end it "should set running to true if the regex matches the output" do - @stdout = StringIO.new(<<-NOMOCKINGSTRINGSPLZ) -aj 7842 5057 0 21:26 pts/2 00:00:06 chef -aj 7842 5057 0 21:26 pts/2 00:00:06 poos + @stdout = StringIO.new(<<~NOMOCKINGSTRINGSPLZ) + aj 7842 5057 0 21:26 pts/2 00:00:06 chef + aj 7842 5057 0 21:26 pts/2 00:00:06 poos NOMOCKINGSTRINGSPLZ @status = double("Status", exitstatus: 0, stdout: @stdout) allow(@provider).to receive(:shell_out!).and_return(@status) diff --git a/spec/unit/provider/template/content_spec.rb b/spec/unit/provider/template/content_spec.rb index fb5d127d57..67d4eba138 100644 --- a/spec/unit/provider/template/content_spec.rb +++ b/spec/unit/provider/template/content_spec.rb @@ -147,21 +147,21 @@ describe Chef::Provider::Template::Content do end it "creates the template with the rendered content" do - expect(IO.read(content.tempfile.path)).to eql <<EOF -openldap -default -#{CHEF_SPEC_DATA}/cookbooks/openldap/recipes/default.rb:2:in `from_file' -#{CHEF_SPEC_DATA}/cookbooks/openldap/recipes/default.rb -2 -helpers.erb -#{CHEF_SPEC_DATA}/cookbooks/openldap/templates/default/helpers.erb -openldap -default -#{CHEF_SPEC_DATA}/cookbooks/openldap/recipes/default.rb:2:in `from_file' -#{CHEF_SPEC_DATA}/cookbooks/openldap/recipes/default.rb -2 -helpers.erb -#{CHEF_SPEC_DATA}/cookbooks/openldap/templates/default/helpers.erb + expect(IO.read(content.tempfile.path)).to eql <<~EOF + openldap + default + #{CHEF_SPEC_DATA}/cookbooks/openldap/recipes/default.rb:2:in `from_file' + #{CHEF_SPEC_DATA}/cookbooks/openldap/recipes/default.rb + 2 + helpers.erb + #{CHEF_SPEC_DATA}/cookbooks/openldap/templates/default/helpers.erb + openldap + default + #{CHEF_SPEC_DATA}/cookbooks/openldap/recipes/default.rb:2:in `from_file' + #{CHEF_SPEC_DATA}/cookbooks/openldap/recipes/default.rb + 2 + helpers.erb + #{CHEF_SPEC_DATA}/cookbooks/openldap/templates/default/helpers.erb EOF end diff --git a/spec/unit/provider/zypper_repository_spec.rb b/spec/unit/provider/zypper_repository_spec.rb index 3a26876f99..fc8ff14afb 100644 --- a/spec/unit/provider/zypper_repository_spec.rb +++ b/spec/unit/provider/zypper_repository_spec.rb @@ -20,17 +20,17 @@ require "spec_helper" # Output of the command: # => rpm -qa gpg-pubkey* -RPM_KEYS = <<-EOF -gpg-pubkey-307e3d54-4be01a65 -gpg-pubkey-3dbdc284-53674dd4 +RPM_KEYS = <<~EOF + gpg-pubkey-307e3d54-4be01a65 + gpg-pubkey-3dbdc284-53674dd4 EOF # Output of the command: # => gpg --with-fingerprint [FILE] -GPG_FINGER = <<-EOF -pub 2048R/3DBDC284 2011-08-19 [expires: 2024-06-14] - Key fingerprint = 573B FD6B 3D8F BC64 1079 A6AB ABF5 BD82 7BD9 BF62 -uid nginx signing key <signing-key@nginx.com> +GPG_FINGER = <<~EOF + pub 2048R/3DBDC284 2011-08-19 [expires: 2024-06-14] + Key fingerprint = 573B FD6B 3D8F BC64 1079 A6AB ABF5 BD82 7BD9 BF62 + uid nginx signing key <signing-key@nginx.com> EOF describe Chef::Provider::ZypperRepository do |