From 48ef6090035f655884cc83c253bf5ce2d16608e8 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 2 Nov 2015 15:05:08 +1100 Subject: [PATCH] correct implementation add tests --- lib/topic_query.rb | 2 +- spec/components/topic_query_spec.rb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/topic_query.rb b/lib/topic_query.rb index 32a09aa70..b02c3148e 100644 --- a/lib/topic_query.rb +++ b/lib/topic_query.rb @@ -201,7 +201,7 @@ class TopicQuery def latest_results(options={}) result = default_results(options) - result = remove_muted_topics(result, @user) unless options && options[:state] = "muted".freeze + result = remove_muted_topics(result, @user) unless options && options[:state] == "muted".freeze result = remove_muted_categories(result, @user, exclude: options[:category]) result end diff --git a/spec/components/topic_query_spec.rb b/spec/components/topic_query_spec.rb index c06c6623b..bb99bc35b 100644 --- a/spec/components/topic_query_spec.rb +++ b/spec/components/topic_query_spec.rb @@ -374,6 +374,7 @@ describe TopicQuery do it "returns an empty set" do expect(topics).to be_blank + expect(topic_query.list_latest.topics).to be_blank end context 'un-muted' do @@ -383,6 +384,7 @@ describe TopicQuery do it "returns the topic again" do expect(topics).to eq([new_topic]) + expect(topic_query.list_latest.topics).not_to be_blank end end end