Skip to content

Commit

Permalink
more config tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Feb 6, 2012
1 parent 75fe79d commit a4e3a47
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Changes
@@ -1,5 +1,8 @@
This file documents the revision history for Perl extension Mojolicious.

2.48 2012-02-07 00:00:00
- Improved tests.

2.47 2012-02-06 00:00:00
- Deprecated Hypnotoad configuration files in favor of more powerful
application configuration files.
Expand Down
2 changes: 2 additions & 0 deletions lib/Mojo/Asset.pm
Expand Up @@ -13,6 +13,8 @@ sub get_chunk { croak 'Method "get_chunk" not implemented by subclass' }

sub is_file {undef}

# "Oh no! Can we switch back using four or more bodies?
# I'm not sure. I'm afraid we need to use... MATH."
sub move_to { croak 'Method "move_to" not implemented by subclass' }
sub size { croak 'Method "size" not implemented by subclass' }
sub slurp { croak 'Method "slurp" not implemented by subclass' }
Expand Down
10 changes: 8 additions & 2 deletions t/mojolicious/json_config_lite_app.t
Expand Up @@ -8,13 +8,17 @@ BEGIN {
$ENV{MOJO_IOWATCHER} = 'Mojo::IOWatcher';
}

use Test::More tests => 17;
use Test::More tests => 20;

# "Oh, I always feared he might run off like this.
# Why, why, why didn't I break his legs?"
use Mojolicious::Lite;
use Test::Mojo;

# Default
app->config(it => 'works');
is_deeply app->config, {it => 'works'}, 'right value';

# Load plugin
my $config =
plugin j_s_o_n_config => {default => {foo => 'baz', hello => 'there'}};
Expand All @@ -27,6 +31,7 @@ is app->config->{utf}, 'утф', 'right value';
is app->config('foo'), 'bar', 'right value';
is app->config('hello'), 'there', 'right value';
is app->config('utf'), 'утф', 'right value';
is app->config('it'), 'works', 'right value';

# GET /
get '/' => 'index';
Expand All @@ -41,7 +46,8 @@ $config =
plugin JSONConfig => {file => 'nonexistent', default => {foo => 'qux'}};
is $config->{foo}, 'qux', 'right value';
is app->config->{foo}, 'qux', 'right value';
is app->config('foo'), 'qux', 'right value';
is app->config('foo'), 'qux', 'right value';
is app->config('it'), 'works', 'right value';

# No config file, no default
{
Expand Down

0 comments on commit a4e3a47

Please sign in to comment.