Skip to content

Commit 9ccd716

Browse files
alessandro54eregon
authored andcommitted
Use exact message assertions in spawn error specs
1 parent 9b3a58b commit 9ccd716

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

core/process/spawn_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ def child_pids(pid)
694694
end
695695

696696
it "raises an Errno::ENOENT if the command does not exist" do
697-
-> { Process.spawn "nonesuch" }.should raise_error(Errno::ENOENT, /No such file or directory.*nonesuch/)
697+
-> { Process.spawn "nonesuch" }.should raise_error(Errno::ENOENT, "No such file or directory - nonesuch")
698698
end
699699

700700
it "sets $? to exit status 127 when the command does not exist" do
@@ -703,7 +703,7 @@ def child_pids(pid)
703703
end
704704

705705
it "raises an Errno::ENOENT if the file does not exist" do
706-
-> { Process.spawn "./nonesuch" }.should raise_error(Errno::ENOENT, /No such file or directory.*nonesuch/)
706+
-> { Process.spawn "./nonesuch" }.should raise_error(Errno::ENOENT, "No such file or directory - ./nonesuch")
707707
end
708708

709709
it "sets $? to exit status 127 when the file does not exist" do
@@ -713,14 +713,14 @@ def child_pids(pid)
713713

714714
platform_is_not :windows do
715715
it "raises an Errno::EACCES when the path is a directory" do
716-
-> { Process.spawn "./" }.should raise_error(Errno::EACCES, /Permission denied/)
716+
-> { Process.spawn "./" }.should raise_error(Errno::EACCES, "Permission denied - ./")
717717
end
718718
end
719719

720720
unless File.executable?(__FILE__) # Some FS (e.g. vboxfs) locate all files executable
721721
platform_is_not :windows do
722722
it "raises an Errno::EACCES when the file does not have execute permissions" do
723-
-> { Process.spawn __FILE__ }.should raise_error(Errno::EACCES, /Permission denied/)
723+
-> { Process.spawn __FILE__ }.should raise_error(Errno::EACCES, "Permission denied - #{__FILE__}")
724724
end
725725

726726
it "sets $? to exit status 127 when the file does not have execute permissions" do
@@ -736,7 +736,7 @@ def child_pids(pid)
736736
File.write("#{dir}/#{exe}", "#!/bin/sh\necho hi")
737737
File.chmod(0644, "#{dir}/#{exe}")
738738
env = { "PATH" => "#{dir}#{File::PATH_SEPARATOR}#{ENV['PATH']}" }
739-
-> { Process.spawn(env, exe) }.should raise_error(Errno::ENOENT, /No such file or directory.*#{exe}/)
739+
-> { Process.spawn(env, exe) }.should raise_error(Errno::ENOENT, "No such file or directory - #{exe}")
740740
$?.exitstatus.should == 127
741741
ensure
742742
rm_r dir

0 commit comments

Comments
 (0)