Help language development. Donate to The Perl Foundation

ORM::ActiveRecord cpan:GDONALD last updated on 2019-10-24

t/003-update-save.t6
use v6.d;
use lib 'lib';
use ORM::ActiveRecord::Model;
use Test;

class User is Model {
  submethod BUILD {
    self.validate: 'fname', { :presence }
  }
}

plan 3;

%*ENV<DISABLE-SQL-LOG> = True;

my $user = User.create({fname => 'Fred'});
ok $user.is-valid;

$user.fname = 'John';
ok $user.save;
ok $user.fname eq 'John';

User.destroy-all;