Sha256: d71d3fb0475e75ab5ca2c27bbad27f5570f8f1dbb570f31e335393e9aa682a21

Contents?: true

Size: 1.17 KB

Versions: 111

Compression:

Stored size: 1.17 KB

Contents

# encoding: utf-8
#
require 'spec_helper'

# Not loaded by default.
#
require_relative '../../lib/picky/analytics'

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

111 entries across 111 versions & 1 rubygems

Version Path
picky-4.5.5 spec/lib/analytics_spec.rb
picky-4.5.4 spec/lib/analytics_spec.rb
picky-4.5.3 spec/lib/analytics_spec.rb
picky-4.5.2 spec/lib/analytics_spec.rb
picky-4.5.1 spec/lib/analytics_spec.rb
picky-4.5.0 spec/lib/analytics_spec.rb
picky-4.4.2 spec/lib/analytics_spec.rb
picky-4.4.1 spec/lib/analytics_spec.rb
picky-4.4.0 spec/lib/analytics_spec.rb
picky-4.3.2 spec/lib/analytics_spec.rb
picky-4.3.1 spec/lib/analytics_spec.rb
picky-4.3.0 spec/lib/analytics_spec.rb
picky-4.2.4 spec/lib/analytics_spec.rb
picky-4.2.3 spec/lib/analytics_spec.rb
picky-4.2.2 spec/lib/analytics_spec.rb
picky-4.2.1 spec/lib/analytics_spec.rb
picky-4.2.0 spec/lib/analytics_spec.rb
picky-4.1.0 spec/lib/analytics_spec.rb
picky-4.0.9 spec/lib/analytics_spec.rb
picky-4.0.8 spec/lib/analytics_spec.rb