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=cf2290becfa2e2c35b4e8a5981650851a34f33ce;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 a401ebe..7d8b0c7 100644 --- a/t/text_tradition_user.t +++ b/t/text_tradition_user.t @@ -115,6 +115,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(