Sha256: 460c0188a92b77292c445a915e043ec6b149d593527cb1d45ac933d1d170030a
Contents?: true
Size: 794 Bytes
Versions: 24
Compression:
Stored size: 794 Bytes
Contents
# For some reason, the Kernel patches – which ruby mixes into Object – are not # available to the tests, therefore load the file manually. load (Eitil::Root + "/eitil_core/lib/eitil_core/safe_executions/safe_call.rb") RSpec.describe "EitilCore Object#safe_call" do it "should return the block's yield value, if no error is raised" do result = Object.new.safe_call { 1 + 1 } expect(result).to eq 2 end it "should by default return nil, if an error is raised" do result = Object.new.safe_call { raise(StandardError) } expect(result).to be_nil end it "should return the specified :return_value, if an error is raised" do result = Object.new.safe_call(return_value: :something_else) { raise(StandardError) } expect(result).to eq :something_else end end
Version data entries
24 entries across 24 versions & 1 rubygems