summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-09-09 15:26:16 -0700
committerTim Smith <tsmith84@gmail.com>2020-09-09 15:26:16 -0700
commite722fe8ca23533f83c3c6979c95bf2a160069c41 (patch)
tree68a05425d120612df21d0c26225895d0035bba31 /spec
parente2a43f613ff1830175716acd541cf3bc921183d6 (diff)
downloadmixlib-shellout-e722fe8ca23533f83c3c6979c95bf2a160069c41.tar.gz
Simplify things a bit with &.safe
Use the latest and greatest ruby-isms to cut down on some code. Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'spec')
-rw-r--r--spec/mixlib/shellout_spec.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/spec/mixlib/shellout_spec.rb b/spec/mixlib/shellout_spec.rb
index 0d444a3..9e79fa8 100644
--- a/spec/mixlib/shellout_spec.rb
+++ b/spec/mixlib/shellout_spec.rb
@@ -1095,7 +1095,7 @@ describe Mixlib::ShellOut do
end
after do
- @test_file.close if @test_file
+ @test_file&.close
end
let(:ruby_code) { "fd = File.for_fd(#{@test_file.to_i}) rescue nil; if fd; fd.seek(0); puts fd.read(5); end" }
@@ -1380,7 +1380,7 @@ describe Mixlib::ShellOut do
end
context "with subprocess writing lots of data to both stdout and stderr" do
- let(:expected_output_with) { lambda { |chr| (chr * 20_000) + (LINE_ENDING).to_s + (chr * 20_000) + (LINE_ENDING).to_s } }
+ let(:expected_output_with) { lambda { |chr| (chr * 20_000) + LINE_ENDING.to_s + (chr * 20_000) + LINE_ENDING.to_s } }
context "when writing to STDOUT first" do
let(:ruby_code) { %q{puts "f" * 20_000; STDERR.puts "u" * 20_000; puts "f" * 20_000; STDERR.puts "u" * 20_000} }
@@ -1543,7 +1543,7 @@ describe Mixlib::ShellOut do
let(:options) { { user: user } }
it "should run as specified user" do
- expect(running_user).to eql((user).to_s)
+ expect(running_user).to eql(user.to_s)
end
end
end