spec/lib/query/combination_spec.rb in picky-1.4.1 vs spec/lib/query/combination_spec.rb in picky-1.4.2
- old
+ new
@@ -4,14 +4,14 @@
describe 'Query::Combination' do
before(:each) do
@bundle = stub :bundle, :identifier => :bundle_name
- @token = stub :token, :text => :some_text, :partial => false, :similar? => true
+ @token = Internals::Query::Token.processed('some_text~')
@category = stub :category, :bundle_for => @bundle, :name => :some_category_name
- @combination = Query::Combination.new @token, @category
+ @combination = Internals::Query::Combination.new @token, @category
end
describe "to_s" do
it "shows the combination's info" do
@token.stub! :to_result => :token_result
@@ -39,35 +39,34 @@
end
describe 'to_result' do
context 'functional with qualifier' do
before(:each) do
- token = Tokenizers::Query.new.tokenize('name:Blä~').first
+ token = Internals::Tokenizers::Query.new.tokenize('name:Blä~').first
- @combination = Query::Combination.new token, @category
+ @combination = Internals::Query::Combination.new token, @category
end
it 'should return a correct result' do
@combination.to_result.should == [:some_category_name, 'Blä~', :blä] # Note: Characters not substituted. That's ok.
end
end
it 'should return a correct result' do
@token.stub! :to_result => [:some_original_text, :some_text]
- @combination.stub! :identifier => :some_identifier
- @combination.to_result.should == [:some_identifier, :some_original_text, :some_text]
+ @combination.to_result.should == [:some_category_name, :some_original_text, :some_text]
end
end
describe 'identifier' do
it 'should get the category name from the bundle' do
- @combination.identifier.should == :some_category_name
+ @combination.identifier.should == "bundle_name:similarity:some_text"
end
end
describe 'ids' do
it 'should call ids with the text on bundle' do
- @bundle.should_receive(:ids).once.with :some_text
+ @bundle.should_receive(:ids).once.with 'some_text'
@combination.ids
end
it 'should not call it twice, but cache' do
@bundle.stub! :ids => :some_ids
@@ -79,10 +78,10 @@
end
end
describe 'weight' do
it 'should call weight with the text on bundle' do
- @bundle.should_receive(:weight).once.with :some_text
+ @bundle.should_receive(:weight).once.with 'some_text'
@combination.weight
end
it 'should not call it twice, but cache' do
@bundle.stub! :weight => :some_weight
\ No newline at end of file