Fix and test for issues when components import or define a meta method
[catagits/Catalyst-Runtime.git] / t / meta_method_unneeded.t
diff --git a/t/meta_method_unneeded.t b/t/meta_method_unneeded.t
new file mode 100644 (file)
index 0000000..8d871d1
--- /dev/null
@@ -0,0 +1,22 @@
+use strict;
+use warnings;
+use Test::More tests => 1;
+use Test::Exception;
+use Carp ();
+$SIG{__DIE__} = \&Carp::confess; # Stacktrace please.
+
+# Doing various silly things, like for example
+# use CGI qw/:stanard/ in your conrtoller / app
+# will overwrite your meta method, therefore Catalyst
+# can't depend on it being there correctly.
+
+# This is/was demonstrated by Catalyst::Controller::WrapCGI
+# and Catalyst::Plugin::Cache::Curried
+
+{    
+    package TestAppWithMeta;
+    use Catalyst;
+    sub meta {}
+}
+
+lives_ok { TestAppWithMeta->setup } 'Can setup an app which defines its own meta method';