[Catalyst-commits] r6809 - trunk/Catalyst-View-Mason/t
rafl at dev.catalyst.perl.org
rafl at dev.catalyst.perl.org
Tue Aug 28 17:04:02 GMT 2007
Author: rafl
Date: 2007-08-28 17:04:02 +0100 (Tue, 28 Aug 2007)
New Revision: 6809
Modified:
trunk/Catalyst-View-Mason/t/exception.t
Log:
Test behaviour if mason throws an exception that's not a HTML::Mason::Exception instance.
Modified: trunk/Catalyst-View-Mason/t/exception.t
===================================================================
--- trunk/Catalyst-View-Mason/t/exception.t 2007-08-28 16:03:59 UTC (rev 6808)
+++ trunk/Catalyst-View-Mason/t/exception.t 2007-08-28 16:04:02 UTC (rev 6809)
@@ -2,13 +2,26 @@
use strict;
use warnings;
-use Test::More tests => 2;
+use Test::More tests => 4;
use FindBin;
use lib "$FindBin::Bin/lib";
use_ok('Catalyst::Test', 'TestApp');
-my $response = request('/exception?view=Appconfig');
+{
+ my $response = request('/exception');
+ ok(!$response->is_success, 'request fails');
+}
-ok(!$response->is_success, 'request fails');
+SKIP: {
+ eval 'use Test::MockModule';
+ skip 'Test::MockModule required', 1 if $@;
+
+ my $mock = Test::MockModule->new('HTML::Mason::Interp');
+ $mock->mock(exec => sub { die bless \do { my $o }, 'FakeException' });
+
+ my $response = request('/exception');
+ ok($response->is_success, 'request succeeds');
+ like($response->content, qr/^FakeException=/, 'request content contains stringified exception');
+}
More information about the Catalyst-commits
mailing list