1 use Test::More tests => 7;
14 BEGIN { use_ok 'Fumo::Schema' }
17 skip('FUMO_TEST_DSN environment variable not set', 3)
18 unless $ENV{FUMO_TEST_DSN};
22 'one_file_all_combos_valid.yml' => {
23 name => 'one file, all combos, valid',
25 revision => 'Revision1',
27 'one_file_skip_todo.yml' => {
28 name => 'one file, todos and skips, valid',
30 revision => 'Revision2',
32 'one_file_invalid.yml' => {
33 name => 'one file, invalid (extra data)',
34 throws => 'forbidden field: thisisinvalid',
35 revision => 'Revision3',
37 'many_files_same_tests.yml' => {
38 name => 'many files, same tests',
40 revision => 'Revision3',
45 my $schema = Fumo::Schema->connect($ENV{FUMO_TEST_DSN});
46 isa_ok($schema, 'Fumo::Schema');
49 my $projects_rs = $schema->resultset('Project');
50 $projects_rs->delete_all();
51 cmp_ok($projects_rs->count(), '==', 0,
52 'There are no projects in the database');
54 my $importer = Fumo::Import->new();
56 my $fixture_path = dirname(realpath($0)) . '/01-fixtures/';
57 for my $file (keys %{ $file_map }) {
58 my $details = YAML::LoadFile($fixture_path . $file);
62 $importer->do_import($details, $schema,
63 'Project1', 'Branch1', $file_map->{$file}->{revision})
66 # check it lives or throws as it should
67 if ($file_map->{$file}->{throws}) {
68 throws_ok { $import->() } qr/$file_map->{$file}->{throws}/,
72 lives_ok { $import->() }
73 "'$file' imports ok" or diag($file_map->{$file}->{name});