Permalink
Browse files

fixed stupid bug

  • Loading branch information...
1 parent 63daa4a commit f696de8d2bc4bbcaffe7de117128a97e0a2b5b31 @dams committed Feb 5, 2011
Showing with 12 additions and 2 deletions.
  1. +2 −0 Changes
  2. +1 −1 lib/Dancer/Plugin/FlashMessage.pm
  3. +9 −1 t/02_flash.t
View
@@ -1,4 +1,6 @@
{{$NEXT}}
+ . fix case where no flash has been defined
+ . thanks to ambs and sawyerX
0.309 2011-02-05 13:24:13 Europe/Paris
. documentation fixed
@@ -33,7 +33,7 @@ before_template sub {
session $session_hash_key, $flash;
return $value;
} );
- } ( keys %{session $session_hash_key || {} })
+ } ( keys %{session $session_hash_key or {} })
};
};
View
@@ -1,4 +1,4 @@
-use Test::More tests => 7, import => ['!pass'];
+use Test::More tests => 10, import => ['!pass'];
use Dancer ':syntax';
use Dancer::Test;
@@ -7,6 +7,10 @@ use_ok 'Dancer::Plugin::FlashMessage';
setting views => path('t', 'views');
ok(
+ get '/nothing' => sub {
+ template 'index', { };
+ });
+ok(
get '/' => sub {
flash(error => 'plop');
template 'index', { foo => 'bar' };
@@ -17,6 +21,10 @@ ok(
}
);
+# empty route
+route_exists [ GET => '/nothing' ];
+response_content_like( [ GET => '/nothing' ], qr/foo :\s*, message :\s*$/ );
+
# first time we get the error message
route_exists [ GET => '/' ];
response_content_like( [ GET => '/' ], qr/foo : bar, message : plop$/ );

0 comments on commit f696de8

Please sign in to comment.