Created
May 6, 2009 15:55
-
-
Save nothingmuch/107571 to your computer and use it in GitHub Desktop.
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 strict; | |
use warnings; | |
use Test::More 'no_plan'; | |
use KiokuX::User::Util qw(crypt_password); | |
use ok 'Kitten::Friend::Schema::Kitten'; | |
my $kitten = Kitten::Friend::Schema::Kitten->new( | |
name => "Snookums", | |
id => "cutesy843", | |
password => crypt_password("luvt00na"), | |
); | |
isa_ok( $kitten, "Kitten::Friend::Schema::Kitten" ); | |
is( $kitten->name, "Snookums", "name attribute" ); | |
ok( $kitten->check_password("luvt00na"), "password check" ); | |
ok( !$kitten->check_password("bathtime"), "bad password" ); | |
is_deeply( [ $kitten->friends->members ], [ ], "no friends" ); | |
is_deeply( [ $kitten->vases->members ], [ ], "no no vases" ); | |
my $vase = $kitten->new_vase( | |
pictures => [ URI->new("http://icanhaz.com/broken_vase") ], | |
); | |
isa_ok( $vase, "Kitten::Friend::Schema::Vase" ); | |
is_deeply( [ $kitten->vases->members ], [ $vase ], "new vase added" ); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment