7 use Test::Deep qw/superhashof cmp_deeply/;
9 use Scalar::Util qw/refaddr/;
11 use_ok "Catalyst::Plugin::Cache";
15 use base qw/Catalyst::Plugin::Cache/;
23 bar => bless( {}, "SomeClass" ),
25 ### as of 0.06, we need a specific backend
32 sub config { \%config };
35 ### backend must have a constructor
36 sub new { bless {}, shift };
43 my $c = bless {}, "MockApp";
45 MockApp->register_cache_backend( default => bless({}, "SomeClass") );
47 can_ok( $c, "curry_cache" );
48 can_ok( $c, "get_preset_curried" );
50 isa_ok( $c->cache, "Catalyst::Plugin::Cache::Curried" );
52 is( refaddr($c->cache), refaddr($c->cache), "default cache is memoized, so it is ==");
54 isa_ok( $c->cache("foo"), "Catalyst::Plugin::Cache::Curried", "cache('foo')" );
56 cmp_deeply( { @{ $c->cache("foo")->meta } }, superhashof({ bah => "foo" }), "meta is in place" );
58 is( refaddr( $c->cache("bar") ), refaddr( $c->cache("bar") ), "since bar is hard coded as an object it's always the same" );