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

Shawn Moore sartak at bestpractical.com
Wed Feb 9 18:00:46 EST 2011


The branch, master has been updated
       via  8764430280de3b7098bef214546a1878ba2f281d (commit)
      from  f37f3ec3f3bf4aab8aaebde9de276a26c26e07b6 (commit)

Summary of changes:
 t/TestApp-Plugin-RecordHistory/t/001-basic.t |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

- Log -----------------------------------------------------------------
commit 8764430280de3b7098bef214546a1878ba2f281d
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Wed Feb 9 18:00:19 2011 -0500

    Tests for updating a record

diff --git a/t/TestApp-Plugin-RecordHistory/t/001-basic.t b/t/TestApp-Plugin-RecordHistory/t/001-basic.t
index 173e9d6..e9dcfe9 100644
--- a/t/TestApp-Plugin-RecordHistory/t/001-basic.t
+++ b/t/TestApp-Plugin-RecordHistory/t/001-basic.t
@@ -21,3 +21,18 @@ is($change->record->title, '1984', 'change->record');
 isa_ok($change->change_fields, 'Jifty::Plugin::RecordHistory::Model::ChangeFieldCollection', 'change field collection');
 is($change->change_fields->count, 0, 'generate no ChangeFields for create');
 
+$book->set_title('Nineteen Eighty-Four');
+
+isa_ok($book->changes, 'Jifty::Plugin::RecordHistory::Model::ChangeCollection');
+is($book->changes->count, 2, 'two changes');
+is($book->changes->first->type, 'create', 'first change is the create');
+$change = $book->changes->last;
+is($change->type, 'update', 'second change is the update');
+is($change->change_fields->count, 1, 'one field updated');
+
+my $change_field = $change->change_fields->first;
+is($change_field->change->id, $change->id, 'associated with the right change');
+is($change_field->field, 'title');
+is($change_field->new_value, 'Nineteen Eighty-Four');
+is($change_field->old_value, '1984');
+

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



More information about the Bps-public-commit mailing list