Sha256: 8d754fcd079ab108bbf155f3dcd9577099c658d1899539aee5f2bf63b18390ea

Contents?: true

Size: 808 Bytes

Versions: 3

Compression:

Stored size: 808 Bytes

Contents

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

class InterlockTest < Test::Unit::TestCase
  def test_caching_key_requires_controller_and_action
    assert_raises ArgumentError do
      Interlock.caching_key nil, nil, nil, nil
    end
  end
  
  def test_caching_key_prevents_too_long_keys
    assert_equal Interlock::KEY_LENGTH_LIMIT,
      Interlock.caching_key('controller', 'action', 'id', 'x'*Interlock::KEY_LENGTH_LIMIT).size,
      "keys longer than #{Interlock::KEY_LENGTH_LIMIT} will result in errors from memcache-client"
  end
  
  def test_caching_key_strips_whitespace
    assert_no_match Interlock::ILLEGAL_KEY_CHARACTERS_PATTERN,
      Interlock.caching_key('controller', 'action', 'id', 'tag with illegal characters')
      'generated keys should not contain illegal characters'
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
interlock-1.3 test/unit/interlock_test.rb
interlock-1.1 test/unit/interlock_test.rb
interlock-1.2 test/unit/interlock_test.rb