[Bps-public-commit] jifty-plugin-recordhistory branch, master, updated. 0.05-7-gb78cf3b

Shawn Moore sartak at bestpractical.com
Thu Feb 24 18:59:01 EST 2011


The branch, master has been updated
       via  b78cf3b880a0117b171fe80d82d36fb70500e7a7 (commit)
      from  a28f456ea45a84ae25c271d339d81345be06d063 (commit)

Summary of changes:
 .../TestApp/Plugin/RecordHistory/Model/Ticket.pm   |   12 ++++++------
 .../t/008-access-control.t                         |    8 ++++----
 2 files changed, 10 insertions(+), 10 deletions(-)

- Log -----------------------------------------------------------------
commit b78cf3b880a0117b171fe80d82d36fb70500e7a7
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Thu Feb 24 18:58:52 2011 -0500

    Let's use column names that won't collide with Jifty

diff --git a/t/TestApp-Plugin-RecordHistory/lib/TestApp/Plugin/RecordHistory/Model/Ticket.pm b/t/TestApp-Plugin-RecordHistory/lib/TestApp/Plugin/RecordHistory/Model/Ticket.pm
index 81fc206..8bf09b5 100644
--- a/t/TestApp-Plugin-RecordHistory/lib/TestApp/Plugin/RecordHistory/Model/Ticket.pm
+++ b/t/TestApp-Plugin-RecordHistory/lib/TestApp/Plugin/RecordHistory/Model/Ticket.pm
@@ -7,13 +7,13 @@ use Jifty::DBI::Schema;
 use TestApp::Plugin::RecordHistory::Record schema {
     column subject =>
         type is 'varchar';
-    column readable =>
+    column forced_readable =>
         type is 'integer',
         default is 1;
-    column updatable =>
+    column forced_updatable =>
         type is 'integer',
         default is 1;
-    column deletable =>
+    column forced_deletable =>
         type is 'integer',
         default is 1;
 };
@@ -25,9 +25,9 @@ sub current_user_can {
     my $right = shift;
 
     return 1 if $right eq 'create';
-    return 1 if $right eq 'read'   && $self->__value('readable');
-    return 1 if $right eq 'update' && $self->__value('updatable');
-    return 1 if $right eq 'delete' && $self->__value('deletable');
+    return 1 if $right eq 'read'   && $self->__value('forced_readable');
+    return 1 if $right eq 'update' && $self->__value('forced_updatable');
+    return 1 if $right eq 'delete' && $self->__value('forced_deletable');
 
     return $self->SUPER::current_user_can($right, @_);
 }
diff --git a/t/TestApp-Plugin-RecordHistory/t/008-access-control.t b/t/TestApp-Plugin-RecordHistory/t/008-access-control.t
index 071b0b7..dc4a880 100644
--- a/t/TestApp-Plugin-RecordHistory/t/008-access-control.t
+++ b/t/TestApp-Plugin-RecordHistory/t/008-access-control.t
@@ -52,7 +52,7 @@ is($change_field->old_value, 'Hello world');
 is($change_field->current_user->id, $user->id, 'current user is the user not superuser');
 ok(!$change_field->current_user->is_superuser, 'not superuser');
 
-$ticket->set_updatable(0);
+$ticket->set_forced_updatable(0);
 
 isa_ok($ticket->changes, 'Jifty::Plugin::RecordHistory::Model::ChangeCollection');
 is($ticket->changes->count, 3, 'three changes');
@@ -66,7 +66,7 @@ ok(!$change->current_user->is_superuser, 'not superuser');
 
 my $change_field = $change->change_fields->first;
 is($change_field->change->id, $change->id, 'associated with the right change');
-is($change_field->field, 'updatable');
+is($change_field->field, 'forced_updatable');
 is($change_field->new_value, 0);
 is($change_field->old_value, 1);
 
@@ -74,8 +74,8 @@ is($change_field->current_user->id, $user->id, 'current user is the user not sup
 ok(!$change_field->current_user->is_superuser, 'not superuser');
 
 # make sure we don't create spurious changes when a record couldn't be updated
-$ticket->set_updatable(1);
-is($ticket->updatable, 0, "ticket was not updated");
+$ticket->set_forced_updatable(1);
+is($ticket->forced_updatable, 0, "ticket was not updated");
 is($ticket->changes->count, 3, "still only three changes since we couldn't update the record");
 
 $change = Jifty::Plugin::RecordHistory::Model::Change->new(current_user => $current_user);

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



More information about the Bps-public-commit mailing list