Sha256: fcf6ff083e0197a20f602722ed145547731c1b8709f387d47fb14f73620a5c5e
Contents?: true
Size: 1.55 KB
Versions: 13
Compression:
Stored size: 1.55 KB
Contents
require File.dirname(__FILE__) + '/../../../test_helper' module Spec module Api module Helper class ThrowingTest < Test::Unit::TestCase # should.raise def test_should_throw_should_pass_when_proper_symbol_is_thrown assert_nothing_raised do proc { throw :foo }.should.throw :foo end end def test_should_throw_should_fail_when_wrong_exception_is_thrown assert_raise(ExpectationNotMetError) do proc { throw :bar }.should.throw :foo end end def test_should_throw_should_fail_when_no_symbol_is_thrown assert_raise(ExpectationNotMetError) do proc {''.to_s}.should.throw :foo end end # should.not.throw def test_should_not_throw_should_fail_when_specific_symbol_is_thrown assert_raise(ExpectationNotMetError) do proc { throw :foo }.should.not.throw :foo end end def test_should_not_throw_should_pass_when_other_symbol_is_thrown assert_nothing_raised do proc { throw :bar }.should.not.throw :foo end end def test_should_not_throw_should_pass_when_no_symbol_is_thrown assert_nothing_raised do proc { ''.to_s }.should.not.throw :foo end end def test_should_not_throw_should_pass_when_no_symbol_is_thrown_and_none_is_specified assert_nothing_raised do proc { ''.to_s }.should.not.throw end end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems