File: 11.root_from_arg.t

package info (click to toggle)
perlbrew 0.78-1%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 708 kB
  • sloc: perl: 6,291; makefile: 6
file content (38 lines) | stat: -rw-r--r-- 945 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
35
36
37
38
#!/usr/bin/env perl
use strict;
use warnings;
use FindBin;
use lib $FindBin::Bin;
use App::perlbrew;
require "test_helpers.pl";

use File::Temp qw(tempdir);
use Test::Spec;
use Test::Exception;

describe "App::perlbrew#root method" => sub {
    it "should returns \$App::perlbrew::PERLBREW_ROOT normally" => sub {
        my $app = App::perlbrew->new;

        is $app->root, $App::perlbrew::PERLBREW_ROOT;
    };

    it "should returns the instance property of 'root' if set" => sub {
        my $app = App::perlbrew->new;
        $app->root("/fnord");

        is $app->root, "/fnord";
    };
};

describe "App::perlbrew->new" => sub {
    it "accept --root args and treat it as the value od PERLBREW_ROOT for the instance" => sub {
        my $temp_perlbrew_root = tempdir( CLEANUP => 1);

        my $app = App::perlbrew->new("--root" => $temp_perlbrew_root);

        is $app->root, $temp_perlbrew_root;
    };
};

runtests unless caller;