Sha256: e189b411a0859a0b90c3ff10aee6afffa27eb23d022a1ed393e46e8ad2c9d98a

Contents?: true

Size: 683 Bytes

Versions: 15

Compression:

Stored size: 683 Bytes

Contents

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

class HooksTest < Mocha::TestCase
  class Mocha::Mockery
    class << self
      attr_writer :instance
    end
  end

  class FakeMockery
    def verify(*args)
    end

    def teardown
      raise "exception within Mockery#teardown"
    end
  end

  def test_ensure_mockery_instance_is_reset_even_when_an_exception_is_raised_in_mockery_teardown
    fake_test_case = Object.new.extend(Mocha::Hooks)
    original_mockery = FakeMockery.new
    Mocha::Mockery.instance = original_mockery

    fake_test_case.mocha_teardown rescue nil

    assert_not_same Mocha::Mockery.instance, original_mockery
  end
end

Version data entries

15 entries across 12 versions & 4 rubygems

Version Path
mocha-1.4.0 test/unit/hooks_test.rb
mocha-1.3.0 test/unit/hooks_test.rb
mocha-1.2.1 test/unit/hooks_test.rb
mocha-1.2.0 test/unit/hooks_test.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/mocha-1.0.0/test/unit/hooks_test.rb
apl-library-0.0.90 vendor/bundle/ruby/1.9.1/gems/mocha-1.0.0/test/unit/hooks_test.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.9.1/gems/mocha-1.0.0/test/unit/hooks_test.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/2.1.0/gems/mocha-1.0.0/test/unit/hooks_test.rb
mocha-1.1.0 test/unit/hooks_test.rb
mocha-1.0.0 test/unit/hooks_test.rb
mocha-1.0.0.alpha test/unit/hooks_test.rb
tnargav-1.3.3 vendor/bundle/ruby/1.9.1/gems/mocha-0.14.0/test/unit/hooks_test.rb
challah-1.0.0 vendor/bundle/gems/mocha-0.14.0/test/unit/hooks_test.rb
tnargav-1.2.3 vendor/bundle/ruby/1.9.1/gems/mocha-0.14.0/test/unit/hooks_test.rb
mocha-0.14.0 test/unit/hooks_test.rb