Sha256: b159ce11c76a005994b9a55cff229671fea453edec5b8447c76835951254156b

Contents?: true

Size: 915 Bytes

Versions: 35

Compression:

Stored size: 915 Bytes

Contents

require 'flexmock/spy_describers'

class FlexMock
  module TestUnitAssertions
    include FlexMock::SpyDescribers

    def assert_spy_called(spy, method_name, *args)
      _assert_spy_called(false, spy, method_name, *args)
    end

    def assert_spy_not_called(spy, method_name, *args)
      _assert_spy_called(true, spy, method_name, *args)
    end

    private

    def _assert_spy_called(negative, spy, method_name, *args)
      options = {}
      if method_name.is_a?(Hash)
        options = method_name
        method_name = args.shift
      end
      args = nil if args == [:_]
      bool = spy.flexmock_received?(method_name, args, options)
      if negative
        bool = !bool
        message = describe_spy_negative_expectation(spy, method_name, args, options)
      else
        message = describe_spy_expectation(spy, method_name, args, options)
      end
      assert bool, message
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
flexmock-2.4.2 lib/flexmock/test_unit_assert_spy_called.rb
flexmock-2.4.1 lib/flexmock/test_unit_assert_spy_called.rb
flexmock-2.4.0 lib/flexmock/test_unit_assert_spy_called.rb
flexmock-2.3.8 lib/flexmock/test_unit_assert_spy_called.rb
flexmock-2.3.6 lib/flexmock/test_unit_assert_spy_called.rb
flexmock-2.3.5 lib/flexmock/test_unit_assert_spy_called.rb
flexmock-2.3.4 lib/flexmock/test_unit_assert_spy_called.rb
flexmock-2.3.3 lib/flexmock/test_unit_assert_spy_called.rb
flexmock-2.3.2 lib/flexmock/test_unit_assert_spy_called.rb
flexmock-2.3.1 lib/flexmock/test_unit_assert_spy_called.rb
flexmock-2.3.0 lib/flexmock/test_unit_assert_spy_called.rb
flexmock-2.2.1 lib/flexmock/test_unit_assert_spy_called.rb
flexmock-2.2.0 lib/flexmock/test_unit_assert_spy_called.rb
flexmock-2.1.0 lib/flexmock/test_unit_assert_spy_called.rb
flexmock-2.0.6 lib/flexmock/test_unit_assert_spy_called.rb
flexmock-2.0.5 lib/flexmock/test_unit_assert_spy_called.rb
flexmock-2.0.4 lib/flexmock/test_unit_assert_spy_called.rb
flexmock-2.0.3 lib/flexmock/test_unit_assert_spy_called.rb
flexmock-2.0.2 lib/flexmock/test_unit_assert_spy_called.rb
flexmock-2.0.1 lib/flexmock/test_unit_assert_spy_called.rb