How to validate if keyword matched is highlighed or not in Ruby and Rails
-
12-10-2019 - |
Pergunta
I am writing a testing script using Ruby and Rails. I have to validate whether proper keyword is highlighted or not. How do i do in rub. For eg. "confidential" is my keyword and want to validate whether it got highlighted or not.
Solução
Assuming you highlight your keyword with <em>
-tags and have a HighLighter class that does the highlighting:
assert_contains "<em>confidential</em>", HighLighter.highlight(text)
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow