6 use Test::More 'no_plan';
8 use Scalar::Util qw/refaddr/;
10 use ok "Catalyst::Plugin::Cache";
14 use base qw/Catalyst::Plugin::Cache/;
22 bar => MemoryCache->new,
26 sub config { \%config };
29 use Storable qw/freeze thaw/;
31 sub new { bless {}, shift }
32 sub get { ${thaw($_[0]{$_[1]}) || return} };
33 sub set { $_[0]{$_[1]} = freeze(\$_[2]) };
34 sub delete { delete $_[0]{$_[1]} };
38 my $c = bless {}, "MockApp";
40 MockApp->register_cache_backend( default => MemoryCache->new );
42 can_ok( $c, "curry_cache" );
43 can_ok( $c, "get_preset_curried" );
45 isa_ok( $c->cache, "Catalyst::Plugin::Cache::Curried" );
47 is( refaddr($c->cache), refaddr($c->cache), "default cache is memoized, so it is ==");
49 isa_ok( $c->cache("foo"), "Catalyst::Plugin::Cache::Curried", "cache('foo')" );
51 is_deeply( $c->cache("foo")->meta, [ bah => "foo" ], "meta is in place" );
53 is( refaddr( $c->cache("bar") ), refaddr( $c->cache("bar") ), "since bar is hard coded as an object it's always the same" );