use tempfiles in the test suite
[gitmo/MooseX-Storage.git] / t / 008_do_not_serialize.t
CommitLineData
4fa64e86 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
04990d7a 6use Test::More no_plan => 6;
4fa64e86 7use Test::Exception;
8
9BEGIN {
10 use_ok('MooseX::Storage');
11}
12
13{
14 package Foo;
15 use Moose;
16 use MooseX::Storage;
17
18 with Storage;
19
20 has 'bar' => (
21 metaclass => 'DoNotSerialize',
22 is => 'rw',
23 default => sub { 'BAR' }
24 );
25
26 has 'baz' => (
27 traits => [ 'DoNotSerialize' ],
28 is => 'rw',
29 default => sub { 'BAZ' }
30 );
31
32 has 'gorch' => (
33 is => 'rw',
34 default => sub { 'GORCH' }
35 );
36
37 1;
38}
39
40my $foo = Foo->new;
41isa_ok($foo, 'Foo');
42
04990d7a 43is($foo->bar, 'BAR', '... got the value we expected');
44is($foo->baz, 'BAZ', '... got the value we expected');
45is($foo->gorch, 'GORCH', '... got the value we expected');
46
47is_deeply(
48 $foo->pack,
49 {
50 __CLASS__ => 'Foo',
51 gorch => 'GORCH'
52 },
53 '... got the right packed class data'
54);
55
56
57
4fa64e86 58