Sha256: def56748a0d28b96b76b01d6ac542e9db020a09d4079d8cbf057b1332680e54d

Contents?: true

Size: 1.45 KB

Versions: 2

Compression:

Stored size: 1.45 KB

Contents

#!/usr/bin/env ruby

require 'test/unit'
require 'flexmock'

class TestTuIntegrationMockVerificationInTeardown < Test::Unit::TestCase
  include FlexMock::TestCase

  def teardown
    assert_raise(Test::Unit::AssertionFailedError) do
      super
    end
  end

  def test_mock_verification_occurs_during_teardown
    flexmock("xyz").should_receive(:hi).with(any).once
  end
end

class TestTuIntegrationMockVerificationWithoutSetup < Test::Unit::TestCase
  include FlexMock::TestCase

  def teardown
    assert_raise(Test::Unit::AssertionFailedError) do
      super
    end
  end

  def test_mock_verification_occurs_during_teardown
    flexmock("xyz").should_receive(:hi).with(any).once
  end
end

class TestTuIntegrationMockVerificationForgetfulSetup < Test::Unit::TestCase
  include FlexMock::TestCase

  def teardown
    assert_raise(Test::Unit::AssertionFailedError) do
      super
    end
  end

  def test_mock_verification_occurs_during_teardown
    flexmock("xyz").should_receive(:hi).with(any).once
  end
end

class TestTuIntegrationSetupOverridenAndNoMocksOk < Test::Unit::TestCase
  include FlexMock::TestCase

  def test_mock_verification_occurs_during_teardown
  end
end

class TestTuIntegrationFailurePreventsVerification < Test::Unit::TestCase
  include FlexMock::TestCase

  def test_mock_verification_occurs_during_teardown
    flexmock('m').should_receive(:hi).once
    simulate_failure
  end

  private

  def simulate_failure
    @test_passed = false
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
flexmock-0.3.1 test/test_tu_integration.rb
flexmock-0.3.2 test/test_tu_integration.rb