Sha256: 7ff4d8fe0b6bd1ad1cc64d9e31168a206f82643d23e0877b7dc95df3166a7b3a

Contents?: true

Size: 1 KB

Versions: 5

Compression:

Stored size: 1 KB

Contents

# coding: utf-8

require 'spec_helper'

module Soulmate
  describe Matcher do
    before :each do
      items = []
      loader = Loader.new('venues')
      venues = File.open(TestRoot + '/samples/venues.json', 'r')
      venues.each_line do |venue|
        items << MultiJson.decode(venue)
      end
      loader.load(items)

      @matcher = Matcher.new('venues')
    end

    it 'should successfully return matches for given term' do
      results = @matcher.matches_for_term('stad')
      results.size.should eq(5)
      results.first['term'].should eq('Citi Field')
    end

    it 'should successfully return matches with aliases' do
      results = @matcher.matches_for_term('land shark stadium')
      results.size.should eq(1)
      results.first['term'].should eq('Sun Life Stadium')
    end

    it 'should successfully return matches with chinese' do
      results = @matcher.matches_for_term('中国')
      results.size.should eq(1)
      results.first['term'].should eq('中国佛山 李小龙')
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
soulmate_rails-0.3.1 spec/soulmate/matcher_spec.rb
soulmate_rails-0.3.0 spec/soulmate/matcher_spec.rb
soulmate_rails-0.2.1 spec/soulmate/matcher_spec.rb
soulmate_rails-0.2.1.beta spec/soulmate/matcher_spec.rb
soulmate_rails-0.2.0.alpha spec/soulmate/matcher_spec.rb