From: Eden Cardim Date: Mon, 6 Aug 2012 15:58:33 +0000 (-0300) Subject: added test to asset user updates are propagating to the objects associated to traditions X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2a31057d01e4b6a2ce7dd109a2dd94178bd0ac09;p=scpubgit%2Fstemmatology.git added test to asset user updates are propagating to the objects associated to traditions --- diff --git a/t/text_tradition_user.t b/t/text_tradition_user.t index b9810b7..2c7b463 100644 --- a/t/text_tradition_user.t +++ b/t/text_tradition_user.t @@ -105,6 +105,27 @@ ok($changed->check_password('passbloggs'), 'Modified & retrieved with correct ne my $fetched_t = $user_store->tradition($tlist[0]->{id}); is($fetched_t->user->id, $user->id, 'Traditionlist returns item belonging to this user'); + { + # change attribute in the user object + my $email = $user->email; + $user->email('foo@bar.baz'); + $user_store->update($user); + + # refetch tradition + $fetched_t = $user_store->tradition($tlist[0]->{id}); + # assert that the associated user also changed + is($fetched_t->user->email, 'foo@bar.baz'); + + # change the email back to what it was + $user->email($email); + $user_store->update($user); + + # refetch tradition + $fetched_t = $user_store->tradition($tlist[0]->{id}); + # assert that email has actually been reverted + is($fetched_t->user->email, $email); + } + ## add a second, not owned by this user, we shouldn't return it from ## traditionslist my $t2 = Text::Tradition->new(