From 6c37b26b24360aebd19d81db6363c6a7acc10502 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 28 Sep 2015 16:49:39 +1000 Subject: [PATCH] Correct site spec --- app/models/site.rb | 2 +- spec/models/site_spec.rb | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/models/site.rb b/app/models/site.rb index 60e60b39328..3459947b73c 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -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) diff --git a/spec/models/site_spec.rb b/spec/models/site_spec.rb index 392d1bf47a9..031a4564ff3 100644 --- a/spec/models/site_spec.rb +++ b/spec/models/site_spec.rb @@ -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)