Skip to content

Commit

Permalink
better Mojolicious::Plugin::Config tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Apr 7, 2012
1 parent 77165e7 commit a9fd79a
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 12 deletions.
1 change: 1 addition & 0 deletions Changes
Expand Up @@ -2,6 +2,7 @@ This file documents the revision history for Perl extension Mojolicious.

2.77 2012-04-08
- Improved documentation. (tempire, sri)
- Improved tests.
- Fixed small bug that prevented non-string secrets in Mojolicious.

2.76 2012-04-05
Expand Down
6 changes: 3 additions & 3 deletions lib/Mojolicious/Plugin/Config.pm
Expand Up @@ -121,9 +121,9 @@ Mojolicious::Plugin::Config - Perl-ish configuration plugin
=head1 DESCRIPTION
L<Mojolicious::Plugin::Config> is a Perl-ish configuration plugin. The
application object can be accessed via the C<app> helper. You can extend the
normal configuration file C<myapp.conf> with C<mode> specific ones like
C<myapp.$mode.conf>.
application object can be accessed via C<$app> or the C<app> function. You
can extend the normal configuration file C<myapp.conf> with C<mode> specific
ones like C<myapp.$mode.conf>.
=head1 OPTIONS
Expand Down
12 changes: 6 additions & 6 deletions t/mojolicious/embedded_lite_app.t
Expand Up @@ -188,7 +188,7 @@ $t->get_ok('/just/works/too')->status_is(200)->content_is("It just works!\n");

# GET /x/1/ (full external application)
$t->get_ok('/x/1/')->status_is(200)->content_is(<<'EOF');
works!
works!Insecure!Insecure!
too!works!!!
<form action="/x/1/%E2%98%83">
Expand All @@ -212,7 +212,7 @@ $t->get_ok('/x/1/url/☃')->status_is(200)

# GET /x/♥/ (full external application)
$t->get_ok('/x/♥/')->status_is(200)->content_is(<<'EOF');
works!
works!Insecure!Insecure!
too!works!!!
<form action="/x/%E2%99%A5/%E2%98%83">
Expand Down Expand Up @@ -241,7 +241,7 @@ $t->get_ok('/host')->status_is(200)->content_is('main application!');
# GET / (full external application with domain)
$t->get_ok('/' => {Host => 'mojolicious.org'})->status_is(200)
->content_is(<<'EOF');
works!
works!Insecure!Insecure!
too!works!!!
<form action="/%E2%98%83">
Expand All @@ -256,7 +256,7 @@ $t->get_ok('/host' => {Host => 'mojolicious.org'})->status_is(200)
# GET / (full external application with domain)
$t->get_ok('/' => {Host => 'mojolicio.us'})->status_is(200)
->content_is(<<'EOF');
works!
works!Insecure!Insecure!
too!works!!!
<form action="/%E2%98%83">
Expand All @@ -270,7 +270,7 @@ $t->get_ok('/host' => {Host => 'mojolicio.us'})->status_is(200)

# GET / (full external application with domain)
$t->get_ok('/' => {Host => 'kraih.com'})->status_is(200)->content_is(<<'EOF');
works!
works!Insecure!Insecure!
too!works!!!
<form action="/%E2%98%83">
Expand All @@ -293,7 +293,7 @@ $t->get_ok('/host' => {Host => 'foo.bar.kraih.com'})->status_is(200)
# GET /♥/123/host (full external application with a bit of everything)
$t->get_ok('/♥/123/' => {Host => 'foo-bar.de'})->status_is(200)
->content_is(<<'EOF');
works!
works!Insecure!Insecure!
too!works!!!
<form action="/%E2%99%A5/123/%E2%98%83">
Expand Down
5 changes: 4 additions & 1 deletion t/mojolicious/external/myapp.pl
Expand Up @@ -5,6 +5,9 @@
# "Boy, who knew a cooler could also make a handy wang coffin?"
use Mojolicious::Lite;

# Secret for config file tests
app->secret('Insecure!');

# Load plugin
plugin 'Config';

Expand Down Expand Up @@ -45,4 +48,4 @@
__DATA__
@@ menubar.html.ep
<%= $config->{just} %>
<%= $config->{just} %><%= $config->{one} %><%= $config->{two} %>
2 changes: 1 addition & 1 deletion t/mojolicious/external/myapp.testing.conf
@@ -1 +1 @@
{works => "too!"};
{one => app->secret, two => $app->secret, works => "too!"};
2 changes: 1 addition & 1 deletion t/mojolicious/external_lite_app.t
Expand Up @@ -21,7 +21,7 @@ my $t = Test::Mojo->new;

# GET /
$t->get_ok('/')->status_is(200)->content_is(<<'EOF');
works!
works!Insecure!Insecure!
too!works!!!
<form action="/%E2%98%83">
Expand Down

0 comments on commit a9fd79a

Please sign in to comment.