7 A basic test harness for the Workout model.
11 use Jifty
::Test tests
=> 11;
13 # Make sure we can load the model
14 use_ok
('KratosOrange::Model::Workout');
17 my $system_user = KratosOrange
::CurrentUser
->superuser;
18 ok
($system_user, "Found a system user");
20 # Try testing a create
21 my $o = KratosOrange
::Model
::Workout
->new(current_user
=> $system_user);
22 my ($id) = $o->create();
23 ok
($id, "Workout create returned success");
24 ok
($o->id, "New Workout has valid id set");
25 is
($o->id, $id, "Create returned the right id");
29 ok
($o->id, "Workout create returned another value");
30 isnt
($o->id, $id, "And it is different from the previous one");
33 my $collection = KratosOrange
::Model
::WorkoutCollection
->new(current_user
=> $system_user);
35 is
($collection->count, 2, "Finds two records");
37 # Searches in specific
38 $collection->limit(column
=> 'id', value
=> $o->id);
39 is
($collection->count, 1, "Finds one record with specific id");
43 $collection->redo_search;
44 is
($collection->count, 0, "Deleted row is gone");
46 # And the other one is still there
48 is
($collection->count, 1, "Still one left");