sane names for models
André Walker [Thu, 11 Aug 2011 17:38:45 +0000 (14:38 -0300)]
t/lib/TestAppCustomContainer/Model/SingletonLifeCycle.pm [moved from t/lib/TestAppCustomContainer/Model/Bar.pm with 76% similarity]
t/lib/TestAppCustomContainer/NoSugarContainer.pm
t/lib/TestCustomContainer.pm

@@ -1,4 +1,4 @@
-package TestAppCustomContainer::Model::Bar;
+package TestAppCustomContainer::Model::SingletonLifeCycle;
 use Moose;
 extends 'Catalyst::Model';
 with 'TestAppCustomContainer::Role::HoldsFoo',
index 09e99dc..10f50fd 100644 (file)
@@ -11,10 +11,10 @@ sub BUILD {
     warn("Add Bar to model");
     $self->get_sub_container('model')->add_service(
         Catalyst::IOC::ConstructorInjection->new(
-            name             => 'Bar',
+            name             => 'SingletonLifeCycle',
             lifecycle        => 'Singleton',
-            class            => 'TestAppCustomContainer::Model::Bar',
-            catalyst_component_name => 'TestAppCustomContainer::Model::Bar',
+            class            => 'TestAppCustomContainer::Model::SingletonLifeCycle',
+            catalyst_component_name => 'TestAppCustomContainer::Model::SingletonLifeCycle',
             dependencies     => {
                 application_name => depends_on( '/application_name' ),
                 foo => depends_on('/model/DefaultSetup'),
index 5231b89..2bcbdfe 100644 (file)
@@ -42,7 +42,7 @@ sub BUILD {
     is(get('/container_isa'), $self->container_class,   'and container isa our container class');
 
     {
-        # Foo ACCEPT_CONTEXT called - total: 1
+        # DefaultSetup ACCEPT_CONTEXT called - total: 1
         ok(my ($res, $c) = ctx_request('/get_model_baz'), 'request');
         ok($res->is_success, 'request 2xx');
         is($res->content, 'TestAppCustomContainer::Model::Baz', 'content is expected');
@@ -56,14 +56,14 @@ sub BUILD {
 #        isa_ok($foo, 'TestAppCustomContainer::Model::Foo');
 #        is($foo->baz_got_it, 1, 'Baz accessed Foo once');
 
-        # Foo ACCEPT_CONTEXT called - total: 2
+        # DefaultSetup ACCEPT_CONTEXT called - total: 2
         ok(get('/get_model_baz'), 'another request');
         is($baz->accept_context_called, 1, 'ACCEPT_CONTEXT not called again (instance per context)');
 #        is($foo->baz_got_it, 2, 'Baz accessed Foo again');
     }
 
     {
-        # Foo ACCEPT_CONTEXT called - total: 3
+        # DefaultSetup ACCEPT_CONTEXT called - total: 3
         ok(my ($res, $c) = ctx_request('/get_model_bar'), 'request');
         ok($res->is_success, 'request 2xx');
         is($res->content, 'TestAppCustomContainer::Model::Bar', 'content is expected');
@@ -79,14 +79,14 @@ sub BUILD {
 #        isa_ok($foo, 'TestAppCustomContainer::Model::Foo');
 #        is($foo->bar_got_it, 1, 'Bar accessed Foo once');
 
-        # Foo ACCEPT_CONTEXT *not* called - total: 3
+        # DefaultSetup ACCEPT_CONTEXT *not* called - total: 3
         ok(get('/get_model_bar'), 'another request');
         is($bar->accept_context_called, 1, 'ACCEPT_CONTEXT not called again (lifecycle is Singleton)');
 #        is($foo->bar_got_it, 1, 'Bar didn\'t access Foo again');
     }
 
     {
-        # Foo ACCEPT_CONTEXT called - total: 4
+        # DefaultSetup ACCEPT_CONTEXT called - total: 4
         ok(my ($res, $c) = ctx_request('/get_model_foo'), 'request');
         ok($res->is_success, 'request 2xx');
         is($res->content, 'TestAppCustomContainer::Model::Foo', 'content is expected');