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:
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user