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