diff options
author | Jesse Luehrs <doy@tozt.net> | 2010-07-19 19:10:14 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2010-07-19 19:10:14 -0500 |
commit | 636f22f307ff0dc94a2c2ec23d49c872ecddbc02 (patch) | |
tree | dab6dc4bc564c61d6a1ace5727238574cfd5ce2b /t/moose/moose_cookbook_extending_recipe4.t | |
parent | bdd9773b60d3cf2cceea43b4aa1dacd9ed5d492b (diff) | |
download | moosex-exporter-easy-636f22f307ff0dc94a2c2ec23d49c872ecddbc02.tar.gz moosex-exporter-easy-636f22f307ff0dc94a2c2ec23d49c872ecddbc02.zip |
initial implementation
Diffstat (limited to 't/moose/moose_cookbook_extending_recipe4.t')
-rw-r--r-- | t/moose/moose_cookbook_extending_recipe4.t | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/t/moose/moose_cookbook_extending_recipe4.t b/t/moose/moose_cookbook_extending_recipe4.t new file mode 100644 index 0000000..1a41093 --- /dev/null +++ b/t/moose/moose_cookbook_extending_recipe4.t @@ -0,0 +1,67 @@ +#!/usr/bin/perl -w + +use strict; +use Test::More 'no_plan'; +use Test::Exception; +$| = 1; + + + +# =begin testing SETUP +{ + + package MyApp::Mooseish; + + use Moose (); + use MooseX::Exporter::Easy; + + also 'Moose'; + + sub init_meta_extra { + shift; + return Moose->init_meta( @_, metaclass => 'MyApp::Meta::Class' ); + } + + with_meta has_table => sub { + my $meta = shift; + $meta->table(shift); + }; + + export; + + package MyApp::Meta::Class; + use Moose; + + extends 'Moose::Meta::Class'; + + has 'table' => ( is => 'rw' ); +} + + + +# =begin testing +{ +{ + package MyApp::User; + + MyApp::Mooseish->import; + + has_table( 'User' ); + + has( 'username' => ( is => 'ro' ) ); + has( 'password' => ( is => 'ro' ) ); + + sub login { } +} + +isa_ok( MyApp::User->meta, 'MyApp::Meta::Class' ); +is( MyApp::User->meta->table, 'User', + 'MyApp::User->meta->table returns User' ); +ok( MyApp::User->can('username'), + 'MyApp::User has username method' ); +} + + + + +1; |