mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 10:20:58 -06:00
DEV: fix the fix for flakey test 😓
We should not be clearing **all** the advanced search filters and orders, because some are required by the application.
This commit is contained in:
parent
967e49af59
commit
19b7b22627
@ -2642,11 +2642,6 @@ RSpec.describe Search do
|
||||
end
|
||||
let!(:post1) { Fabricate(:post, raw: "this is the second post about advanced filter") }
|
||||
|
||||
after do
|
||||
Search.advanced_filters.clear
|
||||
Search.advanced_orders.clear
|
||||
end
|
||||
|
||||
it "allows to define custom filter" do
|
||||
expect(Search.new("advanced").execute.posts).to eq([post1, post0])
|
||||
|
||||
@ -2655,6 +2650,8 @@ RSpec.describe Search do
|
||||
end
|
||||
|
||||
expect(Search.new("advanced min_chars:50").execute.posts).to eq([post0])
|
||||
ensure
|
||||
Search.advanced_filters.delete(/^min_chars:(\d+)$/)
|
||||
end
|
||||
|
||||
it "allows to define custom order" do
|
||||
@ -2663,6 +2660,8 @@ RSpec.describe Search do
|
||||
Search.advanced_order(:chars) { |posts| posts.reorder("MAX(LENGTH(posts.raw)) DESC") }
|
||||
|
||||
expect(Search.new("advanced order:chars").execute.posts).to eq([post0, post1])
|
||||
ensure
|
||||
Search.advanced_orders.delete(:chars)
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user