diff options
author | Jon Kristensen <info@jonkri.com> | 2014-05-15 17:41:07 +0200 |
---|---|---|
committer | Jon Kristensen <info@jonkri.com> | 2014-05-15 17:41:07 +0200 |
commit | d6ab834a8e1fb67800785eb781e4f9ecc2e39a5c (patch) | |
tree | 57330eaed413dd8a200e2d49b1deb91b69dad79f /t/app/controller/dashboard.t | |
parent | 87b7c87e1cf83ba043a0254008248595363906c1 (diff) | |
parent | 966a1a754d7f4f055944212c5523798a7795402f (diff) |
Merge branch 'master' of git://github.com/mysociety/fixmystreet into jonkri-master
Diffstat (limited to 't/app/controller/dashboard.t')
-rw-r--r-- | t/app/controller/dashboard.t | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/t/app/controller/dashboard.t b/t/app/controller/dashboard.t index a87232e9b..4e62028b5 100644 --- a/t/app/controller/dashboard.t +++ b/t/app/controller/dashboard.t @@ -609,9 +609,19 @@ FixMyStreet::override_config { } subtest 'export as csv' => sub { + make_problem( { + detail => "this report\nis split across\nseveral lines", + state => "confirmed", + conf_dt => DateTime->now(), + } ); $mech->get_ok('/dashboard?export=1'); - my @lines = split /\n/, $mech->content; - is scalar @lines, 6, '1 (header) + 5 (reports) = 6 lines'; + open my $data_handle, '<', \$mech->content; + my $csv = Text::CSV->new( { binary => 1 } ); + my @rows; + while ( my $row = $csv->getline( $data_handle ) ) { + push @rows, $row; + } + is scalar @rows, 7, '1 (header) + 6 (reports) = 7 lines'; }; }; restore_time; @@ -623,7 +633,7 @@ sub make_problem { title => 'a problem', name => 'a user', anonymous => 1, - detail => 'some detail', + detail => $args->{detail} || 'some detail', state => $args->{state}, confirmed => $args->{conf_dt}, whensent => $args->{conf_dt}, |