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

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


The branch, master has been updated
       via  841bae474d81aae54102730b81361f9e869bd4c9 (commit)
      from  f64e41793ec64db46a9436c4af7ba4e62a3fd004 (commit)

Summary of changes:
 t/TestApp-Plugin-RecordHistory/t/004-manual.t |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)

- Log -----------------------------------------------------------------
commit 841bae474d81aae54102730b81361f9e869bd4c9
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Wed Feb 9 21:55:04 2011 -0500

    Test that start_change - updates - end_change does the right thing

diff --git a/t/TestApp-Plugin-RecordHistory/t/004-manual.t b/t/TestApp-Plugin-RecordHistory/t/004-manual.t
index 87b57c0..89526f9 100644
--- a/t/TestApp-Plugin-RecordHistory/t/004-manual.t
+++ b/t/TestApp-Plugin-RecordHistory/t/004-manual.t
@@ -2,7 +2,7 @@
 use warnings;
 use strict;
 
-use Jifty::Test::Dist tests => 3;
+use Jifty::Test::Dist tests => 11;
 
 my $book = TestApp::Plugin::RecordHistory::Model::Book->new;
 $book->create(
@@ -18,3 +18,26 @@ $book->end_change;
 
 is($book->changes->count, 1, 'a change with no updates should not create a Change');
 
+$book->start_change;
+$book->set_title('Brave New World');
+$book->set_author('Aldous Huxley');
+$book->end_change;
+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