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.15.0 spec/lib/analytics_spec.rb
picky-4.14.0 spec/lib/analytics_spec.rb
picky-4.13.1 spec/lib/analytics_spec.rb
picky-4.13.0 spec/lib/analytics_spec.rb
picky-4.12.13 spec/lib/analytics_spec.rb
picky-4.12.12 spec/lib/analytics_spec.rb
picky-4.12.11 spec/lib/analytics_spec.rb
picky-4.12.10 spec/lib/analytics_spec.rb
picky-4.12.8 spec/lib/analytics_spec.rb
picky-4.12.7 spec/lib/analytics_spec.rb
picky-4.12.6 spec/lib/analytics_spec.rb
picky-4.12.5 spec/lib/analytics_spec.rb
picky-4.12.4 spec/lib/analytics_spec.rb
picky-4.12.3 spec/lib/analytics_spec.rb
picky-4.12.2 spec/lib/analytics_spec.rb
picky-4.12.1 spec/lib/analytics_spec.rb
picky-4.12.0 spec/lib/analytics_spec.rb
picky-4.11.3 spec/lib/analytics_spec.rb
picky-4.11.2 spec/lib/analytics_spec.rb
picky-4.11.1 spec/lib/analytics_spec.rb