Skip to content

Commit

Permalink
test required constructor arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
jlouder committed May 29, 2015
1 parent 15c2672 commit 3a1eb40
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions t/05-instance.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!perl -T
use 5.006;
use strict;
use warnings FATAL => 'all';
use Test::More;
use WebService::GarminConnect;

plan tests => 4;

# Both the username and password are required arguments.
my $gc;
eval {
$gc = WebService::GarminConnect->new();
};
is($gc, undef, 'constructor fails with no arguments');

eval {
$gc = WebService::GarminConnect->new(username => 'user1');
};
is($gc, undef, 'constructor fails with just username');

eval {
$gc = WebService::GarminConnect->new(password => 'mypass');
};
is($gc, undef, 'constructor fails with just password');

eval {
$gc = WebService::GarminConnect->new(username => 'user1',
password => 'mypass');
};
isnt($gc, undef, 'constructor succeeds with both username and password');

0 comments on commit 3a1eb40

Please sign in to comment.