aboutsummaryrefslogtreecommitdiffstats
path: root/t/Mock/Static.pm
blob: 260c181cd93bd313caa79acc55e4606b3387eaab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package t::Mock::Static;

use Path::Tiny;
use Web::Simple;

my $sample_file = path(__FILE__)->parent->parent->child("app/controller/sample.jpg");
my $sample_photo = $sample_file->slurp_raw;

sub dispatch_request {
    my $self = shift;

    sub (GET + /image.jpeg) {
        my ($self) = @_;
        return [ 200, [ 'Content-Type' => 'image/jpeg' ], [ $sample_photo ] ];
    },
}

__PACKAGE__->run_if_script;