Sha256: 081f50164b2f7c8a08c729b4c90c13f25890c7ced33f10598d918e98f01d36d0

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

require 'spec_helper'

describe Indexing::Bundle::Base do

  before(:each) do
    @configuration = stub :configuration, :identifier => 'some_identifier'
    Backend::Files.stub! :new
    @similarity = Similarity::DoubleMetaphone.new 3
    @bundle = described_class.new :some_name, @configuration, :some_weights, :some_partial, @similarity
  end
  
  describe 'identifier' do
    it 'is correct' do
      @bundle.identifier.should == 'some_identifier:some_name'
    end
  end
  
  describe 'similar' do
    before(:each) do
      @bundle.similarity = @similarity.generate_from( :dragon => [1,2,3], :dargon => [4,5,6] )
    end
    it 'returns the right similars (not itself)' do
      @bundle.similar(:dragon).should == [:dargon]
    end
    it 'returns the right similars' do
      @bundle.similar(:trkn).should == [:dragon, :dargon]
    end
    it 'performs' do
      performance_of { @bundle.similar(:dragon) }.should < 0.000075
    end
    it 'performs' do
      performance_of { @bundle.similar(:trkn) }.should < 0.00006
    end
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
picky-2.7.0 spec/lib/indexing/bundle/base_spec.rb