Popen spec: ensure Rubocop is happy
These were introduced in #10305 but only started going red after that PR was merged.
This commit is contained in:
parent
c197e9a27d
commit
847897fdac
@ -75,12 +75,12 @@ describe Utils do
|
|||||||
|
|
||||||
describe "::safe_popen_read" do
|
describe "::safe_popen_read" do
|
||||||
it "does not raise an error if the command succeeds" do
|
it "does not raise an error if the command succeeds" do
|
||||||
expect(subject.safe_popen_read("sh", "-c", "true")).to eq("")
|
expect(described_class.safe_popen_read("sh", "-c", "true")).to eq("")
|
||||||
expect($CHILD_STATUS).to be_a_success
|
expect($CHILD_STATUS).to be_a_success
|
||||||
end
|
end
|
||||||
|
|
||||||
it "raises an error if the command fails" do
|
it "raises an error if the command fails" do
|
||||||
expect { subject.safe_popen_read("sh", "-c", "false") }.to raise_error(ErrorDuringExecution)
|
expect { described_class.safe_popen_read("sh", "-c", "false") }.to raise_error(ErrorDuringExecution)
|
||||||
expect($CHILD_STATUS).to be_a_failure
|
expect($CHILD_STATUS).to be_a_failure
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -88,14 +88,14 @@ describe Utils do
|
|||||||
describe "::safe_popen_write" do
|
describe "::safe_popen_write" do
|
||||||
it "does not raise an error if the command succeeds" do
|
it "does not raise an error if the command succeeds" do
|
||||||
expect(
|
expect(
|
||||||
subject.safe_popen_write("grep", "success") { |pipe| pipe.write "success\n" }.chomp,
|
described_class.safe_popen_write("grep", "success") { |pipe| pipe.write "success\n" }.chomp,
|
||||||
).to eq("success")
|
).to eq("success")
|
||||||
expect($CHILD_STATUS).to be_a_success
|
expect($CHILD_STATUS).to be_a_success
|
||||||
end
|
end
|
||||||
|
|
||||||
it "raises an error if the command fails" do
|
it "raises an error if the command fails" do
|
||||||
expect {
|
expect {
|
||||||
subject.safe_popen_write("grep", "success") { |pipe| pipe.write "failure\n" }
|
described_class.safe_popen_write("grep", "success") { |pipe| pipe.write "failure\n" }
|
||||||
}.to raise_error(ErrorDuringExecution)
|
}.to raise_error(ErrorDuringExecution)
|
||||||
expect($CHILD_STATUS).to be_a_failure
|
expect($CHILD_STATUS).to be_a_failure
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user