diff options
author | Jesse Luehrs <doy@tozt.net> | 2013-06-25 13:24:03 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2013-06-25 13:24:03 -0400 |
commit | 4557c62c6c1b120e553fb3ef2dad8a7655013b7b (patch) | |
tree | 02952aabbfdc22b3901fa727ae630385974b3d73 /t/moose-late-load.t | |
parent | 3f09a1600bfa43d0d6c1716789d726c815ff9eda (diff) | |
download | class-refresh-4557c62c6c1b120e553fb3ef2dad8a7655013b7b.tar.gz class-refresh-4557c62c6c1b120e553fb3ef2dad8a7655013b7b.zip |
failing tests
Diffstat (limited to 't/moose-late-load.t')
-rw-r--r-- | t/moose-late-load.t | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/t/moose-late-load.t b/t/moose-late-load.t new file mode 100644 index 0000000..ebc33ab --- /dev/null +++ b/t/moose-late-load.t @@ -0,0 +1,68 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More; +use lib 't/lib'; +use Test::Class::Refresh; + +use Class::Refresh; + +my $dir; +BEGIN { + $dir = prepare_temp_dir_for('moose-late-load'); + push @INC, $dir->dirname; + + Class::Refresh->refresh; +} + +# have to do this later +use Test::Requires 'Moose'; + +require Foo; +require Foo::Immutable; + +is_deeply([Foo->meta->get_attribute_list], ['foo'], + "correct starting attr list"); +can_ok('Foo', 'meth'); +ok(!Foo->can('other_meth'), "!Foo->can('other_meth')"); + +is_deeply([Foo::Immutable->meta->get_attribute_list], ['foo'], + "correct starting attr list"); +can_ok('Foo::Immutable', 'meth'); +ok(!Foo::Immutable->can('other_meth'), "!Foo::Immutable->can('other_meth')"); + + +sleep 2; +update_temp_dir_for('moose-late-load', $dir, 'middle'); + +Class::Refresh->refresh; + +is_deeply([Foo->meta->get_attribute_list], ['bar'], + "correct refreshed attr list"); +can_ok('Foo', 'other_meth'); +ok(!Foo->can('meth'), "!Foo->can('meth')"); + +is_deeply([Foo::Immutable->meta->get_attribute_list], ['bar'], + "correct refreshed attr list"); +can_ok('Foo::Immutable', 'other_meth'); +ok(!Foo::Immutable->can('meth'), "!Foo::Immutable->can('meth')"); + + +sleep 2; +update_temp_dir_for('moose-late-load', $dir, 'after'); + +Class::Refresh->refresh; + +is_deeply([Foo->meta->get_attribute_list], ['baz'], + "correct refreshed attr list"); +can_ok('Foo', 'other_other_meth'); +ok(!Foo->can('meth'), "!Foo->can('meth')"); +ok(!Foo->can('other_meth'), "!Foo->can('other_meth')"); + +is_deeply([Foo::Immutable->meta->get_attribute_list], ['baz'], + "correct refreshed attr list"); +can_ok('Foo::Immutable', 'other_other_meth'); +ok(!Foo::Immutable->can('meth'), "!Foo::Immutable->can('meth')"); +ok(!Foo::Immutable->can('other_meth'), "!Foo::Immutable->can('other_meth')"); + +done_testing; |