summaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2017-11-21 15:56:04 +0100
committerFlorian Pritz <bluewind@xinu.at>2017-11-21 17:18:32 +0100
commit6b9c0d7719afdf85820e703e58b1358c95b6586e (patch)
tree54c5976f8c77f7930b5f314025e9472d25d939d1 /t
parentfe3bc18d25d204c799d42610078509f11954e1c2 (diff)
downloadApp-BorgRestore-6b9c0d7719afdf85820e703e58b1358c95b6586e.tar.gz
App-BorgRestore-6b9c0d7719afdf85820e703e58b1358c95b6586e.tar.xz
Enable --adhoc automatically when cache is empty
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 't')
-rw-r--r--t/07_cache_contains_data.t22
1 files changed, 22 insertions, 0 deletions
diff --git a/t/07_cache_contains_data.t b/t/07_cache_contains_data.t
new file mode 100644
index 0000000..2187ab0
--- /dev/null
+++ b/t/07_cache_contains_data.t
@@ -0,0 +1,22 @@
+use strict;
+use warnings;
+
+use Test::More;
+use Test::MockObject;
+use Test::Differences;
+
+use App::BorgRestore;
+
+my $db = Test::MockObject->new();
+my $app = App::BorgRestore->new_no_defaults({db => $db});
+
+$db->mock('get_archive_names', sub {return [qw(a b c)];});
+is($app->cache_contains_data(), 1);
+
+$db->mock('get_archive_names', sub {return [];});
+is($app->cache_contains_data(), 0);
+
+$db->mock('get_archive_names', sub {return [qw(a)];});
+is($app->cache_contains_data(), 1);
+
+done_testing;