Skip to content

Commit

Permalink
+ test project integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
floere committed Oct 25, 2010
1 parent b9ee3ba commit 8da4e2a
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 28 deletions.
2 changes: 1 addition & 1 deletion server/test_project/spec/app/application_spec.rb
@@ -1,5 +1,5 @@
# coding: utf-8
require File.join File.dirname(__FILE__), '/../spec_helper'
require 'spec_helper'

describe "BookSearch" do

Expand Down
62 changes: 35 additions & 27 deletions server/test_project/spec/integration_spec.rb
@@ -1,34 +1,42 @@
# coding: utf-8
#
require File.expand_path '../spec_helper', __FILE__
require 'spec_helper'

describe "Cases" do

# # 1. Load data into db.
# # 2. Index the data in the db.
# # 3. Cache it, and load into memory.
# #
# before(:all) do
# `cat data/generate_test_db.sql | sqlite3 data/test.db`
# Indexes.index
# Indexes.load_from_cache
# end
#
# def self.it_should_find_ids_in_main_full text, expected_ids
# it 'should return the right ids' do
# @full.search_with_text(text).ids.should == expected_ids
# end
# end
# def ids_of results
# results.serialize[:allocations].inject([]) { |ids, allocation| ids + allocation[4] }
# end
#
# before(:each) do
# @full = Query::Full.new Indexes[:main]
# end
#
# describe 'description' do
# it_should_find_ids_in_main_full 'Soledad', [1]
# end
# 1. Load data into db.
# 2. Index the data in the db.
# 3. Cache it, and load into memory.
#
before(:all) do
Indexes.load_from_cache
end
before(:each) do
@full = Query::Full.new Indexes[:csv_test]
end

def self.it_should_find_ids_in_main_full text, expected_ids
it 'should return the right ids' do
@full.search_with_text(text).ids.should == expected_ids
end
end
def ids_of results
results.serialize[:allocations].inject([]) { |ids, allocation| ids + allocation[4] }
end

describe 'test cases' do
# Standard
#
it_should_find_ids_in_main_full 'Soledad Human', [72]
it_should_find_ids_in_main_full 'First Three Minutes Weinberg', [1]

# Partial
#
it_should_find_ids_in_main_full 'Gover* Systems', [7]

# Similarity
#
it_should_find_ids_in_main_full 'Hystori~ Leeward', [4, 4]
end

end

0 comments on commit 8da4e2a

Please sign in to comment.