Skip to content

Commit

Permalink
Replace _run_ipconfig replacement with mock_win32_hostip()
Browse files Browse the repository at this point in the history
The new function runs _run_ipconfig() internally and returns an
appropriate hostip object.  This change removes more repeated code.
  • Loading branch information
paultcochrane committed Apr 15, 2017
1 parent b7e8118 commit ad93912
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions t/ipconfig.t
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,14 @@ use Test::More tests => 2 * 10;

use File::Spec;
use Sys::HostIP;
use Sys::HostIP::MockUtils qw/mock_run_ipconfig/;

my $hostip = Sys::HostIP->new;
use Sys::HostIP::MockUtils qw/mock_win32_hostip/;

sub mock_and_test {
my ( $file, $expected_results, $test_name ) = @_;

no warnings qw/redefine once/;

*Sys::HostIP::_run_ipconfig = sub {
my $self = shift;
isa_ok( $self, 'Sys::HostIP' );
my $hostip = mock_win32_hostip($file);

return mock_run_ipconfig($file);
};
isa_ok( $hostip, 'Sys::HostIP' );

is_deeply(
$hostip->_get_win32_interface_info,
Expand Down

0 comments on commit ad93912

Please sign in to comment.