Sha256: 2c0579519a2bbd96147fd5249ebdfc5192f91ea8ba5a0b4fe179594338481514

Contents?: true

Size: 854 Bytes

Versions: 3

Compression:

Stored size: 854 Bytes

Contents

require "#{File.dirname(__FILE__)}/test_helper"

describe EnrichmentDb::Cache do
  before do
    EnrichmentDb::Cache.instance_variable_set(:@query_cache, nil)
  end

  it 'should return nil as value hasn\'t been set when no values' do
    query = 'do stuff'
    assert_nil EnrichmentDb::Cache.get(query)
  end

  it 'should return nil as value hasn\'t been set when non-empty values' do
    query = 'do stuff'
    values = ['er']
    assert_nil EnrichmentDb::Cache.get(query, values)
  end

  it 'should set value on cache and get it' do
    query = 'do stuff'
    values = ['er']
    record = 'This here is a gut dang it record'
    set_result = EnrichmentDb::Cache.set(query, values, record)

    get_result = EnrichmentDb::Cache.set(query, values)

    refute_nil set_result
    refute_nil get_result
    assert_equal set_result, get_result
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
enrichment_db-0.1.13 test/cache_test.rb
enrichment_db-0.1.12 test/cache_test.rb
enrichment_db-0.1.11 test/cache_test.rb