spec/lib/application_spec.rb in picky-0.11.2 vs spec/lib/application_spec.rb in picky-0.12.0
- old
+ new
@@ -7,11 +7,11 @@
describe "integration" do
it "should run ok" do
lambda {
class MinimalTestApplication < Application
books = index :books, Sources::DB.new('SELECT id, title FROM books', :file => 'app/db.yml')
- books.category :title
+ books.define_category :title
full = Query::Full.new books
live = Query::Live.new books
@@ -26,27 +26,29 @@
lambda {
# TODO Add all possible cases.
#
class TestApplication < Application
default_indexing removes_characters: /[^a-zA-Z0-9\s\/\-\"\&\.]/,
- contracts_expressions: [/mr\.\s*|mister\s*/i, 'mr '],
stopwords: /\b(and|the|of|it|in|for)\b/,
splits_text_on: /[\s\/\-\"\&\.]/,
removes_characters_after_splitting: /[\.]/
default_querying removes_characters: /[^a-zA-Z0-9äöü\s\/\-\,\&\"\~\*\:]/,
stopwords: /\b(and|the|of|it|in|for)\b/,
splits_text_on: /[\s\/\-\,\&]+/,
normalizes_words: [[/Deoxyribonucleic Acid/i, 'DNA']],
- substitutes_characters_with: CharacterSubstitution::European.new,
- maximum_tokens: 5
+ substitutes_characters_with: CharacterSubstituters::WestEuropean.new,
+ maximum_tokens: 5
- books_index = index :books, Sources::DB.new('SELECT id, title, author, isbn13 as isbn FROM books', :file => 'app/db.yml')
- books_index.category :title, similarity: Similarity::DoubleLevenshtone.new(3) # Up to three similar title word indexed.
- books_index.category :author
- books_index.category :isbn, partial: Partial::None.new # Partially searching on an ISBN makes not much sense.
+ books_index = index :books,
+ Sources::DB.new('SELECT id, title, author, isbn13 as isbn FROM books', :file => 'app/db.yml')
+ books_index.define_category :title,
+ similarity: Similarity::DoubleLevenshtone.new(3) # Up to three similar title word indexed.
+ books_index.define_category :author
+ books_index.define_category :isbn,
+ partial: Partial::None.new # Partially searching on an ISBN makes not much sense.
full = Query::Full.new books_index
live = Query::Live.new books_index
route %r{^/books/full} => full
@@ -83,39 +85,9 @@
end
it 'should delegate' do
@routes.should_receive(:call).once.with :env
Application.call :env
- end
- end
-
- describe "indexes" do
-
- end
- describe "indexing" do
- it 'should be there' do
- lambda { Application.indexing }.should_not raise_error
- end
- it "should return a new Routing instance" do
- Application.indexing.should be_kind_of(Configuration::Indexes)
- end
- it "should cache the instance" do
- Application.indexing.should == Application.indexing
- end
- end
-
- describe "queries" do
-
- end
- describe "querying" do
- it 'should be there' do
- lambda { Application.querying }.should_not raise_error
- end
- it "should return a new Routing instance" do
- Application.querying.should be_kind_of(Configuration::Queries)
- end
- it "should cache the instance" do
- Application.querying.should == Application.querying
end
end
end
\ No newline at end of file