about summary refs log tree commit diff
path: root/t/006_emailer.t
blob: 2df25f137c29f9fb445f566fda65d057707adcfb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use strict;
use warnings;
use Test::Most tests => 3;
use Data::Dumper;
use Test::MockObject;

use_ok "jitterbug::Emailer";

{
    my $conf = { jitterbug => { build_process => 'bar'} };
    my $commit = Test::MockObject->new;
    my $project = Test::MockObject->new;
    my $task = Test::MockObject->new;

    $project->mock('name', sub { 'ponie' });

    $commit->mock('sha256', sub { 'c0decafe' });
    $commit->mock('content', sub { 'this should be JSON' } );

    $task->mock('commit', sub { $commit });
    $task->mock('project', sub { $project });

    my $tap = "1..1\nok 1\n";
    my $e = jitterbug::Emailer->new($conf, $task, $tap);

    isa_ok($e,'jitterbug::Emailer');
    can_ok($e,qw/new run/);

}