Module: RSpec::Support::FuzzyMatcher

### Home Classes Methods

### In Files

- lib/rspec/support/fuzzy_matcher.rb

### Methods

- ::values_match?

### Class/Module Index

Quicksearch

- RSpec
- RSpec::CallerFilter
- RSpec::Support
- RSpec::Support::BlockSignature
- RSpec::Support::Differ
- RSpec::Support::DirectoryMaker
- RSpec::Support::EncodedString
- RSpec::Support::FormattingSupport
- RSpec::Support::FuzzyMatcher
- RSpec::Support::HunkGenerator
- RSpec::Support::InSubProcess
- RSpec::Support::LooseSignatureVerifier
- RSpec::Support::LooseSignatureVerifier::SignatureWithKeywordArgumentsMatcher
- RSpec::Support::MethodSignature
- RSpec::Support::MethodSignatureVerifier
- RSpec::Support::OS
- RSpec::Support::ObjectFormatter
- RSpec::Support::RecursiveConstMethods
- RSpec::Support::Ruby
- RSpec::Support::RubyFeatures
- RSpec::Support::ShellOut
- RSpec::Support::Spec
- RSpec::Support::StdErrSplitter
- RSpec::Support::StrictSignatureVerifier
- RSpec::Support::Version
- RSpec::Support::VersionChecker
- RSpec::Support::Warnings
- RSpec::Support::WithIsolatedStdErr
- Object
- RSpecHelpers

No matching classes.

# RSpec::Support::FuzzyMatcher

Provides a means to fuzzy-match between two arbitrary objects. Understands array/hash nesting. Uses `===` or `==` to perform the matching.

### Public Class Methods

values_match?(expected, actual) click to toggle source

@api private

    # File lib/rspec/support/fuzzy_matcher.rb, line 8
    def self.values_match?(expected, actual)
      if Hash === actual
        return hashes_match?(expected, actual) if Hash === expected
      elsif Array === expected && Enumerable === actual && !(Struct === actual)
        return arrays_match?(expected, actual.to_a)
      end

      return true if expected == actual

      begin
        expected === actual
      rescue ArgumentError
        # Some objects, like 0-arg lambdas on 1.9+, raise
        # ArgumentError for `expected === actual`.
        false
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.