Sha256: e5ffcce049d05cf72f96c22f70d141d85e0fd42eb5586a38a6e5e7c4cf02000a

Contents?: true

Size: 670 Bytes

Versions: 16

Compression:

Stored size: 670 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(call)
          call.double.record_call(call)
          implementation.call(call)
        end

        protected

        attr_reader :implementation
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
shoulda-matchers-4.4.1 lib/shoulda/matchers/doublespeak/stub_implementation.rb
shoulda-matchers-4.4.0 lib/shoulda/matchers/doublespeak/stub_implementation.rb
shoulda-matchers-4.3.0 lib/shoulda/matchers/doublespeak/stub_implementation.rb
shoulda-matchers-4.2.0 lib/shoulda/matchers/doublespeak/stub_implementation.rb
shoulda-matchers-4.1.2 lib/shoulda/matchers/doublespeak/stub_implementation.rb
shoulda-matchers-4.1.1 lib/shoulda/matchers/doublespeak/stub_implementation.rb
shoulda-matchers-4.1.0 lib/shoulda/matchers/doublespeak/stub_implementation.rb
shoulda-matchers-4.0.1 lib/shoulda/matchers/doublespeak/stub_implementation.rb
shoulda-matchers-3.1.3 lib/shoulda/matchers/doublespeak/stub_implementation.rb
shoulda-matchers-4.0.0.rc1 lib/shoulda/matchers/doublespeak/stub_implementation.rb
shoulda-matchers-3.1.2 lib/shoulda/matchers/doublespeak/stub_implementation.rb
shoulda-matchers-3.1.1 lib/shoulda/matchers/doublespeak/stub_implementation.rb
shoulda-matchers-3.1.0 lib/shoulda/matchers/doublespeak/stub_implementation.rb
shoulda-matchers-3.0.1 lib/shoulda/matchers/doublespeak/stub_implementation.rb
shoulda-matchers-3.0.0 lib/shoulda/matchers/doublespeak/stub_implementation.rb
shoulda-matchers-3.0.0.rc1 lib/shoulda/matchers/doublespeak/stub_implementation.rb