Whoops, add the demo type library and the trivial test also
[catagits/CatalystX-DynamicComponent.git] / t / 08_types_in_model.t
diff --git a/t/08_types_in_model.t b/t/08_types_in_model.t
new file mode 100644 (file)
index 0000000..1b3aadb
--- /dev/null
@@ -0,0 +1,20 @@
+use strict;
+use warnings;
+
+use FindBin qw/$Bin/;
+use lib "$Bin/lib";
+
+use Test::More tests => 6;
+use Test::Exception;
+
+use SomeModelClass;
+my $i = SomeModelClass->new;
+
+throws_ok { $i->say_hello(); } qr/Validation failed/;
+throws_ok { $i->say_hello({}); } qr/Validation failed/;
+throws_ok { $i->say_hello({name => 'Fred'}); } qr/Validation failed/;
+my $r;
+lives_ok { $r = $i->say_hello({type => 'say_hello', name => 'Fred'}); };
+ok $r;
+is_deeply($r, { type => 'say_hello_response', body => "Hello Fred" });
+