working bucket and video renders
[catagits/App-IdiotBox.git] / t / show / bucket.t
CommitLineData
71fd1550 1use strict;
2use warnings FATAL => 'all';
3use Test::More;
4
5use App::IdiotBox;
6use Data::Perl::Collection::Set;
7use Scalar::Util qw(weaken);
8
9my $idiotbox = App::IdiotBox->new({
10 config => { template_dir => 'share/html' }
11});
12
13my $bucket = bless({
14 slug => 'lpw2009',
15 name => 'London Perl Workshop 2009',
16}, 'App::IdiotBox::Bucket');
17
18my %vid;
19
20$bucket->{videos} = Data::Perl::Collection::Set->new(
21 members => [ map {
22 my $o = bless(
23 { %$_, bucket => $bucket, details => '' },
24 'App::IdiotBox::Video'
25 );
26 weaken($o->{bucket});
27 $vid{$o->{slug}} = $o
28 }
29 { name => 'The M Word', slug => 'm-word', author => 'davorg' },
30 { name => 'Dreamcasting', slug => 'dream', author => 'mst' },
31 ]
32);
33
34sub slurp_html {
35 my $string;
36 my $fh = $_[0]->[-1];
37 while (defined (my $chunk = $fh->getline)) {
38 $string .= $chunk;
39 }
40 $string;
41}
42
43my $bucket_result = $idiotbox->show_bucket($bucket);
44
45my $html = slurp_html($bucket_result);
46
47warn $html;
48
49warn "\n\n------\n\n";
50
51my $video_result = $idiotbox->show_video($vid{dream});
52
53$html = slurp_html($video_result);
54
55warn $html;
56
57pass;
58
59done_testing;