Skip to content

Commit

Permalink
Write Tests and Begin the Module
Browse files Browse the repository at this point in the history
A few tests have been writen to set constraints and guides. The
very beginnings of the module have been writen as well.
  • Loading branch information
nicqrocks committed Jun 24, 2016
1 parent 0183007 commit 7008098
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/WebService/Slack/webhook.pm6
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env perl6

use Net::HTTP::POST;
use JSON::Fast;

#Make the class.
class WebService::Slack::webhook {
#Make some vars.
has Str $!url;

#Make some methods to build the object.
multi method new(Str:D $var) { self.bless(:url($var)); }
multi method new($other?) { die "No Slack integration given!"; }
}
9 changes: 9 additions & 0 deletions t/01-use.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env perl6

use Test;
use lib 'lib';

#Make sure we can even call it.
use-ok 'WebService::Slack::webhook';

done-testing;
18 changes: 18 additions & 0 deletions t/02-send.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env perl6

use Test;
use lib 'lib';

use WebService::Slack::webhook;

#Make a bad object.
dies-ok {WebService::Slack::webhook.new()},
'Bad object fails correctly';

#Make a good object.
my $slack = WebService::Slack::webhook.new("https://host.slack.com/example");
isa-ok $slack,
'WebService::Slack::webhook',
'Good object can be made';

done-testing;

0 comments on commit 7008098

Please sign in to comment.