spec/lib/query/combination_spec.rb in picky-3.6.4 vs spec/lib/query/combination_spec.rb in picky-3.6.6
- old
+ new
@@ -5,11 +5,14 @@
describe Picky::Query::Combination do
before(:each) do
@bundle = stub :bundle, :identifier => :bundle_name
@token = Picky::Query::Token.processed('some_text~', 'Some Original~')
- @category = stub :category, :bundle_for => @bundle, :name => :some_category_name
+ @category = stub :category,
+ :bundle_for => @bundle,
+ :name => :some_category_name,
+ :identifier => 'some_category_identifier'
@combination = described_class.new @token, @category
end
describe "to_s" do
@@ -20,11 +23,11 @@
end
end
describe 'hash' do
it 'should hash the token and the bundle' do
- @combination.hash.should == [@token.to_s, @bundle].hash
+ @combination.hash.should == [@token.to_s, @category].hash
end
end
describe 'to_result' do
context 'functional with qualifier' do
@@ -50,34 +53,34 @@
end
end
describe 'ids' do
it 'should call ids with the text on bundle' do
- @bundle.should_receive(:ids).once.with 'some_text'
+ @category.should_receive(:ids).once.with @token
@combination.ids
end
it 'should not call it twice, but cache' do
- @bundle.stub! :ids => :some_ids
+ @category.stub! :ids => :some_ids
@combination.ids
- @bundle.should_receive(:ids).never
+ @category.should_receive(:ids).never
@combination.ids.should == :some_ids
end
end
describe 'weight' do
it 'should call weight with the text on bundle' do
- @bundle.should_receive(:weight).once.with 'some_text'
+ @category.should_receive(:weight).once.with @token
@combination.weight
end
it 'should not call it twice, but cache' do
- @bundle.stub! :weight => :some_weight
+ @category.stub! :weight => :some_weight
@combination.weight
- @bundle.should_receive(:weight).never
+ @category.should_receive(:weight).never
@combination.weight.should == :some_weight
end
end
\ No newline at end of file