Sha256: d0da1726c47087eca1fb702fe25acb8a13c35c44efde9fd68b42fe12fed336f2

Contents?: true

Size: 538 Bytes

Versions: 1

Compression:

Stored size: 538 Bytes

Contents

module Bogus
  class CreatesAnonymousStubs
    extend Bogus::Takes

    takes :creates_fakes, :create_stub

    def create(methods = {})
      object = RespondsToEverything.new
      methods.each do |name, result|
        create_stub.call(object).__send__(name) { result }
      end
      object
    end

    class RespondsToEverything
      include RecordInteractions

      def respond_to?(method)
        true
      end

      def method_missing(name, *args, &block)
        __record__(name, *args, &block)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bogus-0.0.2 lib/bogus/creates_anonymous_stubs.rb