Sha256: 3a79e61038cbb8d0ba51efb89af51e4b1cfd73e1436cadd6ad7bc2aa7fe71072

Contents?: true

Size: 1001 Bytes

Versions: 2

Compression:

Stored size: 1001 Bytes

Contents

#!/usr/bin/env ruby

#---
# Copyright 2003-2012 by Jim Weirich (jim.weirich@gmail.com).
# All rights reserved.

# Permission is granted for use, copying, modification, distribution,
# and distribution of modified versions of this work as long as the
# above copyright notice is included.
#+++



require 'flexmock/base'

class FlexMock
  if defined?(::RSpec)
    SpecModule = RSpec
  else
    SpecModule = Spec
  end

  class RSpecFrameworkAdapter
    def make_assertion(msg, &block)
      msg = msg.call if msg.is_a?(Proc)
      SpecModule::Expectations.fail_with(msg) unless yield
    end

    def assert_equal(a, b, msg=nil)
      message = msg || "Expected equal"
      make_assertion(message + "\n<#{a}> expected, but was\n<#{b}>") { a == b }
    end

    class AssertionFailedError < StandardError; end
    def assertion_failed_error
      SpecModule::Expectations::ExpectationNotMetError
    end
  end

  @framework_adapter = RSpecFrameworkAdapter.new
end

require 'flexmock/rspec_spy_matcher'

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
flexmock-1.3.2 lib/flexmock/rspec.rb
flexmock-1.3.1 lib/flexmock/rspec.rb