Sha256: 8c5d7c0682f7e1e42eb16c347808c3b2da3bc31e17ba7b252b6810b6b84f74a2

Contents?: true

Size: 581 Bytes

Versions: 8

Compression:

Stored size: 581 Bytes

Contents

require File.expand_path('../../test_helper', __FILE__)

require 'mocha/invocation'
require 'mocha/thrower'

class ThrowerTest < Mocha::TestCase
  include Mocha

  def new_invocation
    Invocation.new(:irrelevant, :irrelevant)
  end

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

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mocha-1.11.2 test/unit/thrower_test.rb
mocha-1.11.1 test/unit/thrower_test.rb
mocha-1.11.0 test/unit/thrower_test.rb
mocha-1.10.2 test/unit/thrower_test.rb
mocha-1.10.1 test/unit/thrower_test.rb
mocha-1.10.0 test/unit/thrower_test.rb
mocha-1.10.0.beta.1 test/unit/thrower_test.rb
mocha-1.10.0.alpha test/unit/thrower_test.rb