Sha256: b7d695f323a43e2fdd3513ccb595c80b5d815f2886601b2cd6336595e2cf651b
Contents?: true
Size: 771 Bytes
Versions: 11
Compression:
Stored size: 771 Bytes
Contents
require 'spec_helper' require 'ronin/extensions/kernel' describe Kernel do it "should provide Kernel#try" do Kernel.should respond_to('try') end describe "#try" do it "should return the result of the block if nothing is raised" do try { 2 + 2 }.should == 4 end it "should return nil if an exception is raised" do try { 2 + 'a' }.should be_nil end it "should rescue RuntimeError exceptions" do lambda { try { raise(RuntimeError,"something happened",caller) } }.should_not raise_error(RuntimeError) end it "should rescue StandardError exceptions" do lambda { try { raise(StandardError,"not allowed to do that",caller) } }.should_not raise_error(StandardError) end end end
Version data entries
11 entries across 11 versions & 1 rubygems