From c50220619be5c1d83768611a41d27442dd2056de Mon Sep 17 00:00:00 2001 From: k0kubun Date: Wed, 24 Jan 2018 14:31:40 +0000 Subject: system_spec.rb: add RubySpec for r62025 NEWS: added an entry for `exception: true` option. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62026 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- spec/ruby/core/kernel/system_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'spec/ruby/core') diff --git a/spec/ruby/core/kernel/system_spec.rb b/spec/ruby/core/kernel/system_spec.rb index aee75441a2..a3dfbeba05 100644 --- a/spec/ruby/core/kernel/system_spec.rb +++ b/spec/ruby/core/kernel/system_spec.rb @@ -25,6 +25,14 @@ describe :kernel_system, shared: true do $?.exitstatus.should == 1 end + it "raises RuntimeError when `exception: true` is given and the command exits with a non-zero exit status" do + lambda { @object.system(ruby_cmd('exit 1'), exception: true) }.should raise_error(RuntimeError) + end + + it "raises Errno::ENOENT when `exception: true` is given and the specified command does not exist" do + lambda { @object.system('feature_14386', exception: true) }.should raise_error(Errno::ENOENT) + end + it "returns nil when command execution fails" do @object.system("sad").should be_nil -- cgit v1.2.3