[Bps-public-commit] net-lighthouse branch, master, updated. d85b0762dc723f39eb222f016c856cf50a12fc3b

sunnavy at bestpractical.com sunnavy at bestpractical.com
Mon Aug 31 03:31:22 EDT 2009


The branch, master has been updated
       via  d85b0762dc723f39eb222f016c856cf50a12fc3b (commit)
      from  413fa7f1ac826ac226add7f47de0a47553cd6823 (commit)

Summary of changes:
 lib/Net/Lighthouse/Util.pm |    4 ++++
 t/08-token.t               |    2 +-
 t/09-milestone.t           |    6 +++---
 t/10-changeset.t           |    2 +-
 t/11-message.t             |    6 +++---
 5 files changed, 12 insertions(+), 8 deletions(-)

- Log -----------------------------------------------------------------
commit d85b0762dc723f39eb222f016c856cf50a12fc3b
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Mon Aug 31 15:31:05 2009 +0800

    if type is integer, let it be undef by default

diff --git a/lib/Net/Lighthouse/Util.pm b/lib/Net/Lighthouse/Util.pm
index 411469d..c4b85dd 100644
--- a/lib/Net/Lighthouse/Util.pm
+++ b/lib/Net/Lighthouse/Util.pm
@@ -31,6 +31,10 @@ sub translate_from_xml {
             elsif ( $ref->{$k}{type} && $ref->{$k}{type} eq 'yaml' ) {
                     $ref->{$k} = Load( $ref->{$k}{content} );
             }
+            elsif ( $ref->{$k}{type} && $ref->{$k}{type} eq 'integer' ) {
+                    $ref->{$k} =
+                      defined $ref->{$k}{content} ? $ref->{$k}{content} : undef;
+            }
             elsif ( defined $ref->{$k}{content} ) {
                 $ref->{$k} = $ref->{$k}{content};
             }
diff --git a/t/08-token.t b/t/08-token.t
index c05203c..5401016 100644
--- a/t/08-token.t
+++ b/t/08-token.t
@@ -40,7 +40,7 @@ my %hash = (
     'read_only'  => 0,
     'user_id'    => 1,
     'token'      => '01234567890123456789012345678900123456789',
-    'project_id' => '',
+    'project_id' => undef,
     'note'       => 'test 1'
 );
 
diff --git a/t/09-milestone.t b/t/09-milestone.t
index f5aa5f8..7bd7f0f 100644
--- a/t/09-milestone.t
+++ b/t/09-milestone.t
@@ -121,10 +121,10 @@ my $expect_initial_state = {
     'permalink'          => '',
     'created_at'         => undef,
     'goals_html'         => '',
-    'open_tickets_count' => '0',
-    'tickets_count'      => '0',
+    'open_tickets_count' => 0,
+    'tickets_count'      => 0,
     'title'              => '',
     'goals'              => '',
-    'project_id'         => '',
+    'project_id'         => undef,
 };
 is_deeply( $milestone->initial_state, $expect_initial_state, 'initial state' );
diff --git a/t/10-changeset.t b/t/10-changeset.t
index 43c0416..1dc23bf 100644
--- a/t/10-changeset.t
+++ b/t/10-changeset.t
@@ -102,7 +102,7 @@ my $expect_initial_state = {
     'body'     => '',
     'revision' => '',
     'changes'  => [],
-    'user_id'    => '',
+    'user_id'    => undef,
     'title'      => '',
     'body_html'  => '',
     'changed_at' => undef,
diff --git a/t/11-message.t b/t/11-message.t
index 441b5bf..ba2d5d1 100644
--- a/t/11-message.t
+++ b/t/11-message.t
@@ -122,7 +122,7 @@ $message = Net::Lighthouse::Project::Message->new(
 );
 
 my $expect_initial_state = {
-    'parent_id'         => '',
+    'parent_id'         => undef,
     'permalink'         => '',
     'body'              => '',
     'attachments_count' => '0',
@@ -130,9 +130,9 @@ my $expect_initial_state = {
     'updated_at'        => undef,
     'title'             => '',
     'body_html'         => '',
-    'user_id'           => '',
+    'user_id'           => undef,
     'comments_count'    => '0',
-    'project_id'        => ''
+    'project_id'        => undef 
 
 };
 is_deeply( $message->initial_state, $expect_initial_state, 'initial state' );

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list