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

sunnavy at bestpractical.com sunnavy at bestpractical.com
Mon Aug 31 02:26:33 EDT 2009


The branch, master has been updated
       via  36a381c93987818d25f40ef5e723727cd2a95e4a (commit)
      from  89403a4a7a024de91a9da3dcca74f4b366e6c042 (commit)

Summary of changes:
 lib/Net/Lighthouse/Token.pm |   32 +++++++++++++++++++++++++++-----
 t/08-token.t                |   15 +++++++++++----
 2 files changed, 38 insertions(+), 9 deletions(-)

- Log -----------------------------------------------------------------
commit 36a381c93987818d25f40ef5e723727cd2a95e4a
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Mon Aug 31 14:26:25 2009 +0800

    update token attrs

diff --git a/lib/Net/Lighthouse/Token.pm b/lib/Net/Lighthouse/Token.pm
index 8059bee..137349c 100644
--- a/lib/Net/Lighthouse/Token.pm
+++ b/lib/Net/Lighthouse/Token.pm
@@ -5,13 +5,35 @@ use Params::Validate ':all';
 use Net::Lighthouse::Util;
 
 # read only attr
-has [
-    'project_id', 'account',   'user_id', 'created_at',
-    'token',      'read_only', 'note'
-  ] => (
+has 'created_at' => (
+    isa => 'DateTime',
+    is  => 'ro',
+);
+
+has 'user_id' => (
+    isa => 'Int',
+    is  => 'ro',
+);
+
+has 'project_id' => (
+    isa => 'Maybe[Int]',
+    is  => 'ro',
+);
+
+has 'read_only' => (
+    isa => 'Bool',
+    is  => 'ro',
+);
+
+has 'token' => (
+    isa => 'Str',
+    is  => 'ro',
+);
+
+has [ 'account', 'note' ] => (
     isa => 'Maybe[Str]',
     is  => 'ro',
-  );
+);
 
 no Any::Moose;
 __PACKAGE__->meta->make_immutable;
diff --git a/t/08-token.t b/t/08-token.t
index 4fea311..6023911 100644
--- a/t/08-token.t
+++ b/t/08-token.t
@@ -27,15 +27,22 @@ my $xml = do {
 my $m = $token->load_from_xml($xml);
 is( $m, $token, 'load return $self' );
 my %hash = (
-    'created_at' => '2007-04-21T18:17:32Z',
+    'created_at' => DateTime->new(
+        year   => 2007,
+        month  => 4,
+        day    => 21,
+        hour   => 18,
+        minute => 17,
+        second => 32,
+    ),
     'account'    => 'http://activereload.lighthouseapp.com',
-    'read_only'  => 'false',
-    'user_id'    => '1',
+    'read_only'  => 0,
+    'user_id'    => 1,
     'token'      => '01234567890123456789012345678900123456789',
     'project_id' => '',
     'note'       => 'test 1'
 );
 
 for my $k ( keys %hash ) {
-    is( $m->$k, $hash{$k}, "$k is loaded" );
+    is_deeply( $m->$k, $hash{$k}, "$k is loaded" );
 }

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



More information about the Bps-public-commit mailing list