spec/lib/cacher/partial/subtoken_spec.rb in picky-0.9.1 vs spec/lib/cacher/partial/subtoken_spec.rb in picky-0.9.2

- old
+ new

@@ -11,68 +11,68 @@ @cacher.from.should == 1 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], - :flo => [1], - :fl => [1, 2], - :f => [1, 2], - :flavia => [2], - :flavi => [2], - :flav => [2], - :fla => [2] + @cacher.generate_from(florian: [1], flavia: [2]).should == { + florian: [1], + floria: [1], + flori: [1], + flor: [1], + flo: [1], + fl: [1, 2], + f: [1, 2], + flavia: [2], + flavi: [2], + flav: [2], + fla: [2] } end it "should be fast" do - performance_of { @cacher.generate_from( :florian => [1], :flavia => [2] ) }.should < 0.0001 + performance_of { @cacher.generate_from(florian: [1], flavia: [2]) }.should < 0.0001 end it "should handle duplicate ids" do - @cacher.generate_from( :flo => [1], :fla => [1] ).should == { - :flo => [1], - :fl => [1], - :f => [1], - :fla => [1] + @cacher.generate_from(flo: [1], fla: [1]).should == { + flo: [1], + fl: [1], + f: [1], + fla: [1] } end end end context 'from set' do describe 'negative from' do before(:each) do - @cacher = Cacher::Partial::Substring.new :from => -2 + @cacher = Cacher::Partial::Substring.new from: -2 end it 'should generate the right index' do - @cacher.generate_from( :florian => [1], :flavia => [2] ).should == { - :florian => [1], - :floria => [1], - :flavia => [2], - :flavi => [2] + @cacher.generate_from(florian: [1], flavia: [2]).should == { + florian: [1], + floria: [1], + flavia: [2], + flavi: [2] } end end context "large from" do before(:each) do - @cacher = Cacher::Partial::Substring.new :from => 10 + @cacher = Cacher::Partial::Substring.new from: 10 end describe 'generate_from' do it 'should generate the right index' do - @cacher.generate_from( :florian => [1], :'01234567890' => [2] ).should == { + @cacher.generate_from(florian: [1], :'01234567890' => [2] ).should == { :florian => [1], :'01234567890' => [2], :'0123456789' => [2] } end end end context 'default to' do before(:each) do - @cacher = Cacher::Partial::Substring.new :from => 4 + @cacher = Cacher::Partial::Substring.new from: 4 end describe 'to' do it 'should return the right value' do @cacher.to.should == -1 end @@ -122,11 +122,11 @@ end end end context 'to set' do before(:each) do - @cacher = Cacher::Partial::Substring.new :from => 4, :to => -2 + @cacher = Cacher::Partial::Substring.new from: 4, to: -2 end describe 'to' do it 'should return the right value' do @cacher.to.should == -2 end @@ -148,10 +148,10 @@ end end end context 'to set' do before(:each) do - @cacher = Cacher::Partial::Substring.new :from => 4, :to => 0 + @cacher = Cacher::Partial::Substring.new from: 4, to: 0 end describe 'to' do it 'should return the right value' do @cacher.to.should == 0 end \ No newline at end of file