Sha256: 2edb06da3911fc7655146d444f818a2e40b2b7d72b8eff39b4fdd1878afff23f

Contents?: true

Size: 748 Bytes

Versions: 3

Compression:

Stored size: 748 Bytes

Contents

require 'test/unit'
require 'fileutils'

require 'flexmock'
require 'test/redirect_error'

class FlexMock
  module TestCase
    def assertion_failed_error
      FlexMock.framework_adapter.assertion_failed_error
    end

    # Assertion helper used to assert validation failure.  If a
    # message is given, then the error message should match the
    # expected error message.
    def assert_failure(message=nil)
      ex = assert_raises(assertion_failed_error) { yield }
      if message
        case message
        when Regexp
          assert_match message, ex.message
        when String
          assert ex.message.index(message), "Error message '#{ex.message}' should contain '#{message}'"
        end
      end
      ex
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
flexmock-1.0.0.beta.2 test/test_setup.rb
flexmock-1.0.0.beta.1 test/test_setup.rb
flexmock-0.9.0 test/test_setup.rb