7 BEGIN { $ENV{SGN_SKIP_CGI} = 1 }
8 use SGN::Test 'ctx_request';
9 use SGN::Test::WWW::Mechanize;
11 BEGIN { use_ok 'SGN::View::Email::ErrorEmail' }
13 my $mech = SGN::Test::WWW::Mechanize->new;
14 $mech->with_test_level( process => sub {
16 my ($res, $c) = ctx_request('/');
17 $c->stash->{email_errors} = [ SGN::Exception->new( message => 'Fake test error!') ];
18 $c->view('Email::ErrorEmail')->maximum_body_size( 50000 );
19 my $email = $c->view('Email::ErrorEmail')->make_email( $c );
21 is( $email->{subject}, '[SGN](E) /', 'got a good subject line' );
22 like( $email->{body}, qr/object skipped/, 'email body looks right' );
23 like( $email->{body}, qr/=== Request ===/, 'email body has a Request' );
24 like( $email->{body}, qr/=== Summary ===/, 'email body has a Summary' );
25 like( $email->{body}, qr/"<redacted>"/, 'redacted some stuff' );
26 like( $email->{body}, qr/email body truncated/, 'body was truncated' );