File: thrower_test.rb

package info (click to toggle)
ruby-mocha 0.11.3-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 2,300 kB
  • sloc: ruby: 9,935; makefile: 2
file content (20 lines) | stat: -rw-r--r-- 456 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
require File.expand_path('../../test_helper', __FILE__)

require 'mocha/thrower'

class ThrowerTest < Test::Unit::TestCase

  include Mocha

  def test_should_throw_tag
    thrower = Thrower.new(:tag)
    assert_throws(:tag) { thrower.evaluate }
  end

  def test_should_throw_tag_with_return_value
    thrower = Thrower.new(:tag, 'return-value')
    return_value = catch(:tag) { thrower.evaluate }
    assert_equal 'return-value', return_value
  end

end