Skip to content

Commit

Permalink
improved plugin loader tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Sep 10, 2011
1 parent 99d1b66 commit 4cacc86
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions Changes
Expand Up @@ -8,6 +8,7 @@ This file documents the revision history for Perl extension Mojolicious.
(viliampucik)
- Improved tests.
- Fixed small bug in cookie jar.
- Fixed small plugin loader bug.
- Fixed Hypnotoad to clean up lock files.
- Fixed small bug that caused exceptions to be logged twice.

Expand Down
2 changes: 1 addition & 1 deletion t/mojolicious/lib/MojoliciousTest.pm
Expand Up @@ -15,7 +15,7 @@ sub startup {
# Plugins in custom namespace
unshift @{$self->plugins->namespaces},
$self->routes->namespace . '::Plugin';
$self->plugin('test_plugin');
$self->plugin('test-some_plugin2');
$self->plugin('UPPERCASETestPlugin');

# Templateless renderer
Expand Down
4 changes: 2 additions & 2 deletions t/mojolicious/lib/MojoliciousTest/Foo.pm
Expand Up @@ -23,7 +23,7 @@ sub index {

sub plugin_camel_case {
my $self = shift;
$self->render_text($self->test_plugin);
$self->render_text($self->some_plugin);
}

sub plugin_upper_case {
Expand Down Expand Up @@ -56,7 +56,7 @@ sub stage1 {

sub stage2 {
my $self = shift;
$self->render_text($self->test_plugin);
$self->render_text($self->some_plugin);
}

sub syntaxerror { shift->render('syntaxerror', format => 'html') }
Expand Down
@@ -1,13 +1,13 @@
package MojoliciousTest::Plugin::TestPlugin;
package MojoliciousTest::Plugin::Test::SomePlugin2;
use Mojo::Base 'Mojolicious::Plugin';

# "Space: It seems to go on and on forever...
# but then you get to the end and a gorilla starts throwing barrels at you."
sub register {
my ($self, $app) = @_;

# Add "test_plugin" helper
$app->helper(test_plugin => sub {'Welcome aboard!'});
# Add "some_plugin" helper
$app->helper(some_plugin => sub {'Welcome aboard!'});
}

1;
4 changes: 2 additions & 2 deletions t/mojolicious/lib/SingleFileTestApp.pm
Expand Up @@ -11,13 +11,13 @@ sub startup {
$self->log->level('fatal');

# Plugin
$self->plugin('MojoliciousTest::Plugin::TestPlugin');
$self->plugin('MojoliciousTest::Plugin::Test::SomePlugin2');

# Helper route
$self->routes->route('/helper')->to(
cb => sub {
my $self = shift;
$self->render(text => $self->test_plugin);
$self->render(text => $self->some_plugin);
}
);

Expand Down

0 comments on commit 4cacc86

Please sign in to comment.