8
default => sub { Path::Tiny->tempdir },
13
default => sub { shift->tempdir->child('test.sqlite3') },
16
has dbh => ( is => 'lazy', );
21
"dbi:SQLite:dbname=" . $self->dbfile, { RaiseError => 1 }
25
before 'setup' => sub {
27
ok( ! -f $self->dbfile, "test database file not created" );
28
ok( $self->dbh->do("CREATE TABLE f (f1, f2, f3)"), "created table");
29
ok( -f $self->dbfile, "test database file exists" );
32
after 'teardown' => sub {
34
my $dir = $self->tempdir;
36
ok( ! -f $dir, "tempdir cleaned up");
42
my $sth = $dbh->prepare("INSERT INTO f(f1,f2,f3) VALUES (?,?,?)");
43
ok( $sth->execute( "one", "two", "three" ), "inserted data" );
45
my $got = $dbh->selectrow_arrayref("SELECT * FROM f");
46
is_deeply( $got, [qw/one two three/], "read data" );