Sha256: 747e51fbbd0ca34962f16e07113e6f1bbd96c2559dcbb64a5f5473c64517db24

Contents?: true

Size: 1.19 KB

Versions: 15

Compression:

Stored size: 1.19 KB

Contents

# encoding: utf-8
#
require 'spec_helper'

# Not loaded by default.
#
require File.expand_path '../../../lib/picky/analytics', __FILE__

describe Picky::Analytics do

  attr_reader :index1, :index2

  Item = Struct.new :id, :text

  before(:all) do
    @index1 = Picky::Index.new :index1 do
      source [
        Item.new(1, 'test one'),
        Item.new(2, 'test two'),
      ]
      category :text
    end
    @index1.index
    @index1

    @index2 = Picky::Index.new :index2 do
      source [
        Item.new(3, 'test three'),
        Item.new(4, 'test four'),
      ]
      category :text
    end
    @index2.index
    @index2
  end

  let(:analytics) { described_class.new index1, index2 }

  it 'can be initialized' do
    analytics # La-zee
  end

  it 'saves the indexes' do
    analytics.indexes.should be_kind_of(Picky::Indexes)
  end

  describe 'tokens' do
    it 'offers the method' do
      analytics.tokens
    end
    it 'calculates the number of tokens correctly' do
      analytics.tokens.should == 24
    end
  end

  describe 'ids' do
    it 'offers the method' do
      analytics.ids
    end
    it 'calculates the number of ids correctly' do
      analytics.ids.should == 32
    end
  end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
picky-4.0.0pre1 spec/lib/analytics_spec.rb
picky-3.6.16 spec/lib/analytics_spec.rb
picky-3.6.15 spec/lib/analytics_spec.rb
picky-3.6.14 spec/lib/analytics_spec.rb
picky-3.6.13 spec/lib/analytics_spec.rb
picky-3.6.12 spec/lib/analytics_spec.rb
picky-3.6.11 spec/lib/analytics_spec.rb
picky-3.6.10 spec/lib/analytics_spec.rb
picky-3.6.9 spec/lib/analytics_spec.rb
picky-3.6.8 spec/lib/analytics_spec.rb
picky-3.6.7 spec/lib/analytics_spec.rb
picky-3.6.6 spec/lib/analytics_spec.rb
picky-3.6.4 spec/lib/analytics_spec.rb
picky-3.6.3 spec/lib/analytics_spec.rb
picky-3.6.2 spec/lib/analytics_spec.rb