diff options
author | franck cuny <franck@lumberjaph.net> | 2010-01-07 12:05:57 +0100 |
---|---|---|
committer | franck cuny <franck@lumberjaph.net> | 2010-01-07 12:05:57 +0100 |
commit | 28bc466a4ce580c86ea96fe1c80e03b87e118daf (patch) | |
tree | 853c8018c95c64adb5f510b5ba822844ae58c0aa | |
parent | update tests (diff) | |
download | moosex-net-api-28bc466a4ce580c86ea96fe1c80e03b87e118daf.tar.gz |
new tests
-rw-r--r-- | t/02_error.t | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/t/02_error.t b/t/02_error.t new file mode 100644 index 0000000..332538a --- /dev/null +++ b/t/02_error.t @@ -0,0 +1,67 @@ +use strict; +use warnings; +use Test::More; +use Test::Exception; + +BEGIN { + dies_ok { + { + + package net_api_fail; + use Moose; + use MooseX::Net::API; + net_api_declare foo => (); + } + } + "... format is missing"; + like $@, qr/format is missing in your api declaration/, + "... format is missing"; + dies_ok { + { + + package net_api_fail; + use Moose; + use MooseX::Net::API; + net_api_declare foo => ( format => 'foo' ); + } + } + "... no valid format"; + like $@, qr/format is not recognised/, "... no valid format"; + dies_ok { + { + + package net_api_fail; + use Moose; + use MooseX::Net::API; + net_api_declare foo => ( format => 'json' ); + } + } + "... format mode is not set"; + like $@, qr/format_mode is not set/, "... format mode is not set"; + dies_ok { + { + + package net_api_fail; + use Moose; + use MooseX::Net::API; + net_api_declare foo => ( format => 'json', format_mode => 'bar' ); + } + } + "... format mode is unvalid"; + like $@, qr/must be append or content-type/, "... format mode is unvalid"; + #dies_ok { + #{ + #package net_api_fail; + #use Moose; + #use MooseX::Net::API; + #net_api_declare foo => ( + #format => 'json', + #format_mode => 'content-type' + #); + #} + #} + #"... bad useragent"; + #warn $@; +} + +done_testing; |