[Bps-public-commit] jifty-plugin-recordhistory branch, master, updated. c93df1661e27587220c1743f09ee3840554cf119

Shawn Moore sartak at bestpractical.com
Wed Feb 9 21:28:55 EST 2011


The branch, master has been updated
       via  c93df1661e27587220c1743f09ee3840554cf119 (commit)
      from  41db4380c6095b013a56d7d7ab440cc8a946c87f (commit)

Summary of changes:
 t/TestApp-Plugin-RecordHistory/t/003-action.t |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

- Log -----------------------------------------------------------------
commit c93df1661e27587220c1743f09ee3840554cf119
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Wed Feb 9 21:28:41 2011 -0500

    Test the actual change_field entries

diff --git a/t/TestApp-Plugin-RecordHistory/t/003-action.t b/t/TestApp-Plugin-RecordHistory/t/003-action.t
index ec3805c..0e9882a 100644
--- a/t/TestApp-Plugin-RecordHistory/t/003-action.t
+++ b/t/TestApp-Plugin-RecordHistory/t/003-action.t
@@ -2,11 +2,12 @@
 use warnings;
 use strict;
 
-use Jifty::Test::Dist tests => 7;
+use Jifty::Test::Dist tests => 13;
 
 my $book = TestApp::Plugin::RecordHistory::Model::Book->new;
 $book->create(
-    title => '1984',
+    title  => '1984',
+    author => 'George Orwell',
 );
 ok($book->id, 'created a book');
 
@@ -32,3 +33,19 @@ my $change = $book->changes->last;
 is($change->type, 'update', 'second change is the update');
 is($change->change_fields->count, 2, 'two fields updated');
 
+my @change_fields = sort { $a->field cmp $b->field } @{ $change->change_fields->items_array_ref };
+is($change_fields[0]->field, 'author', 'first update is to author');
+TODO: {
+    local $TODO = "we don't get old_value in the callback yet";
+    is($change_fields[0]->old_value, 'George Orwell', 'old value of author is George');
+}
+is($change_fields[0]->new_value, 'Aldous Huxley', 'new value of author is Aldous');
+
+is($change_fields[1]->field, 'title', 'second update is to title');
+TODO: {
+    local $TODO = "we don't get old_value in the callback yet";
+    is($change_fields[1]->old_value, '1984', 'old value of author is 1984');
+}
+is($change_fields[1]->new_value, 'Brave New World', 'new value of author is BNW');
+
+

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



More information about the Bps-public-commit mailing list