Sha256: bcf4904fbd70a35dac33baaa389b39fda96c1f621c2b12bceaed938a4aaaf956

Contents?: true

Size: 1.22 KB

Versions: 1730

Compression:

Stored size: 1.22 KB

Contents

module RSpec
  module Expectations
    class << self
      # @private
      class Differ
        # @private
        OBJECT_PREPARER = lambda do |object|
          RSpec::Matchers::Composable.surface_descriptions_in(object)
        end
      end

      # @private
      def differ
        RSpec::Support::Differ.new(
          :object_preparer => Differ::OBJECT_PREPARER,
          :color => RSpec::Matchers.configuration.color?
        )
      end

      # Raises an RSpec::Expectations::ExpectationNotMetError with message.
      # @param [String] message
      # @param [Object] expected
      # @param [Object] actual
      #
      # Adds a diff to the failure message when `expected` and `actual` are
      # both present.
      def fail_with(message, expected=nil, actual=nil)
        unless message
          raise ArgumentError, "Failure message is nil. Does your matcher define the " \
                               "appropriate failure_message[_when_negated] method to return a string?"
        end

        message = ::RSpec::Matchers::MultiMatcherDiff.from(expected, actual).message_with_diff(message, differ)

        RSpec::Support.notify_failure(RSpec::Expectations::ExpectationNotMetError.new message)
      end
    end
  end
end

Version data entries

1,730 entries across 1,730 versions & 14 rubygems

Version Path
cybrid_api_bank_ruby-0.123.12 vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.3/lib/rspec/expectations/fail_with.rb
cybrid_api_organization_ruby-0.123.12 vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.3/lib/rspec/expectations/fail_with.rb
cybrid_api_id_ruby-0.123.12 vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.3/lib/rspec/expectations/fail_with.rb
cybrid_api_bank_ruby-0.123.11 vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.3/lib/rspec/expectations/fail_with.rb
cybrid_api_organization_ruby-0.123.11 vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.3/lib/rspec/expectations/fail_with.rb
cybrid_api_id_ruby-0.123.11 vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.3/lib/rspec/expectations/fail_with.rb
cybrid_api_id_ruby-0.123.10 vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.3/lib/rspec/expectations/fail_with.rb
cybrid_api_bank_ruby-0.123.10 vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.3/lib/rspec/expectations/fail_with.rb
cybrid_api_organization_ruby-0.123.10 vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.3/lib/rspec/expectations/fail_with.rb
cybrid_api_organization_ruby-0.123.7 vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.3/lib/rspec/expectations/fail_with.rb
cybrid_api_id_ruby-0.123.7 vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.3/lib/rspec/expectations/fail_with.rb
cybrid_api_bank_ruby-0.123.7 vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.3/lib/rspec/expectations/fail_with.rb
ory-client-1.15.12 vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.13.3/lib/rspec/expectations/fail_with.rb
cybrid_api_bank_ruby-0.123.4 vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.3/lib/rspec/expectations/fail_with.rb
cybrid_api_id_ruby-0.123.4 vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.3/lib/rspec/expectations/fail_with.rb
cybrid_api_organization_ruby-0.123.4 vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.3/lib/rspec/expectations/fail_with.rb
cybrid_api_bank_ruby-0.123.3 vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.3/lib/rspec/expectations/fail_with.rb
cybrid_api_organization_ruby-0.123.3 vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.3/lib/rspec/expectations/fail_with.rb
cybrid_api_id_ruby-0.123.3 vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.3/lib/rspec/expectations/fail_with.rb
cybrid_api_id_ruby-0.123.2 vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.3/lib/rspec/expectations/fail_with.rb