use temp COMPILE_DIR to avoid test failures
where the default COMPILE_DIR already exists and is owned by another user or not writable for some other reason by the testing user.
This commit is contained in:
5
Changes
5
Changes
@@ -1,6 +1,11 @@
|
||||
Revision history for Mojolicious::Plugin::TtRenderer
|
||||
|
||||
{{$NEXT}}
|
||||
- silenced a few annoying warnings during test
|
||||
- use temp directory for COMPILE_DIR in tests to avoid failures if the
|
||||
default compile directory already exists and is owned by someone else.
|
||||
|
||||
1.31 December 26, 2012
|
||||
- Set locale "C" in tests that rely on it
|
||||
|
||||
1.30 December 22, 2012
|
||||
|
||||
@@ -7,4 +7,3 @@ BEGIN {
|
||||
use_ok( 'Mojolicious::Plugin::TtRenderer::Engine' );
|
||||
}
|
||||
|
||||
diag( "Testing Mojolicious::Plugin::TtRenderer::Engine $Mojolicious::Plugin::TtRenderer::Engine::VERSION, Perl $], $^X" );
|
||||
|
||||
@@ -11,11 +11,14 @@ use Test::More tests => 3;
|
||||
|
||||
use Mojolicious::Lite;
|
||||
use Test::Mojo;
|
||||
use File::Temp qw( tempdir tempfile );
|
||||
|
||||
my($fh_log,$filename_log) = tempfile('fooXXXXX', TMPDIR => 1, UNLINK => 1);
|
||||
# Silence
|
||||
app->log->level('fatal');
|
||||
app->log->path($filename_log);
|
||||
|
||||
plugin 'tt_renderer';
|
||||
plugin 'tt_renderer' => {template_options => { COMPILE_DIR => tempdir( CLEANUP => 1 ) }};
|
||||
|
||||
get '/exception' => sub { die };
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 3;
|
||||
use Test::Mojo;
|
||||
use File::Temp qw( tempdir );
|
||||
|
||||
use Mojolicious::Lite;
|
||||
|
||||
@@ -11,7 +12,7 @@ app->plugin(
|
||||
template_options => {
|
||||
# These options are specific to TT
|
||||
INCLUDE_PATH => 'templates',
|
||||
COMPILE_DIR => 'templates_c',
|
||||
COMPILE_DIR => tempdir( CLEANUP => 1 ),
|
||||
COMPILE_EXT => '.ttc',
|
||||
# ... anything else to be passed on to TT should go here
|
||||
},
|
||||
|
||||
@@ -12,13 +12,14 @@ use Test::More tests => 39;
|
||||
use Mojolicious::Lite;
|
||||
use Mojo::ByteStream 'b';
|
||||
use Test::Mojo;
|
||||
use File::Temp qw( tempdir );
|
||||
|
||||
# Silence
|
||||
app->log->level('fatal');
|
||||
|
||||
use_ok('Mojolicious::Plugin::TtRenderer::Engine');
|
||||
|
||||
plugin 'tt_renderer' => {template_options => {PRE_CHOMP => 1, POST_CHOMP => 1, TRIM => 1}};
|
||||
plugin 'tt_renderer' => {template_options => {PRE_CHOMP => 1, POST_CHOMP => 1, TRIM => 1, COMPILE_DIR => tempdir( CLEANUP => 1 ) }};
|
||||
|
||||
get '/exception' => 'error';
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ use Test::More tests => 6;
|
||||
|
||||
use Mojolicious::Lite;
|
||||
use Test::Mojo;
|
||||
use File::Temp qw( tempdir );
|
||||
|
||||
# Silence
|
||||
app->log->level('fatal');
|
||||
@@ -18,7 +19,7 @@ app->log->level('fatal');
|
||||
my @paths = map { app->home->rel_dir($_) } "templates/multiple_first", "templates/multiple_second";
|
||||
app->renderer->paths([@paths]);
|
||||
|
||||
plugin 'TtRenderer';
|
||||
plugin 'TtRenderer' => {template_options => { COMPILE_DIR => tempdir( CLEANUP => 1 ) }};
|
||||
|
||||
get '/first' => 'first';
|
||||
get '/second' => 'second';
|
||||
|
||||
@@ -17,12 +17,12 @@ BEGIN {
|
||||
}
|
||||
}
|
||||
|
||||
use File::Temp;
|
||||
use File::Temp qw( tempdir );
|
||||
use Mojo::IOLoop;
|
||||
use Test::More;
|
||||
|
||||
# Use a clean temporary directory
|
||||
BEGIN { $ENV{MOJO_TMPDIR} ||= File::Temp::tempdir }
|
||||
BEGIN { $ENV{MOJO_TMPDIR} ||= tempdir( CLEANUP => 1) }
|
||||
|
||||
# Make sure sockets are working
|
||||
plan skip_all => 'working sockets required for this test!'
|
||||
@@ -36,7 +36,7 @@ use Mojolicious::Lite;
|
||||
use Test::Mojo;
|
||||
|
||||
# POD renderer plugin
|
||||
plugin 'tt_renderer';
|
||||
plugin 'tt_renderer' => {template_options => { COMPILE_DIR => tempdir( CLEANUP => 1 ) }};
|
||||
|
||||
# Silence
|
||||
app->log->level('error');
|
||||
@@ -57,6 +57,8 @@ $t->get_ok('/blow')->status_is(500)->content_like(qr/file error - doesnotexist\.
|
||||
|
||||
if(eval q{ use Devel::Cycle; 1 })
|
||||
{
|
||||
# ignore warnings coming from Devel::Cycle
|
||||
local $SIG{__WARN__} = sub { };
|
||||
Devel::Cycle::find_cycle(app, sub {
|
||||
my $arg = shift;
|
||||
# Template::Provider (from which M::P::T::Provider inherits) has some cycles which are freed manaully by
|
||||
|
||||
@@ -20,7 +20,7 @@ use_ok 'Foo';
|
||||
|
||||
push @{app->renderer->classes}, 'Foo';
|
||||
|
||||
plugin 'tt_renderer' => {template_options => {PRE_CHOMP => 1, POST_CHOMP => 1, TRIM => 1}};
|
||||
plugin 'tt_renderer' => {template_options => {PRE_CHOMP => 1, POST_CHOMP => 1, TRIM => 1, COMPILE_DIR => tempdir( CLEANUP => 1 )}};
|
||||
|
||||
app->log->level('fatal');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user