Fix CurrentUser issue with tests

For some tests, the current user wasn't set by the time the CurrentUser
variable was used in several of the models.
This commit is contained in:
BrokenEagle
2020-07-19 03:58:02 +00:00
parent b2a2c4e140
commit e34e7b0d90
2 changed files with 3 additions and 3 deletions

View File

@@ -25,7 +25,7 @@ class PostVote < ApplicationRecord
end
def initialize_attributes
self.user_id ||= CurrentUser.user.id
self.user_id ||= CurrentUser.id
if vote == "up"
self.score = 1

View File

@@ -189,12 +189,12 @@ class WikiPage < ApplicationRecord
def merge_version?
prev = versions.last
prev && prev.updater_id == CurrentUser.user.id && prev.updated_at > 1.hour.ago
prev && prev.updater_id == CurrentUser.id && prev.updated_at > 1.hour.ago
end
def create_new_version
versions.create(
:updater_id => CurrentUser.user.id,
:updater_id => CurrentUser.id,
:updater_ip_addr => CurrentUser.ip_addr,
:title => title,
:body => body,