Sha256: c5cbb1e36f5f6571567e0e755244721cf60dfa4a5191a3a0de8f13c059c2362a

Contents?: true

Size: 485 Bytes

Versions: 1

Compression:

Stored size: 485 Bytes

Contents

# frozen_string_literal: true

module RSpec::ResemblesJsonMatchers
  class ResemblesStringMatcher
    def self.can_match?(string)
      string.is_a? String
    end

    attr_reader :expected

    def initialize(expected)
      @expected = expected
    end

    def description
      "resemble text #{@expected.inspect}"
    end

    # TODO make sure the lengths are kinda the same? Levenschtien distances?
    def matches?(actual)
      self.class.can_match?(actual)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rspec-resembles_json_matchers-0.9.1 lib/rspec/resembles_json_matchers/resembles_string_matcher.rb