summaryrefslogtreecommitdiff
path: root/t/recipes/extending_mooseish_moosesugar.t
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2015-06-06 17:50:16 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2015-06-06 17:50:16 +0000
commit5ac2026f7eed78958d69d051e7a8e993dcf51205 (patch)
tree298c3d2f08bdfe5689998b11892d72a897985be1 /t/recipes/extending_mooseish_moosesugar.t
downloadMoose-tarball-5ac2026f7eed78958d69d051e7a8e993dcf51205.tar.gz
Diffstat (limited to 't/recipes/extending_mooseish_moosesugar.t')
-rw-r--r--t/recipes/extending_mooseish_moosesugar.t66
1 files changed, 66 insertions, 0 deletions
diff --git a/t/recipes/extending_mooseish_moosesugar.t b/t/recipes/extending_mooseish_moosesugar.t
new file mode 100644
index 0000000..fd003c9
--- /dev/null
+++ b/t/recipes/extending_mooseish_moosesugar.t
@@ -0,0 +1,66 @@
+#!/usr/bin/perl -w
+
+use strict;
+use Test::More 'no_plan';
+use Test::Fatal;
+$| = 1;
+
+
+
+# =begin testing SETUP
+{
+
+ package MyApp::Mooseish;
+
+ use Moose::Exporter;
+
+ Moose::Exporter->setup_import_methods(
+ with_meta => ['has_table'],
+ class_metaroles => {
+ class => ['MyApp::Meta::Class::Trait::HasTable'],
+ },
+ );
+
+ sub has_table {
+ my $meta = shift;
+ $meta->table(shift);
+ }
+
+ package MyApp::Meta::Class::Trait::HasTable;
+ use Moose::Role;
+
+ has table => (
+ is => 'rw',
+ isa => 'Str',
+ );
+}
+
+
+
+# =begin testing
+{
+{
+ package MyApp::User;
+
+ use Moose;
+ MyApp::Mooseish->import;
+
+ has_table( 'User' );
+
+ has( 'username' => ( is => 'ro' ) );
+ has( 'password' => ( is => 'ro' ) );
+
+ sub login { }
+}
+
+can_ok( MyApp::User->meta, 'table' );
+is( MyApp::User->meta->table, 'User',
+ 'MyApp::User->meta->table returns User' );
+ok( MyApp::User->can('username'),
+ 'MyApp::User has username method' );
+}
+
+
+
+
+1;