Created
March 2, 2022 13:24
-
-
Save j1n3l0/f6a3aa099eef18756fe10b3905fb966b to your computer and use it in GitHub Desktop.
Using stubs in Test2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Test2::V0; | |
subtest 'Using stubs in Test2' => sub { | |
my $user = mock { company => 'dev' }; | |
my $userdata = mock { day => '2022-02-02' }; | |
my $stats = mock { user => $user, userdata => $userdata }; | |
is( $stats->user->company, 'dev', | |
'should return the right value for $stats->user->company', | |
); | |
is( $stats->userdata->day, '2022-02-02', | |
'should return the right value for $stats->userdata->day', | |
); | |
}; | |
done_testing(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment