/[transports]/trunk/t/00-model-ReturnCode.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/t/00-model-ReturnCode.t

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 46 by dpavlin, Tue May 30 18:09:51 2006 UTC revision 52 by dpavlin, Mon Jun 5 14:08:58 2006 UTC
# Line 10  A basic test harness for the ReturnCode Line 10  A basic test harness for the ReturnCode
10    
11  use Jifty::Test tests => 11;  use Jifty::Test tests => 11;
12    
13    my $nr = 4;
14    
15  # Make sure we can load the model  # Make sure we can load the model
16  use_ok('Transports::Model::ReturnCode');  use_ok('Transports::Model::ReturnCode');
17    
# Line 19  ok($system_user, "Found a system user"); Line 21  ok($system_user, "Found a system user");
21    
22  # Try testing a create  # Try testing a create
23  my $o = Transports::Model::ReturnCode->new(current_user => $system_user);  my $o = Transports::Model::ReturnCode->new(current_user => $system_user);
24  my ($id) = $o->create();  my ($id) = $o->create( name => 'foo' );
25  ok($id, "ReturnCode create returned success");  ok($id, "ReturnCode create returned success");
26  ok($o->id, "New ReturnCode has valid id set");  ok($o->id, "New ReturnCode has valid id set");
27  is($o->id, $id, "Create returned the right id");  is($o->id, $id, "Create returned the right id");
28    
29  # And another  # And another
30  $o->create();  $o->create( name => 'bar' );
31  ok($o->id, "ReturnCode create returned another value");  ok($o->id, "ReturnCode create returned another value");
32  isnt($o->id, $id, "And it is different from the previous one");  isnt($o->id, $id, "And it is different from the previous one");
33    
34  # Searches in general  # Searches in general
35  my $collection =  Transports::Model::ReturnCodeCollection->new(current_user => $system_user);  my $collection =  Transports::Model::ReturnCodeCollection->new(current_user => $system_user);
36  $collection->unlimit;  $collection->unlimit;
37  is($collection->count, 2, "Finds two records");  is($collection->count, $nr + 2, "Finds two records");
38    
39  # Searches in specific  # Searches in specific
40  $collection->limit(column => 'id', value => $o->id);  $collection->limit(column => 'id', value => $o->id);
# Line 45  is($collection->count, 0, "Deleted row i Line 47  is($collection->count, 0, "Deleted row i
47    
48  # And the other one is still there  # And the other one is still there
49  $collection->unlimit;  $collection->unlimit;
50  is($collection->count, 1, "Still one left");  is($collection->count, $nr + 1, "Still one left");
51    

Legend:
Removed from v.46  
changed lines
  Added in v.52

  ViewVC Help
Powered by ViewVC 1.1.26