Sha256: 43d5e5827868d68f17ce7a6d6fbfda6df3a1a3f124498347ba6ca862804f8163

Contents?: true

Size: 1.12 KB

Versions: 13

Compression:

Stored size: 1.12 KB

Contents

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

class Hack
end

class MapperTest < Test::Unit::TestCase
  
  def setup
    @cache_set = CacheAdvance::CacheSet.new
    @mapper = CacheAdvance::Mapper.new(@cache_set)
  end
  
  def test_qualifier
    @mapper.qualifier(:thirty_four) do
      34
    end
    assert_equal 1, @cache_set.qualifiers.size
    assert_equal 34, @cache_set.qualifiers[:thirty_four].call
  end
  
  def test_plugin_from_symbol
    @mapper.plugin(:hack)
    assert_equal 1, @cache_set.plugins.size
    assert_equal Hack, @cache_set.plugins.first.class
  end
  
  def test_plugin_from_class
    @mapper.plugin(Hack)
    assert_equal 1, @cache_set.plugins.size
    assert_equal Hack, @cache_set.plugins.first.class
  end
  
  def test_plugin_from_object
    hack = Hack.new
    @mapper.plugin(hack)
    assert_equal 1, @cache_set.plugins.size
    assert_equal hack, @cache_set.plugins.first
  end
  
  def test_adding_caches_through_method_missing
    @mapper.say_what :option => 2
    assert_equal 1, @cache_set.named_caches.size
    assert_equal CacheAdvance::NamedCache, @cache_set.named_caches[:say_what].class
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
aub-cache_advance-0.2.0 test/mapper_test.rb
aub-cache_advance-1.0.0 test/mapper_test.rb
aub-cache_advance-1.0.1 test/mapper_test.rb
aub-cache_advance-1.0.2 test/mapper_test.rb
aub-cache_advance-1.0.3 test/mapper_test.rb
aub-cache_advance-1.0.4 test/mapper_test.rb
aub-cache_advance-1.0.5 test/mapper_test.rb
aub-cache_advance-1.0.6 test/mapper_test.rb
aub-cache_advance-1.0.7 test/mapper_test.rb
aub-cache_advance-1.0.8 test/mapper_test.rb
aub-cache_advance-1.0.9 test/mapper_test.rb
aub-cache_advance-1.1.0 test/mapper_test.rb
aub-cache_advance-1.1.1 test/mapper_test.rb