Add search test

This commit is contained in:
Jorge Manrubia
2025-06-24 13:17:21 +02:00
parent 0fe54e2047
commit 9be20e8850
+23
View File
@@ -0,0 +1,23 @@
require "test_helper"
class SearchTest < ActiveSupport::TestCase
setup do
Card.all.each(&:reindex)
Comment.all.each(&:reindex)
@user = users(:kevin)
end
test "search cards and comments" do
assert @user.search("layout").find { it.card == cards(:layout) }
assert @user.search("overflowing").find { it.comment == comments(:layout_overflowing_david) }
end
test "don't include innaccessible" do
collections(:writebook).update! all_access: false
collections(:writebook).accesses.revoke_from(@user)
assert_not @user.search("layout").find { it.card == cards(:layout) }
assert_not @user.search("overflowing").find { it.comment == comments(:layout_overflowing_david) }
end
end