From: Alexander Hartmaier Date: Sun, 8 Aug 2010 13:20:57 +0000 (+0200) Subject: added test for check_has_column X-Git-Tag: 2.002003~14 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Controller-DBIC-API.git;a=commitdiff_plain;h=7f3836d96f906e23f5aab8b81e8cf1cfb3912a57;hp=35331c88359e483940f405c4199e5769fcfac7ac added test for check_has_column --- diff --git a/t/generic.t b/t/generic.t new file mode 100644 index 0000000..fa6a297 --- /dev/null +++ b/t/generic.t @@ -0,0 +1,11 @@ +use strict; +use warnings; +use lib 't/lib'; +use Test::More; + +{ + eval "use Catalyst::Test 'TestAppCheckHasCol'"; + like($@, qr/^Couldn't load class \(TestAppCheckHasCol\) because: Couldn't instantiate component "TestAppCheckHasCol::Controller::InvalidColumn", "Column 'foo' does not exist in ResultSet 'TestAppDB::Artist'/, 'check_has_column ok'); +} + +done_testing(); diff --git a/t/lib/TestAppCheckHasCol.pm b/t/lib/TestAppCheckHasCol.pm new file mode 100644 index 0000000..5c4b101 --- /dev/null +++ b/t/lib/TestAppCheckHasCol.pm @@ -0,0 +1,14 @@ +package TestAppCheckHasCol; +use Moose; +use namespace::autoclean; +use Catalyst::Runtime 5.70; + +extends 'Catalyst'; + +our $VERSION = '0.01'; + +__PACKAGE__->config( name => __PACKAGE__ ); + +__PACKAGE__->setup; + +1; diff --git a/t/lib/TestAppCheckHasCol/Controller/InvalidColumn.pm b/t/lib/TestAppCheckHasCol/Controller/InvalidColumn.pm new file mode 100644 index 0000000..e941a01 --- /dev/null +++ b/t/lib/TestAppCheckHasCol/Controller/InvalidColumn.pm @@ -0,0 +1,13 @@ +package TestAppCheckHasCol::Controller::InvalidColumn; +use Moose; +use namespace::autoclean; + +extends 'Catalyst::Controller::DBIC::API::REST'; + +__PACKAGE__->config( + action => { setup => { PathPart => 'undefcol', Chained => '/api/rest/rest_base' } }, + class => 'TestAppDB::Artist', + update_allows => ['foo'], +); + +1; diff --git a/t/lib/TestAppCheckHasCol/Model/TestAppDB.pm b/t/lib/TestAppCheckHasCol/Model/TestAppDB.pm new file mode 100644 index 0000000..13feb2a --- /dev/null +++ b/t/lib/TestAppCheckHasCol/Model/TestAppDB.pm @@ -0,0 +1,19 @@ +package TestAppCheckHasCol::Model::TestAppDB; + +use strict; +use warnings; +use base 'Catalyst::Model::DBIC::Schema'; + +use Catalyst::Utils; + +__PACKAGE__->config( + schema_class => 'RestTest::Schema', + connect_info => [ + "dbi:SQLite:t/var/DBIxClass.db", + undef, + undef, + {AutoCommit => 1} + ] +); + +1;