Sha256: 850135c444ce3347c0d21966bf9e52650b19207305710bb990d99b1807eb98f0

Contents?: true

Size: 975 Bytes

Versions: 8

Compression:

Stored size: 975 Bytes

Contents

module RSpec
  module Matchers
    module BuiltIn
      # @api private
      # Provides the implementation for `satisfy`.
      # Not intended to be instantiated directly.
      class Satisfy
        include Composable

        def initialize(&block)
          @block = block
        end

        # @private
        def matches?(actual, &block)
          @block = block if block
          @actual = actual
          @block.call(actual)
        end

        # @api private
        # @return [String]
        def failure_message
          "expected #{@actual} to satisfy block"
        end

        # @api private
        # @return [String]
        def failure_message_when_negated
          "expected #{@actual} not to satisfy block"
        end

        # @api private
        # @return [String]
        def description
          "satisfy block"
        end

        # @private
        def supports_block_expectations?
          false
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
rspec-expectations-3.0.4 lib/rspec/matchers/built_in/satisfy.rb
rspec-expectations-3.0.3 lib/rspec/matchers/built_in/satisfy.rb
rspec-expectations-3.0.2 lib/rspec/matchers/built_in/satisfy.rb
whos_dated_who-0.1.0 vendor/bundle/gems/rspec-expectations-3.0.1/lib/rspec/matchers/built_in/satisfy.rb
whos_dated_who-0.0.1 vendor/bundle/gems/rspec-expectations-3.0.1/lib/rspec/matchers/built_in/satisfy.rb
rspec-expectations-3.0.1 lib/rspec/matchers/built_in/satisfy.rb
rspec-expectations-3.0.0 lib/rspec/matchers/built_in/satisfy.rb
rspec-expectations-3.0.0.rc1 lib/rspec/matchers/built_in/satisfy.rb