REFACTOR: remove hacky search from discovery

This commit is contained in:
Sam
2015-07-27 16:46:50 +10:00
parent 41ceff8430
commit 2876725e1b
17 changed files with 17 additions and 159 deletions

View File

@ -48,28 +48,10 @@ describe TopicQuery do
expect(TopicQuery.new(nil).list_topics_by(user).topics.count).to eq(1)
expect(TopicQuery.new(user).list_topics_by(user).topics.count).to eq(2)
# search should return nothing normally
expect(TopicQuery.new(nil).list_search.topics.count).to eq(0)
end
end
context 'search' do
it 'can correctly search' do
# got to enable indexing
ActiveRecord::Base.observers.enable :all
p = create_post(raw: "I am super awesome and search will find me")
create_post(topic_id: p.topic_id, raw: "I am super spectacular post of doom")
results = TopicQuery.new(nil, q: "doom").list_search
expect(results.topics.count).to eq(1)
end
end
context 'bookmarks' do
it "filters and returns bookmarks correctly" do
post = Fabricate(:post)