Skip to content

Commit

Permalink
more backend tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Apr 12, 2017
1 parent 953ddc8 commit 54ce301
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions t/mojo/morbo.t
Expand Up @@ -13,6 +13,7 @@ use lib "$FindBin::Bin/lib";
use IO::Socket::INET;
use Mojo::File 'tempdir';
use Mojo::IOLoop::Server;
use Mojo::Server::Morbo::Backend;
use Mojo::Server::Daemon;
use Mojo::Server::Morbo;
use Mojo::UserAgent;
Expand Down Expand Up @@ -143,11 +144,13 @@ sleep 1 while _port($port);
# Custom backend
{
local $ENV{MOJO_MORBO_BACKEND} = 'TestBackend';
local $ENV{MOJO_MORBO_TIMEOUT} = 2;
my $test_morbo = Mojo::Server::Morbo->new;
isa_ok $test_morbo->backend, 'Mojo::Server::Morbo::Backend::TestBackend',
'right backend';
is_deeply $test_morbo->backend->modified_files, ['always_changed'],
'always changes';
is $test_morbo->backend->watch_timeout, 2, 'right timeout';
}

# SO_REUSEPORT
Expand All @@ -172,6 +175,10 @@ SKIP: {
'SO_REUSEPORT socket option';
}

# Abstract methods
eval { Mojo::Server::Morbo::Backend->modified_files };
like $@, qr/Method "modified_files" not implemented by subclass/, 'right error';

sub _port { IO::Socket::INET->new(PeerAddr => '127.0.0.1', PeerPort => shift) }

sub _reuse_port {
Expand Down

0 comments on commit 54ce301

Please sign in to comment.