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:
@@ -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) }
|
||||
|
||||
Reference in New Issue
Block a user