From e722fe8ca23533f83c3c6979c95bf2a160069c41 Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Wed, 9 Sep 2020 15:26:16 -0700 Subject: Simplify things a bit with &. Use the latest and greatest ruby-isms to cut down on some code. Signed-off-by: Tim Smith --- spec/mixlib/shellout_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'spec/mixlib/shellout_spec.rb') 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 -- cgit v1.2.1