typester (owner)

Revisions

gist: 163823 Download_button fork
public
Public Clone URL: git://gist.github.com/163823.git
Embed All Files: show embed
Perl #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package Im::Test;
use Ark 'Test';
 
use File::Temp qw/tempdir/;
use Im::Models;
 
sub import {
    my ($class, $app, %options) = @_;
    $app ||= 'Im';
 
    # mocked database
    {
        my $dir = tempdir( CLEANUP => 1 );
 
        my $conf = models('conf');
        $conf->{database} = [
            "dbi:SQLite:$dir/database.db", undef, undef,
            { unicode => 1, ignore_version => 1 },
        ];
 
        models('schema')->deploy;
    }
 
    @_ = ($class, $app, %options);
    goto $class->can('SUPER::import');
}
 
1;