Skip to content

Commit

Permalink
better tests for mixed case actions and templates
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jun 9, 2013
1 parent 60059ca commit ed7f63e
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/Mojolicious/Routes.pm
Expand Up @@ -201,7 +201,7 @@ sub _method {

# Invalid
$c->app->log->debug(qq{Action "$method" is invalid.}) and return undef
unless $method =~ /^[a-zA-Z0-9_:]+$/;
unless $method =~ /^[a-zA-Z0-9_]+$/;

return $method;
}
Expand Down
4 changes: 2 additions & 2 deletions t/mojolicious/app.t
Expand Up @@ -226,8 +226,8 @@ $t->get_ok('/foo/withlayout' => {'X-Test' => 'Hi there!'})->status_is(200)
->header_is(Server => 'Mojolicious (Perl)')
->content_like(qr/Same old in green Seems to work!/);

# Foo::withblock
$t->get_ok('/foo/withblock.txt' => {'X-Test' => 'Hi there!'})->status_is(200)
# Foo::withBlock
$t->get_ok('/withblock.txt' => {'X-Test' => 'Hi there!'})->status_is(200)
->header_is(Server => 'Mojolicious (Perl)')->content_type_isnt('text/html')
->content_type_is('text/plain')
->content_like(qr/Hello Baerbel\.\s+Hello Wolfgang\./);
Expand Down
2 changes: 1 addition & 1 deletion t/mojolicious/lib/MojoliciousTest.pm
Expand Up @@ -135,7 +135,7 @@ sub startup {
$r->route('/test10')->to('baz#index');

# /withblock (template with blocks)
$r->route('/withblock')->to('foo#withblock');
$r->route('/withblock')->to('foo#withBlock');

# /staged (authentication with bridges)
my $b = $r->bridge('/staged')->to(controller => 'foo', action => 'stage1');
Expand Down
4 changes: 2 additions & 2 deletions t/mojolicious/lib/MojoliciousTest/Foo.pm
Expand Up @@ -74,9 +74,9 @@ sub url_for_missing {

sub willdie { die 'for some reason' }

sub withblock { shift->render(template => 'withblock') }
sub withBlock { shift->render(template => 'withblock') }

sub withlayout { shift->stash(template => 'withlayout') }
sub withlayout { shift->stash(template => 'WithGreenLayout') }

1;
__DATA__
Expand Down
4 changes: 3 additions & 1 deletion t/mojolicious/lib/SingleFileTestApp.pm
Expand Up @@ -65,7 +65,9 @@ sub data_template2 { shift->stash(template => 'too') }

sub data_static { shift->render_static('singlefiletestapp/foo.txt') }

sub index { shift->stash(template => 'withlayout', msg => 'works great!') }
sub index {
shift->stash(template => 'WithGreenLayout', msg => 'works great!');
}

sub routes {
my $self = shift;
Expand Down
File renamed without changes.

0 comments on commit ed7f63e

Please sign in to comment.