Sha256: 2fc2351acd9ffdcae774a9a28c73b1ebe794dac077ec60e4ea26738e7626c895

Contents?: true

Size: 554 Bytes

Versions: 2

Compression:

Stored size: 554 Bytes

Contents

require "ostruct"

module Stubs
  def double(messages={})
    OpenStruct.new(messages)
  end
end

class MiniTest::Mock
  def stub(name, value=nil)
    metaclass = class << self; self; end
    metaclass.send :define_method, name do |*args|
      value
    end
  end

  alias_method :expect_without_stub_support, :expect

  def expect(name, *args)
    metaclass = class << self; self; end
    metaclass.send :undef_method, name if respond_to?(name)
    expect_without_stub_support(name, *args)
  end
end

class MiniTest::Unit::TestCase
  include Stubs
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
azure-0.1.1 test/support/stubs.rb
azure-0.1.0 test/support/stubs.rb