root/tags/rel0_59/t/43_preview_edits.t

Revision 956, 1.6 kB (checked in by earle, 22 months ago)

Complete transition to using skip_all (remove old SKIP blocks).
More verbose reporting for error "require"ing DBD::SQLite.

Line 
1use strict;
2use OpenGuides;
3use OpenGuides::Test;
4use Test::More;
5use Wiki::Toolkit::Setup::SQLite;
6
7eval { require DBD::SQLite; };
8if ( $@ ) {
9    my ($error) = $@ =~ /^(.*?)\n/;
10    plan skip_all => "DBD::SQLite could not be used - no database to test with ($error)";
11}
12
13eval { require Test::HTML::Content; };
14if ( $@ ) {
15    plan skip_all => "Test::HTML::Content not installed";
16}
17
18plan tests => 1;
19
20# Clear out the database from any previous runs.
21unlink "t/node.db";
22unlink <t/indexes/*>;
23Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
24
25my $config = OpenGuides::Test->make_basic_config;
26my $guide = OpenGuides->new( config => $config );
27my $wiki = $guide->wiki;
28
29my $q = OpenGuides::Test->make_cgi_object(
30                                           content => "I am some content.",
31                                           summary => "I am a summary.",
32                                         );
33
34# Get a checksum for a "blank" node.
35my %node_data = $wiki->retrieve_node( "Clapham Junction Station" );
36$q->param( -name => "checksum", -value => $node_data{checksum} );
37
38my $output = $guide->preview_edit(
39                                   id            => "Clapham Junction Station",
40                                   cgi_obj       => $q,
41                                   return_output => 1,
42                                 );
43
44# Strip Content-Type header to stop Test::HTML::Content getting confused.
45$output =~ s/^Content-Type.*[\r\n]+//m;
46
47Test::HTML::Content::text_ok( $output, "I am a summary.",
48                              "Summary shows up in preview." );
Note: See TracBrowser for help on using the browser.