5 eval "use DBD::SQLite";
6 plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 18);
13 is(Blurb->primary_column, "title", "Primary key of Blurb = title");
14 is_deeply [ Blurb->columns('Essential') ], [ Blurb->primary_column ], "Essential = Primary";
16 eval { Blurb->retrieve(10) };
17 is $@, "", "No problem retrieving non-existent Blurb";
19 Film->might_have(info => Blurb => qw/blurb/);
21 Film->create_test_film;
24 ok my $bt = Film->retrieve('Bad Taste'), "Get Film";
26 is $bt->info, undef, "No blurb yet";
27 # bug where we couldn't write a class with a might_have that didn't_have
30 is $@, '', "No problems updating when don't have";
31 is $bt->rating, 16, "Updated OK";
33 is $bt->blurb, undef, "Bad taste has no blurb";
34 $bt->blurb("Wibble bar");
36 is $bt->blurb, "Wibble bar", "And we can write the info";
40 my $bt = Film->retrieve('Bad Taste');
42 isa_ok $info, 'Blurb';
44 is $bt->blurb, $info->blurb, "Blurb is the same as fetching the long way";
45 ok $bt->blurb("New blurb"), "We can set the blurb";
47 is $bt->blurb, $info->blurb, "Blurb has been set";
51 is $@, '', "No problems updating when do have";
52 is $bt->rating, 18, "Updated OK";
56 my $blurb = Blurb->retrieve('Bad Taste');
57 isa_ok $blurb => "Blurb";
59 $blurb = Blurb->retrieve('Bad Taste');
60 is $blurb, undef, "Blurb has gone";