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