Finished first version of WrapCGI dist
[catagits/Catalyst-Controller-WrapCGI.git] / t / global-context.t
diff --git a/t/global-context.t b/t/global-context.t
new file mode 100644 (file)
index 0000000..d925502
--- /dev/null
@@ -0,0 +1,36 @@
+#!perl -T
+
+use strict;
+use warnings;
+
+use Test::More tests => 1;
+
+{
+    package TestApp;
+
+    use Catalyst;
+    use CatalystX::GlobalContext ();
+
+    sub auto : Private {
+        my ($self, $c) = @_;
+        CatalystX::GlobalContext->set_context($c);
+        1;
+    }
+
+    sub dummy : Local {
+        my ($self, $c) = @_;
+        $c->res->body(Dongs->foo);
+    }
+
+    __PACKAGE__->setup;
+    
+    package Dongs;
+
+    use CatalystX::GlobalContext '$c';
+
+    sub foo { $c->action }
+}
+
+use Catalyst::Test 'TestApp';
+
+is(get('/dummy'), 'dummy', 'global context works');