Smolder

 view release on metacpan or  search on metacpan

t/projects.t  view on Meta::CPAN

            developer => $dev,
        );
    }
    END { delete_smoke_reports() }

    $mech->get_ok("/app/projects/smoke_reports/$proj1");
    $mech->content_contains($proj1->name);
    $mech->content_contains('Recent Smoke Reports');

    # only 5 per page by default
    $mech->content_like(qr/(Added .*){5}/s);
    $mech->content_unlike(qr/(Added .*){6}/s);

    # check the paging
    my $link = $mech->find_link(n => 1, text => "\x{21d0}");
    ok(!defined $link, 'no go-back link');

    # go from 1 to 2
    $mech->follow_link_ok({n => 1, text => "\x{21d2}"}, 'go from 1 to 2');

    # go from 2 to 3
    $mech->follow_link_ok({n => 1, text => "\x{21d2}"}, 'go from 2 to 3');

    # can't go past 3
    $link = $mech->find_link(n => 1, text => "\x{21d2}");
    ok(!defined $link, 'no go-forward link');

    # go from 3 to 2
    $mech->follow_link_ok({n => 1, text => "\x{21d0}"}, 'go from 3 to 2');

    # go from 2 to 1
    $mech->follow_link_ok({n => 1, text => "\x{21d0}"}, 'go from 2 to 1');

    # can't go past 1
    $link = $mech->find_link(n => 1, text => "\x{21d0}");
    ok(!defined $link, 'no go-back link');

    # changing the per-page
    $mech->form_name('smoke_reports');
    $mech->set_fields(limit => 10,);
    $mech->submit();
    ok($mech->success);
    $mech->content_like(qr/(Added .*){10}/s);
    $mech->content_unlike(qr/(Added .*){11}/s);
}

# 71..81
# report_details
{
    my $proj1 = _get_proj($proj1_id);

    # first HTML
    $mech->get_ok("/app/projects/smoke_reports/$proj1");
    $mech->follow_link_ok({n => 1, url_regex => qr/report_details/});
    ok($mech->ct, 'text/html');

    # make sure our extra properties made it into the report
    $mech->content_contains('GCC Version');
    $mech->content_contains('gcc version 4.1.2');
    $mech->content_contains('Perl version');
    $mech->content_contains('This is perl, v5.8.8');
    $mech->content_contains('uname');
    $mech->content_contains('Linux localhost.localdomain 2.6.20-1.2952.fc6');

    # individual report files
    $mech->get_ok("/app/projects/test_file_report_details/$proj1/0");
    ok($mech->ct, 'text/html');
}

# 82..93
# smoke_report_validity
{
    my $proj1 = _get_proj($proj1_id);
    my $url   = "/app/projects/smoke_test_validity";

    # without a report
    $mech->get_ok($url);
    $mech->content_contains("Smoke Report does not exist");

    # not an admin of the project
    my $report = create_smoke_report(
        project   => $proj1,
        developer => $dev,
    );
    my $report_id = $report->id;

    $mech->get_ok("$url/$report_id");
    $mech->content_contains("Not an admin of this project");

    # now make me an admin
    $proj1_dev->admin(1);
    $proj1_dev->update();

    # don't give all the necessary data
    $mech->get_ok("$url/$report_id");
    $mech->content_contains("Invalid data");

    # now make it invalid
    $mech->get_ok("$url/$report_id?invalid=1&invalid_reason=something+sucks");
    $mech->content_contains("INVALID");
    $report = undef;
    $report = Smolder::DB::SmokeReport->retrieve($report_id);
    ok($report->invalid);
    is($report->invalid_reason, 'something sucks');

    # now make it valid
    $mech->get_ok("$url/$report_id?invalid=0");
    $mech->content_lacks("INVALID");
    $report = undef;
    $report = Smolder::DB::SmokeReport->retrieve($report_id);
    ok(!$report->invalid);
}

# 94..97
# single smoke_report
{
    my $proj1 = _get_proj($proj1_id);

    # not an admin of the project
    my $report = create_smoke_report(
        project   => $proj1,



( run in 3.686 seconds using v1.01-cache-2.11-cpan-5a3173703d6 )