diff options
author | k0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-01-24 14:31:40 +0000 |
---|---|---|
committer | k0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-01-24 14:31:40 +0000 |
commit | c50220619be5c1d83768611a41d27442dd2056de (patch) | |
tree | 3191b7fe62efc2410a53e08fe248199e3817dd3d /spec | |
parent | fb29cffab05cb5446c1e6cd68035c39143b02763 (diff) | |
download | ruby-c50220619be5c1d83768611a41d27442dd2056de.tar.gz |
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
Diffstat (limited to 'spec')
-rw-r--r-- | spec/ruby/core/kernel/system_spec.rb | 8 |
1 files changed, 8 insertions, 0 deletions
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 |