Fixes broken spec
This commit is contained in:
parent
605fe4b11d
commit
3c0fee1786
|
@ -52,9 +52,9 @@ class DirectoryItem < ActiveRecord::Base
|
||||||
AND COALESCE(t.visible, true)
|
AND COALESCE(t.visible, true)
|
||||||
AND COALESCE(t.archetype, 'regular') = 'regular'
|
AND COALESCE(t.archetype, 'regular') = 'regular'
|
||||||
AND p.deleted_at IS NULL
|
AND p.deleted_at IS NULL
|
||||||
AND NOT (COALESCE(p.hidden, false))
|
AND (NOT (COALESCE(p.hidden, false)))
|
||||||
AND NOT COALESCE(c.read_restricted, false)
|
AND (NOT COALESCE(c.read_restricted, false))
|
||||||
AND p.post_type != :moderator_action
|
AND COALESCE(p.post_type, :regular_post_type) != :moderator_action
|
||||||
AND u.id > 0
|
AND u.id > 0
|
||||||
GROUP BY u.id",
|
GROUP BY u.id",
|
||||||
period_type: period_types[period_type],
|
period_type: period_types[period_type],
|
||||||
|
@ -63,6 +63,7 @@ class DirectoryItem < ActiveRecord::Base
|
||||||
was_liked_type: UserAction::WAS_LIKED,
|
was_liked_type: UserAction::WAS_LIKED,
|
||||||
new_topic_type: UserAction::NEW_TOPIC,
|
new_topic_type: UserAction::NEW_TOPIC,
|
||||||
reply_type: UserAction::REPLY,
|
reply_type: UserAction::REPLY,
|
||||||
|
regular_post_type: Post.types[:regular],
|
||||||
moderator_action: Post.types[:moderator_action]
|
moderator_action: Post.types[:moderator_action]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,12 +2,12 @@ require 'spec_helper'
|
||||||
|
|
||||||
describe DirectoryItem do
|
describe DirectoryItem do
|
||||||
context 'refresh' do
|
context 'refresh' do
|
||||||
let!(:user) { Fabricate(:user) }
|
let!(:post) { Fabricate(:post) }
|
||||||
|
|
||||||
it "creates the record for the user" do
|
it "creates the record for the user" do
|
||||||
DirectoryItem.refresh!
|
DirectoryItem.refresh!
|
||||||
expect(DirectoryItem.where(period_type: DirectoryItem.period_types[:all])
|
expect(DirectoryItem.where(period_type: DirectoryItem.period_types[:all])
|
||||||
.where(user_id: user.id)
|
.where(user_id: post.user.id)
|
||||||
.exists?).to be_true
|
.exists?).to be_true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue