cartodb-4.42/spec/lib/cartodb/common_data_redis_cache_spec.rb

15 lines
541 B
Ruby
Raw Normal View History

2024-04-06 13:25:13 +08:00
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