spec/lib/cacher/partial/subtoken_spec.rb in picky-0.9.0 vs spec/lib/cacher/partial/subtoken_spec.rb in picky-0.9.1
- old
+ new
@@ -1,16 +1,16 @@
require 'spec_helper'
-describe Cacher::Partial::Subtoken do
+describe Cacher::Partial::Substring do
- context 'default down_to' do
+ context 'default from' do
before(:each) do
- @cacher = Cacher::Partial::Subtoken.new
+ @cacher = Cacher::Partial::Substring.new
end
- describe 'down_to' do
+ describe 'from' do
it 'should return the right value' do
- @cacher.down_to.should == 1
+ @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 == {
@@ -38,27 +38,27 @@
:fla => [1]
}
end
end
end
- context 'down_to set' do
- describe 'negative down_to' do
+ context 'from set' do
+ describe 'negative from' do
before(:each) do
- @cacher = Cacher::Partial::Subtoken.new :down_to => -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]
}
end
end
- context "large down_to" do
+ context "large from" do
before(:each) do
- @cacher = Cacher::Partial::Subtoken.new :down_to => 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 == {
:florian => [1],
@@ -66,22 +66,22 @@
:'0123456789' => [2]
}
end
end
end
- context 'default starting_at' do
+ context 'default to' do
before(:each) do
- @cacher = Cacher::Partial::Subtoken.new :down_to => 4
+ @cacher = Cacher::Partial::Substring.new :from => 4
end
- describe 'starting_at' do
+ describe 'to' do
it 'should return the right value' do
- @cacher.starting_at.should == -1
+ @cacher.to.should == -1
end
end
- describe 'down_to' do
+ describe 'from' do
it 'should return the right value' do
- @cacher.down_to.should == 4
+ @cacher.from.should == 4
end
end
describe 'generate_from' do
it 'should generate the right index' do
@cacher.generate_from( :florian => [1], :flavia => [2] ).should == {
@@ -120,22 +120,22 @@
it "should be fast" do
performance_of { @cacher.generate_from(@index) }.should < 0.0045
end
end
end
- context 'starting_at set' do
+ context 'to set' do
before(:each) do
- @cacher = Cacher::Partial::Subtoken.new :down_to => 4, :starting_at => -2
+ @cacher = Cacher::Partial::Substring.new :from => 4, :to => -2
end
- describe 'starting_at' do
+ describe 'to' do
it 'should return the right value' do
- @cacher.starting_at.should == -2
+ @cacher.to.should == -2
end
end
- describe 'down_to' do
+ describe 'from' do
it 'should return the right value' do
- @cacher.down_to.should == 4
+ @cacher.from.should == 4
end
end
describe 'generate_from' do
it 'should generate the right index' do
@cacher.generate_from( :florian => [1], :flavia => [2] ).should == {
@@ -146,21 +146,21 @@
:flav => [2]
}
end
end
end
- context 'starting_at set' do
+ context 'to set' do
before(:each) do
- @cacher = Cacher::Partial::Subtoken.new :down_to => 4, :starting_at => 0
+ @cacher = Cacher::Partial::Substring.new :from => 4, :to => 0
end
- describe 'starting_at' do
+ describe 'to' do
it 'should return the right value' do
- @cacher.starting_at.should == 0
+ @cacher.to.should == 0
end
end
- describe 'down_to' do
+ describe 'from' do
it 'should return the right value' do
- @cacher.down_to.should == 4
+ @cacher.from.should == 4
end
end
describe 'generate_from' do
it 'should generate the right index' do
@cacher.generate_from( :florian => [1], :flavia => [2] ).should == {
\ No newline at end of file