Sha256: 082c0bec1157b743a474b9f96bfb71a547f2c711b57c57908f9e23813ada1162

Contents?: true

Size: 710 Bytes

Versions: 6

Compression:

Stored size: 710 Bytes

Contents

module Shoulda
  module Matchers
    module Doublespeak
      # @private
      class StubImplementation
        DoubleImplementationRegistry.register(self, :stub)

        def self.create
          new
        end

        def initialize
          @implementation = proc { nil }
        end

        def returns(value = nil, &block)
          if block
            @implementation = block
          else
            @implementation = proc { value }
          end
        end

        def call(double, object, args, block)
          double.record_call(args, block)
          implementation.call(object, args, block)
        end

        protected

        attr_reader :implementation
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/shoulda-matchers-2.8.0/lib/shoulda/matchers/doublespeak/stub_implementation.rb
shoulda-matchers-2.8.0 lib/shoulda/matchers/doublespeak/stub_implementation.rb
shoulda-matchers-2.8.0.rc2 lib/shoulda/matchers/doublespeak/stub_implementation.rb
shoulda-matchers-2.8.0.rc1 lib/shoulda/matchers/doublespeak/stub_implementation.rb
shoulda-matchers-2.7.0 lib/shoulda/matchers/doublespeak/stub_implementation.rb
shoulda-matchers-2.6.2 lib/shoulda/matchers/doublespeak/stub_implementation.rb