File: yaml_dependency.t

package info (click to toggle)
libdancer-perl 1.3521%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 2,460 kB
  • sloc: perl: 7,436; xml: 2,211; sh: 54; makefile: 32; sql: 5
file content (34 lines) | stat: -rw-r--r-- 854 bytes parent folder | download | duplicates (3)
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
30
31
32
33
34
use Test::More tests => 2;
use strict;
use warnings;

use Dancer::Config;
use Dancer::ModuleLoader;

use File::Spec;
use lib File::Spec->catdir( 't', 'lib' );
use EasyMocker;

mock 'Dancer::Config'
    => method 'conffile'
    => should sub { __FILE__ };

mock 'Dancer::ModuleLoader'
    => method 'load'
    => should sub { 0, "Fish error. Goldfish in YAML." };

eval { Dancer::Config->load };
like $@, qr/Could not load YAML: Fish error. Goldfish in YAML./,
    "Dancer::Config cannot load without YAML";

unmock 'Dancer::ModuleLoader' => method 'load';

SKIP: {
    skip 'YAML not available', 1 unless Dancer::ModuleLoader->load('YAML');
mock 'YAML'
    => method 'LoadFile'
    => should sub { undef };
eval { Dancer::Config::load_settings_from_yaml('foo.yml') };
like $@, qr/Unable to parse the configuration file: foo.yml/, "YAML error caught";
}