سؤال

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.

هل كانت مفيدة؟

المحلول

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)
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top