spec/lib/cacher/partial/subtoken_spec.rb in picky-0.3.0 vs spec/lib/cacher/partial/subtoken_spec.rb in picky-0.9.0

- old
+ new

@@ -120,11 +120,11 @@ it "should be fast" do performance_of { @cacher.generate_from(@index) }.should < 0.0045 end end end - context 'starting_at -1' do + context 'starting_at set' do before(:each) do @cacher = Cacher::Partial::Subtoken.new :down_to => 4, :starting_at => -2 end describe 'starting_at' do it 'should return the right value' do @@ -140,9 +140,37 @@ it 'should generate the right index' do @cacher.generate_from( :florian => [1], :flavia => [2] ).should == { :floria => [1], :flori => [1], :flor => [1], + :flavi => [2], + :flav => [2] + } + end + end + end + context 'starting_at set' do + before(:each) do + @cacher = Cacher::Partial::Subtoken.new :down_to => 4, :starting_at => 0 + end + describe 'starting_at' do + it 'should return the right value' do + @cacher.starting_at.should == 0 + end + end + describe 'down_to' do + it 'should return the right value' do + @cacher.down_to.should == 4 + end + end + describe 'generate_from' do + it 'should generate the right index' do + @cacher.generate_from( :florian => [1], :flavia => [2] ).should == { + :florian => [1], + :floria => [1], + :flori => [1], + :flor => [1], + :flavia => [2], :flavi => [2], :flav => [2] } end end \ No newline at end of file