Sha256: 807d00a5957c64db2c34c99b0c3cde49c45f62806fe721f78dcc4016d8461725

Contents?: true

Size: 725 Bytes

Versions: 8

Compression:

Stored size: 725 Bytes

Contents

# encoding: utf-8
require 'helper'
require 'memcached_mock'

class TestEncoding < Test::Unit::TestCase

  context 'using a live server' do
    should 'support i18n content' do
      memcached do |dc|
        key = 'foo'
        bad_key = utf8 = 'ƒ©åÍÎ'

        assert dc.set(key, utf8)
        assert_equal utf8, dc.get(key)

        # keys must be ASCII
        assert_raise ArgumentError, /illegal character/ do
          dc.set(bad_key, utf8)
        end
      end
    end

    should 'support content expiry' do
      memcached do |dc|
        key = 'foo'
        assert dc.set(key, 'bar', 1)
        assert_equal 'bar', dc.get(key)
        sleep 2
        assert_equal nil, dc.get(key)
      end
    end

  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
jashmenn-dalli-1.0.3 test/test_encoding.rb
dalli-1.0.3 test/test_encoding.rb
dalli-1.0.2 test/test_encoding.rb
dalli-1.0.1 test/test_encoding.rb
dalli-1.0.0 test/test_encoding.rb
dalli-0.11.2 test/test_encoding.rb
dalli-0.11.1 test/test_encoding.rb
dalli-0.11.0 test/test_encoding.rb