Make MX::AH optional
[gitmo/MooseX-ClassAttribute.git] / t / 05-with-attribute-helpers-backcompat.t
diff --git a/t/05-with-attribute-helpers-backcompat.t b/t/05-with-attribute-helpers-backcompat.t
new file mode 100644 (file)
index 0000000..9d757f6
--- /dev/null
@@ -0,0 +1,31 @@
+use strict;
+use warnings;
+
+use Test::More;
+
+BEGIN {
+    eval "use MooseX::AttributeHelpers 0.13;";
+    plan skip_all => 'This test requires MooseX::AttributeHelpers 0.13+'
+        if $@;
+}
+
+{
+    package MyClass;
+
+    use MooseX::ClassAttribute;
+    use MooseX::AttributeHelpers;
+
+    class_has counter =>
+        ( metaclass => 'Counter',
+          is        => 'ro',
+          provides  => { inc => 'inc_counter',
+                       },
+        );
+}
+
+is( MyClass->counter(), 0 );
+
+MyClass->inc_counter();
+is( MyClass->counter(), 1 );
+
+done_testing();