Commit | Line | Data |
71fd1550 |
1 | use strict; |
2 | use warnings FATAL => 'all'; |
3 | use Test::More; |
4 | |
5 | use App::IdiotBox; |
6 | use Data::Perl::Collection::Set; |
7 | use Scalar::Util qw(weaken); |
8 | |
9 | my $idiotbox = App::IdiotBox->new({ |
10 | config => { template_dir => 'share/html' } |
11 | }); |
12 | |
13 | my $bucket = bless({ |
14 | slug => 'lpw2009', |
15 | name => 'London Perl Workshop 2009', |
16 | }, 'App::IdiotBox::Bucket'); |
17 | |
18 | my %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 | |
34 | sub 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 | |
43 | my $bucket_result = $idiotbox->show_bucket($bucket); |
44 | |
45 | my $html = slurp_html($bucket_result); |
46 | |
47 | warn $html; |
48 | |
49 | warn "\n\n------\n\n"; |
50 | |
51 | my $video_result = $idiotbox->show_video($vid{dream}); |
52 | |
53 | $html = slurp_html($video_result); |
54 | |
55 | warn $html; |
56 | |
57 | pass; |
58 | |
59 | done_testing; |