[Catalyst-commits] r10882 - in
CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk: .
lib/CatalystX/CRUD/ModelAdapter t
karpet at dev.catalyst.perl.org
karpet at dev.catalyst.perl.org
Tue Jul 14 19:29:30 GMT 2009
Author: karpet
Date: 2009-07-14 19:29:30 +0000 (Tue, 14 Jul 2009)
New Revision: 10882
Modified:
CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/Changes
CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/Makefile.PL
CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/lib/CatalystX/CRUD/ModelAdapter/DBIC.pm
CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/t/01-dbic.t
CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/t/insertdb.pl
Log:
update for 0.10
Modified: CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/Changes
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/Changes 2009-07-13 14:40:32 UTC (rev 10881)
+++ CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/Changes 2009-07-14 19:29:30 UTC (rev 10882)
@@ -32,4 +32,7 @@
0.09 13 June 2009
* fix ORDER BY via cxc-order so that it actually works, including tests for multi-column sort.
+0.10 14 July 2009
+ * fix tests so that (a) sql is complete and (b) skip is sqlite3 cmd tool not found
+
Modified: CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/Makefile.PL
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/Makefile.PL 2009-07-13 14:40:32 UTC (rev 10881)
+++ CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/Makefile.PL 2009-07-14 19:29:30 UTC (rev 10882)
@@ -11,6 +11,7 @@
PL_FILES => {},
PREREQ_PM => {
'Test::More' => 0,
+ 'Data::Dump' => 0,
'CatalystX::CRUD' => 0.42,
'DBIx::Class' => 0,
'Catalyst::Model::DBIC::Schema' => 0,
Modified: CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/lib/CatalystX/CRUD/ModelAdapter/DBIC.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/lib/CatalystX/CRUD/ModelAdapter/DBIC.pm 2009-07-13 14:40:32 UTC (rev 10881)
+++ CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/lib/CatalystX/CRUD/ModelAdapter/DBIC.pm 2009-07-14 19:29:30 UTC (rev 10882)
@@ -13,7 +13,7 @@
__PACKAGE__->mk_ro_accessors(qw( treat_like_int ));
-our $VERSION = '0.09';
+our $VERSION = '0.10';
=head1 NAME
Modified: CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/t/01-dbic.t
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/t/01-dbic.t 2009-07-13 14:40:32 UTC (rev 10881)
+++ CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/t/01-dbic.t 2009-07-14 19:29:30 UTC (rev 10882)
@@ -2,104 +2,115 @@
BEGIN {
use lib qw( ../../CatalystX-CRUD/trunk/lib t );
-
+ use lib qw( t/lib );
$ENV{CATALYST_DEBUG} ||= 0;
+}
+END { unlink('t/example.db') unless $ENV{PERL_DEBUG}; }
+
+SKIP: {
+
use_ok('CatalystX::CRUD::ModelAdapter::DBIC');
+ #check for sqlite3 cmd line tool
+ my @sqlite_version = `sqlite3 -version`;
+ if ( !@sqlite_version ) {
+ skip "sqlite3 cmd line tool not found", 20;
+ }
+
system("cd t/ && $^X insertdb.pl") and die "can't create db: $!";
-}
-END { unlink('t/example.db') unless $ENV{PERL_DEBUG}; }
+ require Catalyst::Test;
+ Catalyst::Test->import('MyApp');
+ use Data::Dump qw( dump );
+ use HTTP::Request::Common;
-use lib qw( t/lib );
-use Catalyst::Test 'MyApp';
-use Data::Dump qw( dump );
-use HTTP::Request::Common;
+ ok( my $res = request('/test1'), "get /test1" );
+ is( $res->content, 13, "right number of results" );
+ ok( $res = request('/crud/test2?cd.title=Bad'), "get /test2" );
+ is( $res->content, 3, "iterator for cd.title=Bad" );
+ ok( $res = request('/crud/test3?cd.title=Bad'), "get /test3" );
+ is( $res->content, 3, "search for cd.title=Bad" );
+ ok( $res = request('/crud/test4?cd.title=Bad'), "get /test4" );
+ is( $res->content, 3, "count for cd.title=Bad" );
-ok( my $res = request('/test1'), "get /test1" );
-is( $res->content, 13, "right number of results" );
-ok( $res = request('/crud/test2?cd.title=Bad'), "get /test2" );
-is( $res->content, 3, "iterator for cd.title=Bad" );
-ok( $res = request('/crud/test3?cd.title=Bad'), "get /test3" );
-is( $res->content, 3, "search for cd.title=Bad" );
-ok( $res = request('/crud/test4?cd.title=Bad'), "get /test4" );
-is( $res->content, 3, "count for cd.title=Bad" );
+ # read
+ ok( $res = request( HTTP::Request->new( GET => '/crud/1/view' ) ),
+ "GET view" );
-# read
-ok( $res = request( HTTP::Request->new( GET => '/crud/1/view' ) ),
- "GET view" );
+ #diag( $res->content );
+ is_deeply(
+ eval $res->content,
+ { title => "Beat It", trackid => 1 },
+ "GET track 1"
+ );
-#diag( $res->content );
-is_deeply(
- eval $res->content,
- { title => "Beat It", trackid => 1 },
- "GET track 1"
-);
+ # create
+ ok( $res = request(
+ POST(
+ '/crud/0/save',
+ [ title => 'Something New, Something Blue',
+ trackid => 8
+ ]
+ )
+ ),
+ "POST new track"
+ );
-# create
-ok( $res = request(
- POST(
- '/crud/0/save',
- [ title => 'Something New, Something Blue',
- trackid => 8
- ]
- )
- ),
- "POST new track"
-);
+ #diag( $res->content );
+ is_deeply(
+ eval $res->content,
+ { title => "Something New, Something Blue", trackid => 8 },
+ "POST new track"
+ );
-#diag( $res->content );
-is_deeply(
- eval $res->content,
- { title => "Something New, Something Blue", trackid => 8 },
- "POST new track"
-);
+ # GET new track
+ ok( $res = request('/crud/8/view'), "get /crud/8/view" );
+ is_deeply(
+ eval $res->content,
+ { title => "Something New, Something Blue", trackid => 8 },
+ "GET new track"
+ );
-# GET new track
-ok( $res = request('/crud/8/view'), "get /crud/8/view" );
-is_deeply(
- eval $res->content,
- { title => "Something New, Something Blue", trackid => 8 },
- "GET new track"
-);
+ # multiple column search
+ ok( $res = request(
+ POST(
+ '/crud/search',
+ [ 'cxc-query' => qq/me.trackid=7/,
+ 'cxc-order' => 'me.trackid ASC me.title DESC',
+ ]
+ )
+ ),
+ 'multi-column sort POST'
+ );
-# multiple column search
-ok( $res = request(
- POST(
- '/crud/search',
- [ 'cxc-query' => qq/me.trackid=7/,
- 'cxc-order' => 'me.trackid ASC me.title DESC',
- ]
- )
- ),
- 'multi-column sort POST'
-);
+ #warn $res->content;
-#warn $res->content;
+ is_deeply(
+ eval $res->content,
+ { title => "The Way I Am", trackid => 7 },
+ 'multi-column sort'
+ );
-is_deeply(
- eval $res->content,
- { title => "The Way I Am", trackid => 7 },
- 'multi-column sort'
-);
+ # test *_related features
-# test *_related features
+ ok( $res = request(
+ POST( '/crud/3/cds/1/add', [] ), "/crud/3/tracks/1/add"
+ )
+ );
-ok( $res = request( POST( '/crud/3/cds/1/add', [] ), "/crud/3/tracks/1/add" )
-);
+ is( $res->headers->{status}, 204, "POST returned OK" );
-is( $res->headers->{status}, 204, "POST returned OK" );
+ #dump $res;
-#dump $res;
+ ok( $res = request(
+ POST( '/crud/3/cds/1/remove', [] ),
+ "/crud/3/tracks/1/remove"
+ )
+ );
-ok( $res = request(
- POST( '/crud/3/cds/1/remove', [] ),
- "/crud/3/tracks/1/remove"
- )
-);
+ is( $res->headers->{status}, 204, "POST returned OK" );
-is( $res->headers->{status}, 204, "POST returned OK" );
+ #dump $res;
-#dump $res;
-
+} # end SKIP
Modified: CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/t/insertdb.pl
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/t/insertdb.pl 2009-07-13 14:40:32 UTC (rev 10881)
+++ CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/t/insertdb.pl 2009-07-14 19:29:30 UTC (rev 10882)
@@ -2,6 +2,7 @@
use MyDB::Main;
use strict;
+use Data::Dump qw( dump );
my $schema = MyDB::Main->connect('dbi:SQLite:example.db');
my $dbh = $schema->storage->dbh;
@@ -60,9 +61,11 @@
foreach my $lp ( sort keys %albums ) {
my $artist
= $schema->resultset('Artist')->search( { name => $albums{$lp} } );
- push @cds, [ $lp, $artist->first ];
+ push @cds, [ $lp, $artist->first->artistid ];
}
+#warn dump \@cds;
+
$schema->populate( 'Cd', [ [qw/title artist/], @cds, ] );
my %tracks = (
More information about the Catalyst-commits
mailing list