[Bps-public-commit] r15372 - in Test-HTTP-Server-Simple-StashWarnings/trunk: . t

sartak at bestpractical.com sartak at bestpractical.com
Fri Aug 22 10:08:09 EDT 2008


Author: sartak
Date: Fri Aug 22 10:08:09 2008
New Revision: 15372

Modified:
   Test-HTTP-Server-Simple-StashWarnings/trunk/   (props changed)
   Test-HTTP-Server-Simple-StashWarnings/trunk/lib/Test/HTTP/Server/Simple/StashWarnings.pm
   Test-HTTP-Server-Simple-StashWarnings/trunk/t/001-basic.t

Log:
 r70219 at onn:  sartak | 2008-08-22 10:07:44 -0400
 Use and recommend decode_warnings and encode_warnings


Modified: Test-HTTP-Server-Simple-StashWarnings/trunk/lib/Test/HTTP/Server/Simple/StashWarnings.pm
==============================================================================
--- Test-HTTP-Server-Simple-StashWarnings/trunk/lib/Test/HTTP/Server/Simple/StashWarnings.pm	(original)
+++ Test-HTTP-Server-Simple-StashWarnings/trunk/lib/Test/HTTP/Server/Simple/StashWarnings.pm	Fri Aug 22 10:08:09 2008
@@ -107,7 +107,7 @@
     $mech->get("$url_root/some_action");
 
     $mech->get("/__test_warnings");
-    my @warnings = Storable::thaw(@{ $mech->content });
+    my @warnings = My::WebServer::Test->decode_warnings($mech->content);
     is(@warnings, 0, "some_action gave no warnings");
 
 =head1 DESCRIPTION
@@ -133,9 +133,10 @@
 The way this module works is it catches warnings and makes them available on a
 special URL (which must be defined by you in the C<test_warning_path> method).
 You can use C<WWW::Mechanize> (or whichever HTTP agent you prefer) to download
-the warnings. The warnings will be serialized with L<Storable/nfreeze>. Use
-L<Storable/thaw> to get an array reference of warnings seen so far (since last
-request anyway).
+the warnings. The warnings will be serialized. Use L<decode_warnings> to get
+the list of warnings seen so far (since last request anyway).
+
+Warnings are encoded using L<Storable> by default, but your subclass may override the C<encode_warnings> and C<decode_warnings> methods.
 
 =head1 COPYRIGHT & LICENSE
 

Modified: Test-HTTP-Server-Simple-StashWarnings/trunk/t/001-basic.t
==============================================================================
--- Test-HTTP-Server-Simple-StashWarnings/trunk/t/001-basic.t	(original)
+++ Test-HTTP-Server-Simple-StashWarnings/trunk/t/001-basic.t	Fri Aug 22 10:08:09 2008
@@ -12,13 +12,13 @@
 $mech->get("$url/no_warnings");
 
 $mech->get("/__test_warnings");
-my @warnings = @{ thaw($mech->content) };
+my @warnings = My::Test::Server->decode_warnings($mech->content);
 is(@warnings, 0, "no warnings yet");
 
 $mech->get("$url/warn");
 
 $mech->get("$url/__test_warnings");
- at warnings = @{ thaw($mech->content) };
+ at warnings = My::Test::Server->decode_warnings($mech->content);
 is(@warnings, 1, "got a warning!");
 like($warnings[0], qr/^We're out of toilet paper sir!/);
 
@@ -26,7 +26,7 @@
 $mech->get("$url/warn");
 
 $mech->get("$url/__test_warnings");
- at warnings = @{ thaw($mech->content) };
+ at warnings = My::Test::Server->decode_warnings($mech->content);
 is(@warnings, 2, "got two warnings! warnings are cleared after fetching them");
 like($warnings[0], qr/^We're out of toilet paper sir!/);
 like($warnings[1], qr/^We're out of toilet paper sir!/);



More information about the Bps-public-commit mailing list