From: Jason Mills Date: Sat, 1 Mar 2014 01:59:30 +0000 (-0800) Subject: Working the problem X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c89870959e69b6a9ef527b3e17d0b69ea6d10b4c;p=dbsrgits%2FDBIx-Class-InflateColumn-Object-Enum.git Working the problem --- diff --git a/lib/DBIx/Class/InflateColumn/Object/Enum.pm b/lib/DBIx/Class/InflateColumn/Object/Enum.pm index 47040e3..0a0f0bd 100644 --- a/lib/DBIx/Class/InflateColumn/Object/Enum.pm +++ b/lib/DBIx/Class/InflateColumn/Object/Enum.pm @@ -109,6 +109,7 @@ sub register_column { inflate => sub { my $val = shift; my $e = Object::Enum->new({values=>$values}); + $self->make_column_dirty($column); $e->value($val); return $e; }, diff --git a/t/lib/TestDB/VarcharEnumNoneNullable.pm b/t/lib/TestDB/VarcharEnumNoneNullable.pm index 93187f4..3253207 100644 --- a/t/lib/TestDB/VarcharEnumNoneNullable.pm +++ b/t/lib/TestDB/VarcharEnumNoneNullable.pm @@ -24,6 +24,10 @@ __PACKAGE__->add_columns( extra => { list => [qw/red green blue/] }, + }, + foo => { + data_type => 'varchar', + is_nullable => 1 } ); __PACKAGE__->set_primary_key('id'); diff --git a/t/regres/rt_80705.t b/t/regres/rt_80705.t new file mode 100644 index 0000000..4f94be6 --- /dev/null +++ b/t/regres/rt_80705.t @@ -0,0 +1,26 @@ +use Test::More 'no_plan'; + +BEGIN { + use lib 't/lib'; + use_ok 'DBICx::TestDatabase'; + use_ok 'TestDB'; + use_ok 'Try::Tiny'; +} + +my $db = DBICx::TestDatabase->new('TestDB'); + +isa_ok $db, 'TestDB'; + +my $rs = $db->resultset('VarcharEnumNoneNullable'); + +my ($a, $b); + +ok $rs, 'got rs'; +ok $a = $rs->create({id => 1, enum => 'red'}), 'create a row'; +ok $a->foo('bar'), 'Set arbitrary column'; +ok $a->enum->is_red,'is red'; +ok $a->enum->set_blue,'set blue'; +ok $a->enum->is_blue,'confirm blue'; +ok $a->update, 'run update'; +ok $b = $rs->find($a->id), 'retrieve row from data'; +ok $b->enum->is_blue, 'confirm update'