Removes Debate.search & uses Debate.tagged_by when appropriate

Using `params` was wrong here because if given an inexistent tag,
@tag_filter was nil but the debates were still filtered by it (so the
listing and what the page title said were different)
This commit is contained in:
kikito
2015-09-03 11:17:21 +02:00
parent 002d86884b
commit e0f8f8d8de
3 changed files with 5 additions and 26 deletions

View File

@@ -174,21 +174,6 @@ describe Debate do
end
end
describe "#search" do
let!(:economy) { create(:debate, tag_list: "Economy") }
let!(:health) { create(:debate, tag_list: "Health") }
it "returns debates tagged with params tag" do
params = {tag: "Economy"}
expect(Debate.search(params)).to match_array([economy])
end
it "returns all debates if no parameters" do
params = {}
expect(Debate.search(params)).to match_array([economy, health])
end
end
describe '#default_order' do
let!(:economy) { create(:debate) }
let!(:health) { create(:debate) }