File: yaml_dependency.t

package info (click to toggle)
libdancer-perl 1.3202%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,408 kB
  • ctags: 638
  • sloc: perl: 7,215; xml: 1,977; sh: 51; makefile: 29; sql: 5
file content (29 lines) | stat: -rw-r--r-- 748 bytes parent folder | download | duplicates (2)
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
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/Configuration file found but could not load YAML: Fish error. Goldfish in YAML./,
    "Dancer::Config cannot load without 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";