Sha256: 8b549f2bb9da29bbd55d70b7b4e4c7a971ebd675a6eca26b541ee01e3ac43613
Contents?: true
Size: 656 Bytes
Versions: 2
Compression:
Stored size: 656 Bytes
Contents
require_relative "../lib/egonil" require "minitest/autorun" describe 'Kernel#egonil' do it 'should not raise nil exceptions in the block' do egonil do nil.some_methods.that[:do].not.exist end end it 'should restore default behaviour after the block' do egonil do nil.some_methods.that[:do].not.exist end assert_raises NoMethodError do nil.a_method end end it 'raise NoMethodError for non-nil objects' do assert_raises NoMethodError do egonil{ 5.a_method } end end it 'should raise other Exceptions' do assert_raises ZeroDivisionError do egonil{ 5 / 0 } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
egonil-1.0.1 | spec/egonil_spec.rb |
egonil-1.0.0 | spec/egonil_spec.rb |