From 7b6e85cb6cd987f5d16020507519f8a0192c8abe Mon Sep 17 00:00:00 2001 From: Sam <sam.saffron@gmail.com> Date: Wed, 25 Feb 2015 14:39:50 +1100 Subject: [PATCH] remove unused api call correct spec --- lib/topic_query.rb | 4 ---- spec/components/topic_query_spec.rb | 18 +++++++----------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/lib/topic_query.rb b/lib/topic_query.rb index 6f932f172..8057974b7 100644 --- a/lib/topic_query.rb +++ b/lib/topic_query.rb @@ -127,10 +127,6 @@ class TopicQuery create_list(:private_messages, {}, list) end - def list_category(category) - create_list(:category, unordered: true, category: category.id) - end - def list_category_topic_ids(category) query = default_results(category: category.id) pinned_ids = query.where('pinned_at IS NOT NULL').order('pinned_at DESC').pluck(:id) diff --git a/spec/components/topic_query_spec.rb b/spec/components/topic_query_spec.rb index eafd8a5b7..f5a56bd0e 100644 --- a/spec/components/topic_query_spec.rb +++ b/spec/components/topic_query_spec.rb @@ -243,20 +243,16 @@ describe TopicQuery do let(:category) { Fabricate(:category) } let(:topic_category) { category.topic } let!(:topic_no_cat) { Fabricate(:topic) } - let!(:topic_in_cat) { Fabricate(:topic, category: category) } - - it "returns the topic with a category when filtering by category" do - expect(topic_query.list_category(category).topics).to eq([topic_category, topic_in_cat]) - end - - it "returns only the topic category when filtering by another category" do - another_category = Fabricate(:category, name: 'new cat') - expect(topic_query.list_category(another_category).topics).to eq([another_category.topic]) - end + let!(:topic_in_cat1) { Fabricate(:topic, category: category, + bumped_at: 10.minutes.ago, + created_at: 10.minutes.ago) } + let!(:topic_in_cat2) { Fabricate(:topic, category: category) } describe '#list_new_in_category' do it 'returns the topic category and the categorized topic' do - expect(topic_query.list_new_in_category(category).topics).to eq([topic_in_cat, topic_category]) + expect( + topic_query.list_new_in_category(category).topics.map(&:id) + ).to eq([topic_in_cat2.id, topic_category.id, topic_in_cat1.id]) end end end