Catalyst-Action-RenderView

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

Revision history for Perl extension Catalyst-Action-RenderView

0.17    2024-10-12
  - fix Makefile.PL to work without PERL_USE_UNSAFE_INC
  - revised packaging to use Dist::Zilla
  - drop unused prereq HTTP::Request::AsCGI

0.16 2011-01-05 19:28:00 GMT
  - Fix bug accidentally introduced in the last version with response
    3xx statuses.

0.15 2011-01-04 14:19:36 CET
  - Don't delegate to a view if the response body is set to `undef'.
  - Make sure a Test::More with done_testing support is available.

0.14 2009-12-03 03:13:23 GMT

t/04live.t  view on Meta::CPAN

run_tests();

done_testing;

sub run_tests {

    # test first available view
    {
        my $expected = 'View';
        my $request  =
          HTTP::Request->new( GET => 'http://localhost:3000/test_firstview' );

        ok( my $response = request($request), 'Request' );
        ok( $response->is_success, 'Response Successful 2xx' );
        is( $response->header( 'Content-Type' ), 'text/html; charset=utf-8', 'Content Type' );
        is( $response->code, 200, 'Response Code' );

        is( $response->content, $expected, 'Content OK' );
    }

    # test view
    {
        my $expected = 'View';
        my $request  =
          HTTP::Request->new( GET => 'http://localhost:3000/test_view' );

        ok( my $response = request($request), 'Request' );
        ok( $response->is_success, 'Response Successful 2xx' );
        is( $response->header( 'Content-Type' ), 'text/html; charset=utf-8', 'Content Type' );
        is( $response->code, 200, 'Response Code' );

        is( $response->content, $expected, 'Content OK' );
    }

    # test skip view
    {
        my $expected = 'Skipped View';
        my $request  =
          HTTP::Request->new( GET => 'http://localhost:3000/test_skipview' );

          ok( my $response = request($request), 'Request' );
          ok( $response->is_success, 'Response Successful 2xx' );
          is( $response->header( 'Content-Type' ), 'text/html; charset=utf-8', 'Content Type' );
          is( $response->code, 200, 'Response Code' );

          is( $response->content, $expected, 'Content OK' );
    }

    # test X-Sendfile case
    {
        my $request  =
          HTTP::Request->new( GET => 'http://localhost:3000/test_definedbody_skipsview' );

      ok( my $response = request($request), 'Request' );
      ok( $response->is_success, 'Response Successful 2xx' );
      is( $response->header( 'Content-Type' ), 'text/html; charset=utf-8', 'Content Type' );
      is( $response->code, 200, 'Response Code' );

      is( $response->content, '', 'Content OK' );
      is( $response->header('X-Sendfile'), '/some/file/path', 'X-Sendfile header present' );
    }



( run in 1.016 second using v1.01-cache-2.11-cpan-de7293f3b23 )