Sha256: 86f594b797eb7d323e490f80bf56093fd19ac87e88a9bb6450ba705800ad8894

Contents?: true

Size: 872 Bytes

Versions: 33

Compression:

Stored size: 872 Bytes

Contents

module RSpec
  module Matchers
    module BuiltIn
      # @api private
      # Provides the implementation for `satisfy`.
      # Not intended to be instantiated directly.
      class Satisfy < BaseMatcher
        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
      end
    end
  end
end

Version data entries

33 entries across 30 versions & 9 rubygems

Version Path
suzuko-0.1.8 vendor/bundle/ruby/2.0.0/gems/rspec-expectations-3.2.1/lib/rspec/matchers/built_in/satisfy.rb
suzuko-0.1.7 vendor/bundle/ruby/2.0.0/gems/rspec-expectations-3.2.1/lib/rspec/matchers/built_in/satisfy.rb
opal-rspec-0.5.0.beta3 rspec-expectations/lib/rspec/matchers/built_in/satisfy.rb
logstash-input-beats-0.9.2 vendor/jruby/1.9/gems/rspec-expectations-3.1.2/lib/rspec/matchers/built_in/satisfy.rb
logstash-input-beats-0.9.1 vendor/jruby/1.9/gems/rspec-expectations-3.1.2/lib/rspec/matchers/built_in/satisfy.rb
opal-rspec-0.5.0.beta2 rspec-expectations/lib/rspec/matchers/built_in/satisfy.rb
opal-rspec-0.5.0.beta1 rspec-expectations/lib/rspec/matchers/built_in/satisfy.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/rspec-expectations-3.1.2/lib/rspec/matchers/built_in/satisfy.rb
rspec-expectations-3.2.1 lib/rspec/matchers/built_in/satisfy.rb
rspec-expectations-3.2.0 lib/rspec/matchers/built_in/satisfy.rb
rspec-expectations-3.1.2 lib/rspec/matchers/built_in/satisfy.rb
rspec-expectations-3.1.1 lib/rspec/matchers/built_in/satisfy.rb
rspec-expectations-3.1.0 lib/rspec/matchers/built_in/satisfy.rb