Skip to content

Instantly share code, notes, and snippets.

@nothingmuch
Created May 6, 2009 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nothingmuch/107571 to your computer and use it in GitHub Desktop.
Save nothingmuch/107571 to your computer and use it in GitHub Desktop.
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