[Jifty-commit] r6629 - in jifty/trunk: t/TestApp-Plugin-REST/t

Jifty commits jifty-commit at lists.jifty.org
Tue Mar 17 13:18:20 EDT 2009


Author: sartak
Date: Tue Mar 17 13:18:18 2009
New Revision: 6629

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/t/TestApp-Plugin-REST/t/03-format.t

Log:
 r81292 at onn:  sartak | 2009-03-17 13:18:03 -0400
 Tests for record creation in REST


Modified: jifty/trunk/t/TestApp-Plugin-REST/t/03-format.t
==============================================================================
--- jifty/trunk/t/TestApp-Plugin-REST/t/03-format.t	(original)
+++ jifty/trunk/t/TestApp-Plugin-REST/t/03-format.t	Tue Mar 17 13:18:18 2009
@@ -2,7 +2,7 @@
 use warnings;
 use strict;
 
-use Jifty::Test::Dist tests => 24;
+use Jifty::Test::Dist tests => 32;
 use Jifty::Test::WWW::Mechanize;
 
 my $server  = Jifty::Test->make_server;
@@ -112,6 +112,33 @@
     is($_[0], 'test at example.com');
 };
 
+result_of_post '/=/model/user' => {
+    name => 'moose',
+    email => 'moose at example.com',
+} => sub {
+    my ($action_result, $record) = @_;
+
+    my $id = 2 + ($FORMAT_NUMBER - 1);
+
+    is_deeply($action_result, {
+        action_class   => 'TestApp::Plugin::REST::Action::CreateUser',
+        content        => { id => $id },
+        error          => undef,
+        failure        => 0,
+        field_errors   => {},
+        field_warnings => {},
+        message        => 'Created',
+        success        => 1,
+    });
+
+    is_deeply($record, {
+        email => 'moose at example.com',
+        id    => $id,
+        name  => 'moose',
+        tasty => undef,
+    });
+};
+
 __END__
 
 # on PUT    '/=/model/*/*/*' => \&replace_item;


More information about the Jifty-commit mailing list