Correct site spec

This commit is contained in:
Sam 2015-09-28 16:49:39 +10:00
parent 1061a9ed06
commit 6c37b26b24
2 changed files with 4 additions and 1 deletions

View File

@ -29,7 +29,7 @@ class Site
@categories ||= begin
categories = Category
.secured(@guardian)
.joins('JOIN topics t on t.id = categories.topic_id')
.joins('LEFT JOIN topics t on t.id = categories.topic_id')
.select('categories.*, t.slug topic_slug')
.order(:position)

View File

@ -3,6 +3,9 @@ require_dependency 'site'
describe Site do
it "omits categories users can not write to from the category list" do
ActiveRecord::Base.observers.enable :anon_site_json_cache_observer
category = Fabricate(:category)
user = Fabricate(:user)