From c3e8c9ff7365847ee960c3ea1ce6ae87cb569367 Mon Sep 17 00:00:00 2001 From: Marcus Ramberg Date: Fri, 5 Mar 2010 16:36:00 +0800 Subject: [PATCH] Tests for plugin --- t/templates/index.html.tt | 1 + t/tt_plugin_lite_app.t | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 t/templates/index.html.tt create mode 100644 t/tt_plugin_lite_app.t diff --git a/t/templates/index.html.tt b/t/templates/index.html.tt new file mode 100644 index 0000000..90ed935 --- /dev/null +++ b/t/templates/index.html.tt @@ -0,0 +1 @@ +test123[% 456 %] \ No newline at end of file diff --git a/t/tt_plugin_lite_app.t b/t/tt_plugin_lite_app.t new file mode 100644 index 0000000..29679ad --- /dev/null +++ b/t/tt_plugin_lite_app.t @@ -0,0 +1,39 @@ +#!/usr/bin/env perl + +# Copyright (C) 2008-2010, Sebastian Riedel. + +use strict; +use warnings; + +use File::Temp; +use Mojo::IOLoop; +use Test::More; + +# Use a clean temporary directory +BEGIN { $ENV{MOJO_TMPDIR} ||= File::Temp::tempdir } + +# Make sure sockets are working +plan skip_all => 'working sockets required for this test!' + unless Mojo::IOLoop->new->generate_port; +plan tests => 3; + +# Leela: OK, this has gotta stop. I'm going to remind Fry of his humanity the way only a woman can. +# Farnsworth: You're going to do his laundry? + +use Mojolicious::Lite; +use Test::Mojo; + +# POD renderer plugin +plugin 'tt_renderer'; + +# Silence +app->log->level('error'); + +# GET / +get '/' => 'index'; + +my $t = Test::Mojo->new; + +# Simple TT template +$t->get_ok('/')->status_is(200) + ->content_like(qr/test123456/); \ No newline at end of file