fixing tests

This commit is contained in:
albert
2011-07-16 19:20:02 -04:00
parent 7d80057e20
commit 58c3d2af13
49 changed files with 896 additions and 488 deletions

View File

@@ -5,11 +5,16 @@ class JanitorTrial < ActiveRecord::Base
after_destroy :create_feedback
validates_presence_of :user
before_validation :initialize_creator
before_validation :initialize_original_level
def initialize_creator
self.creator_id = CurrentUser.id
end
def initialize_original_level
self.original_level = user.level
end
def user_name=(name)
self.user_id = User.name_to_id(name)
end
@@ -21,7 +26,7 @@ class JanitorTrial < ActiveRecord::Base
end
def promote_user
user.update_attribute(:is_janitor, true)
user.update_column(:level, User::Levels::JANITOR)
end
def create_feedback
@@ -36,7 +41,7 @@ class JanitorTrial < ActiveRecord::Base
end
def demote!
user.update_attribute(:is_janitor, false)
user.update_column(:level, original_level)
destroy
end
end