-
-
Notifications
You must be signed in to change notification settings - Fork 27
Testing
Fernando Correa de Oliveira edited this page Oct 19, 2018
·
7 revisions
use Test;
use Red;
plan 2;
my $*RED-DB = database("Mock");
$*RED-DB.when: rx/select \s+ a/, :once, :return[{:10data}, {:20data}, {:30data}];
model aaa { has Int $.a is column }.^create-table;
is (10, 20, 30), aaa.^all.map({ .a }), "map is working";
$*RED-DB.verify
Output:
1..2
ok 1 - map is working
1..1
ok 1 - Query that matches 'rx/select \s+ a/' should be called 1 times and was called 1 time(s)
ok 2 - Red Mock verify