Sha256: 7fa7e76506c69208a62c5e59955b3ef1f16a871b1dd9711e887c174fa9ef4107

Contents?: true

Size: 1.12 KB

Versions: 15

Compression:

Stored size: 1.12 KB

Contents

require File.dirname(__FILE__) + '/test_helper.rb'

class TestElement < Test::Unit::TestCase
  ALIASES = {
    :tti => :time_to_idle,
    :ttl => :time_to_live
  }

  ALIASES.each do |short, long|
    must "have reader alias named #{short} referring to #{long}" do
      element = Ehcache::Element.new('', '')
      assert_respond_to(element, long)
      assert_respond_to(element, short)
      assert_equal(element.send(long), element.send(long))
    end

    must "have writer alias named #{short} referring to #{long}" do
      element = Ehcache::Element.new('', '')
      long_writer = "#{long}=".to_sym
      short_writer = "#{short}=".to_sym
      assert_respond_to(element, long_writer)
      assert_respond_to(element, short_writer)
      
      element.send(long_writer, 1)
      assert_equal(1, element.send(long))
      assert_equal(1, element.send(short))
      element.send(short_writer, 2)
      assert_equal(2, element.send(long))
      assert_equal(2, element.send(short))
    end
  end

  must 'process ttl option on create' do
    element = Ehcache::Element.create('k', 'v', :ttl => 42)
    assert_equal(element.ttl, 42)
  end
end

Version data entries

15 entries across 15 versions & 3 rubygems

Version Path
jruby-ehcache-rails3-1.3.2 test/test_element.rb
jruby-ehcache-rails2-1.3.2 test/test_element.rb
jruby-ehcache-1.3.2 test/test_element.rb
jruby-ehcache-rails3-1.3.1 test/test_element.rb
jruby-ehcache-rails2-1.3.1 test/test_element.rb
jruby-ehcache-1.3.1 test/test_element.rb
jruby-ehcache-rails3-1.3.0 test/test_element.rb
jruby-ehcache-rails2-1.3.0 test/test_element.rb
jruby-ehcache-1.3.0 test/test_element.rb
jruby-ehcache-1.2.1 test/test_element.rb
jruby-ehcache-1.2.0 test/test_element.rb
jruby-ehcache-1.1.2 test/test_element.rb
jruby-ehcache-1.1.1 test/test_element.rb
jruby-ehcache-1.1.0 test/test_element.rb
jruby-ehcache-1.0.0 test/test_element.rb