/
integration_spec.rb
42 lines (35 loc) · 954 Bytes
/
integration_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# coding: utf-8
#
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
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