cartodb-4.42/spec/lib/cartodb/common_data_redis_cache_spec.rb
2024-04-06 05:25:13 +00:00

15 lines
541 B
Ruby

require_relative '../../../app/helpers/common_data_redis_cache'
require_relative '../../spec_helper_min'
require 'mock_redis'
describe CommonDataRedisCache do
it 'handles encoding issues' do
string_with_wrong_encoding = "\xc2\xa0".force_encoding('ascii-8bit')
expected_result = { headers: {}, body: string_with_wrong_encoding }
@mock_redis = MockRedis.new
cdrc = CommonDataRedisCache.new(@mock_redis)
cdrc.set(true, {}, string_with_wrong_encoding).should eq "OK"
cdrc.get(true).should eq expected_result
end
end