Sha256: 6bd8a7f7c4c7d564fdb08ae076f08840e956d35f20516312758b401555211041

Contents?: true

Size: 743 Bytes

Versions: 5

Compression:

Stored size: 743 Bytes

Contents

require 'helper'

describe FuzzyMatch::Wrapper do
  it %{does not treat "'s" as a word} do
    assert_split ["foo's", "bar"], "Foo's Bar"
  end
  
  it %{treats "bolivia," as just "bolivia"} do
    assert_split ["bolivia", "plurinational", "state"], "Bolivia, Plurinational State"
  end
  
  it %{does not split up hyphenated words} do
    assert_split ['north-west'], "north-west"
  end
  
  it %{splits up words as expected} do
    assert_split ['the', 'quick', "fox's", 'mouth', 'is', 'always', 'full'], "the quick fox's mouth -- is always full."
  end
  
  private
  
  def assert_split(ary, str)
    FuzzyMatch::Wrapper.new(null_fuzzy_match, str, true).words.must_equal ary
  end
  
  def null_fuzzy_match
    FuzzyMatch.new []
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fuzzy_match-1.5.0 test/test_wrapper.rb
fuzzy_match-1.4.1 test/test_wrapper.rb
fuzzy_match-1.4.0 test/test_wrapper.rb
fuzzy_match-1.3.3 test/test_wrapper.rb
fuzzy_match-1.3.2 test/test_wrapper.rb