summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/App/BorgRestore.pm16
-rw-r--r--t/03_timespec.t2
2 files changed, 17 insertions, 1 deletions
diff --git a/lib/App/BorgRestore.pm b/lib/App/BorgRestore.pm
index 4ca2716..cfc6a90 100644
--- a/lib/App/BorgRestore.pm
+++ b/lib/App/BorgRestore.pm
@@ -67,6 +67,22 @@ sub new {
$self->{opts} = $opts;
$self->{borg} = $deps->{borg} // App::BorgRestore::Borg->new();
+ $self->{db} = $deps->{db} // App::BorgRestore::DB->new();
+
+ return $self;
+}
+
+sub new_no_defaults {
+ my $class = shift;
+ my $opts = shift;
+ my $deps = shift;
+
+ my $self = {};
+ bless $self, $class;
+
+ $self->{opts} = $opts;
+ $self->{borg} = $deps->{borg};
+ $self->{db} = $deps->{db};
return $self;
}
diff --git a/t/03_timespec.t b/t/03_timespec.t
index a131512..250ce9f 100644
--- a/t/03_timespec.t
+++ b/t/03_timespec.t
@@ -5,7 +5,7 @@ use Test::More;
use App::BorgRestore;
-my $app = App::BorgRestore->new({}, {borg => 0, db => 0});
+my $app = App::BorgRestore->new_no_defaults({}, undef);
is($app->timespec_to_seconds('5s'), 5, '5 seconds');
is($app->timespec_to_seconds('5minutes'), 5*60, '5 minutes');