Sha256: ce396d44c1e9043b436fc960c53e12147b09e4f3c6dc6bec457b64fba424c71e

Contents?: true

Size: 593 Bytes

Versions: 13

Compression:

Stored size: 593 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)
          @implementation = block || proc { value }
        end

        def call(call)
          call.double.record_call(call)
          implementation.call(call)
        end

        protected

        attr_reader :implementation
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
shoulda-matchers-6.4.0 lib/shoulda/matchers/doublespeak/stub_implementation.rb
shoulda-matchers-6.3.1 lib/shoulda/matchers/doublespeak/stub_implementation.rb
shoulda-matchers-6.3.0 lib/shoulda/matchers/doublespeak/stub_implementation.rb
shoulda-matchers-6.2.0 lib/shoulda/matchers/doublespeak/stub_implementation.rb
shoulda-matchers-6.1.0 lib/shoulda/matchers/doublespeak/stub_implementation.rb
shoulda-matchers-6.0.0 lib/shoulda/matchers/doublespeak/stub_implementation.rb
shoulda-matchers-5.3.0 lib/shoulda/matchers/doublespeak/stub_implementation.rb
shoulda-matchers-5.2.0 lib/shoulda/matchers/doublespeak/stub_implementation.rb
shoulda-matchers-5.1.0 lib/shoulda/matchers/doublespeak/stub_implementation.rb
shoulda-matchers-5.0.0 lib/shoulda/matchers/doublespeak/stub_implementation.rb
shoulda-matchers-5.0.0.rc1 lib/shoulda/matchers/doublespeak/stub_implementation.rb
shoulda-matchers-4.5.1 lib/shoulda/matchers/doublespeak/stub_implementation.rb
shoulda-matchers-4.5.0 lib/shoulda/matchers/doublespeak/stub_implementation.rb