Fixes broken spec

This commit is contained in:
Robin Ward 2015-03-20 13:24:03 -04:00
parent 605fe4b11d
commit 3c0fee1786
2 changed files with 6 additions and 5 deletions

View File

@ -52,9 +52,9 @@ class DirectoryItem < ActiveRecord::Base
AND COALESCE(t.visible, true)
AND COALESCE(t.archetype, 'regular') = 'regular'
AND p.deleted_at IS NULL
AND NOT (COALESCE(p.hidden, false))
AND NOT COALESCE(c.read_restricted, false)
AND p.post_type != :moderator_action
AND (NOT (COALESCE(p.hidden, false)))
AND (NOT COALESCE(c.read_restricted, false))
AND COALESCE(p.post_type, :regular_post_type) != :moderator_action
AND u.id > 0
GROUP BY u.id",
period_type: period_types[period_type],
@ -63,6 +63,7 @@ class DirectoryItem < ActiveRecord::Base
was_liked_type: UserAction::WAS_LIKED,
new_topic_type: UserAction::NEW_TOPIC,
reply_type: UserAction::REPLY,
regular_post_type: Post.types[:regular],
moderator_action: Post.types[:moderator_action]
end
end

View File

@ -2,12 +2,12 @@ require 'spec_helper'
describe DirectoryItem do
context 'refresh' do
let!(:user) { Fabricate(:user) }
let!(:post) { Fabricate(:post) }
it "creates the record for the user" do
DirectoryItem.refresh!
expect(DirectoryItem.where(period_type: DirectoryItem.period_types[:all])
.where(user_id: user.id)
.where(user_id: post.user.id)
.exists?).to be_true
end