Sha256: 84bf46012b2fcdfc6787e318e62c4c1bc3a6633910b32051b084383c96955058
Contents?: true
Size: 1.51 KB
Versions: 6
Compression:
Stored size: 1.51 KB
Contents
# coding: utf-8 # require 'spec_helper' describe Picky::Query::Combinations do before(:each) do @combinations_ary = stub :combinations_ary @combinations = described_class.new @combinations_ary end describe "to_result" do before(:each) do @combination1 = stub :combination1, :to_result => :result1 @combination2 = stub :combination2, :to_result => :result2 @combinations_ary = [@combination1, @combination2] @combinations = described_class.new @combinations_ary end it "resultifies the combinations" do @combinations.to_result.should == [:result1, :result2] end end describe "total_score" do before(:each) do @combination1 = stub :combination1, :weight => 3.14 @combination2 = stub :combination2, :weight => 2.76 @combinations_ary = [@combination1, @combination2] @combinations = described_class.new @combinations_ary end it "sums the scores" do @combinations.score.should == 5.90 end end describe 'remove' do before(:each) do @combination1 = stub :combination1, :category => stub(:other, :name => :other) @combination2 = stub :combination2, :category => stub(:to_remove, :name => :to_remove) @combination3 = stub :combination3, :category => stub(:to_remove, :name => :to_remove) @combinations = described_class.new [@combination1, @combination2, @combination3] end it 'should remove the combinations' do @combinations.remove([:to_remove]).should == [@combination1] end end end
Version data entries
6 entries across 6 versions & 1 rubygems