You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fernando Correa de Oliveira edited this page Oct 20, 2018
·
7 revisions
useTest;
use Red;
plan2;
my$*RED-DB= database "Mock";
$*RED-DB.die-on-unexpected;
model ExampleModel { hasInt$.colis column }
$*RED-DB.when:"CREATE TABLE example_model(col INTEGER NULL)", :once, :return[];
ExampleModel.^create-table;
$*RED-DB.when:rx:i/SELECT \s+ col/, :once, :return[{:10data}, {:20data}, {:30data}];
is (10, 20, 30), ExampleModel.^all.map({ .col }), "map is working";
$*RED-DB.verify;
Output:
1..2
ok 1 - map is working
1..2
ok 1 - Query 'create table example_model ( col integer null )' should be called 1 times and was called 1 time(s)
ok 2 - Query that matches 'rx/select \s+ col/' should be called 1 times and was called 1 time(s)
ok 2 - Red Mock verify