Sha256: 4da46af6e7bcc2e8a7494d7886541dafde4d2e9a3110b35a87c02a5e899d10cc

Contents?: true

Size: 587 Bytes

Versions: 3

Compression:

Stored size: 587 Bytes

Contents

require_relative 'helper_test'

subject 'raise exception built-in matcher' do
  Spectus::Matcher::RaiseException.new ZeroDivisionError
end

it 'must return the expected value' do
  expect { subject.instance_variable_get(:@expected) }.to equal: ZeroDivisionError
end

it 'must raise the expected exception' do
  expect { subject.matches? { 0 / 0 } }.to equal: true
end

it 'must not raise any exceptions' do
  expect { subject.matches? { :foo } }.to equal: false
end

it 'must return the raised exception' do
  expect { raise subject.matches? { BOOM } }.to raise_exception: NameError
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spectus-1.0.1 test/spectus/matcher/built_in/test_raise_exception.rb
spectus-1.0.0 test/spectus/matcher/built_in/test_raise_exception.rb
spectus-1.0.0.pre test/spectus/matcher/built_in/test_raise_exception.rb