[Jifty-commit] r4123 - in jifty/trunk: t/TestApp/lib/TestApp/Model
t/TestApp/t
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Mon Sep 17 12:56:34 EDT 2007
Author: sartak
Date: Mon Sep 17 12:56:33 2007
New Revision: 4123
Modified:
jifty/trunk/ (props changed)
jifty/trunk/t/TestApp/lib/TestApp/Model/User.pm
jifty/trunk/t/TestApp/t/11-current_user.t
Log:
r42750 at onn: sartak | 2007-09-17 12:56:10 -0400
Add some more tests for Jifty::DateTime in the TestApp
Modified: jifty/trunk/t/TestApp/lib/TestApp/Model/User.pm
==============================================================================
--- jifty/trunk/t/TestApp/lib/TestApp/Model/User.pm (original)
+++ jifty/trunk/t/TestApp/lib/TestApp/Model/User.pm Mon Sep 17 12:56:33 2007
@@ -40,5 +40,15 @@
# Your model-specific methods go here.
+sub current_time
+{
+ Jifty::DateTime->now();
+}
+
+sub time_zone
+{
+ 'America/Anchorage'
+}
+
1;
Modified: jifty/trunk/t/TestApp/t/11-current_user.t
==============================================================================
--- jifty/trunk/t/TestApp/t/11-current_user.t (original)
+++ jifty/trunk/t/TestApp/t/11-current_user.t Mon Sep 17 12:56:33 2007
@@ -11,7 +11,7 @@
use lib 't/lib';
use Jifty::SubTest;
-use Jifty::Test tests => 23;
+use Jifty::Test tests => 27;
use Jifty::Test::WWW::Mechanize;
use_ok('TestApp::Model::User');
@@ -34,6 +34,8 @@
password => 'secret2', tasty => 1 );
ok($o->id, "New user has valid id set");
ok($o->tasty, "User is tasty");
+like($o->created_on->time_zone, qr/Floating/, "User's created_on date is in the floating timezone");
+like($o->current_time->time_zone, qr/UTC/, "Jifty::DateTime::now defaults to UTC (superuser has no user_object)");
is($o->email, 'bob at example.com', 'email initially set correctly');
$o->set_email('bob+jifty at example.com');
@@ -49,6 +51,8 @@
is($bob->user_object->email, 'bob+jifty at example.com', 'email from before');
$bob->user_object->set_email('bob+test at example.com');
is($bob->user_object->email, 'bob+test at example.com', 'email updated correctly');
+like($bob->user_object->created_on->time_zone, qr/Floating/, "User's created_on date is in the floating timezone");
+like($bob->user_object->current_time->time_zone, qr{America::Anchorage}, "Jifty::DateTime::now correctly peers into current_user->user_object->time_zone");
my $server = Jifty::Test->make_server;
isa_ok($server, 'Jifty::Server');
More information about the Jifty-commit
mailing list