Sha256: 541813e505c1e145c11dbba1bb8ac13b5c873886ac8ffed1564fca56dcac179e

Contents?: true

Size: 746 Bytes

Versions: 2

Compression:

Stored size: 746 Bytes

Contents

require 'helper'

class TestWrapper < MiniTest::Spec
  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

2 entries across 2 versions & 1 rubygems

Version Path
fuzzy_match-1.3.1 test/test_wrapper.rb
fuzzy_match-1.3.0 test/test_wrapper.rb