forked from seatgeek/soulmate
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Redis dependency in Gemfile. Start and stop Redis instance in R…
…akefile for test. Simple integration test to demonstrate loading and query.
- Loading branch information
David Czarnecki
committed
Feb 15, 2011
1 parent
b497420
commit a596eb5
Showing
7 changed files
with
69 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,5 @@ group :development do | |
gem "jeweler", "~> 1.5.2" | ||
gem "rcov", ">= 0" | ||
end | ||
|
||
gem 'redis', "~> 2.1.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{"id":1,"term":"Dodger Stadium","score":85,"data":{"url":"\/dodger-stadium-tickets\/","subtitle":"Los Angeles, CA"}} | ||
{"id":28,"term":"Angel Stadium","score":85,"data":{"url":"\/angel-stadium-tickets\/","subtitle":"Anaheim, CA"}} | ||
{"id":30,"term":"Chase Field ","score":85,"data":{"url":"\/chase-field-tickets\/","subtitle":"Phoenix, AZ"}} | ||
{"id":29,"term":"Sun Life Stadium","score":84,"data":{"url":"\/sun-life-stadium-tickets\/","subtitle":"Miami, FL"}} | ||
{"id":2,"term":"Turner Field","score":83,"data":{"url":"\/turner-field-tickets\/","subtitle":"Atlanta, GA"}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
dir ./test/db | ||
pidfile ./redis.pid | ||
port 6379 | ||
timeout 300 | ||
loglevel debug | ||
logfile stdout | ||
databases 16 | ||
daemonize yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,19 @@ | ||
require 'helper' | ||
|
||
class TestSoulmate < Test::Unit::TestCase | ||
should "probably rename this file and start testing for real" do | ||
flunk "hey buddy, you should probably rename this file and start testing for real" | ||
def test_integration_can_load_values_and_query | ||
items = [] | ||
venues = File.open(File.expand_path(File.dirname(__FILE__)) + '/samples/venues.json', "r") | ||
venues.each_line do |venue| | ||
items << JSON.parse(venue) | ||
end | ||
|
||
Soulmate::Loader.new('venues').load(items) | ||
|
||
matcher = Soulmate::Matcher.new('venues') | ||
results = matcher.matches_for_term('stad', :limit => 5) | ||
|
||
assert_equal 3, results.size | ||
assert_equal 'Angel Stadium', results[0]['term'] | ||
end | ||
end |