Skip to content

Commit

Permalink
Add tests for url to show report
Browse files Browse the repository at this point in the history
  • Loading branch information
moznion committed Apr 26, 2014
1 parent c2bab42 commit 2cec96b
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Ukigumo/Server/Util.pm
Expand Up @@ -12,7 +12,7 @@ my $ansi = HTML::FromANSI::Tiny->new(

# 行頭に行ごとのリンクをつけるの術
sub make_line_link {
my $src = shift;
my $src = shift || '';

my @lines = split /\r?\n/, $src;
my $num = 1;
Expand Down
34 changes: 34 additions & 0 deletions t/04-report.t
@@ -0,0 +1,34 @@
use strict;
use warnings;
use utf8;
use Test::More;
use t::Util;
use Test::Requires 'LWP::Protocol::PSGI';

use Ukigumo::Constants;
use Ukigumo::Server::Command::Report;
use LWP::UserAgent;

my $app = test_ukigumo;
LWP::Protocol::PSGI->register($app);

my $c = Ukigumo::Server->bootstrap;
Ukigumo::Server::Command::Report->insert(
project => 'Foo',
branch => 'bar',
status => STATUS_SUCCESS,
);
my $ua = LWP::UserAgent->new();

subtest 'exist' => sub {
my $res = $ua->get('http://localhost/report/1');
is($res->code, 200);
};

subtest 'not found' => sub {
my $res = $ua->get('http://localhost/report/2');
is($res->code, 404);
};

done_testing;

0 comments on commit 2cec96b

Please sign in to comment.