spec/lib/generators/weights/logarithmic_spec.rb in picky-3.5.0 vs spec/lib/generators/weights/logarithmic_spec.rb in picky-3.5.1

- old
+ new

@@ -1,30 +1,25 @@ require 'spec_helper' describe Picky::Generators::Weights::Logarithmic do - before(:each) do - @cacher = described_class.new - end + let(:logarithmic) { described_class.new } - describe 'generate_from' do - it 'should not fail on empties' do - @cacher.generate_from({ :key => [] }).should == { :key => 0 } + describe 'saved?' do + it 'is correct' do + logarithmic.saved?.should == true end - it 'should round to 2' do - @cacher.generate_from({ :key => [1,2,3,4] }).should == { :key => 1.39 } - end end describe 'weight_for' do - it 'should be 0 for 0' do - @cacher.weight_for(0).should == 0 + it 'is 0 for 0' do + logarithmic.weight_for(0).should == 0 end - it 'should be 0 for 1' do - @cacher.weight_for(1).should == 0 + it 'is 0 for 1' do + logarithmic.weight_for(1).should == 0 end - it 'should be log(x) for x' do - @cacher.weight_for(1234).should == Math.log(1234) + it 'is log(x) for x' do + logarithmic.weight_for(1234).should == Math.log(1234) end end end \ No newline at end of file