Check for exact text in have_ckeditor

If we don't use the `exact` option, tests will pass even if filling in
CKEditor adds the content twice or adds the new content to the existing
content, which has actually happened and has gone mostly unnoticed while
testing several ways to fill in CKEditor with Capybara (particularly,
when using Capybara's `send_keys` method). The problem was detected by
just one test, which checked the original content wasn't present anymore
after updating a record.
This commit is contained in:
Javi Martín
2020-05-27 18:49:31 +02:00
parent 4aee1d28cf
commit 4d65507cbb

View File

@@ -15,7 +15,7 @@ RSpec::Matchers.define :have_ckeditor do |label, with:|
return false unless has_ckeditor?
page.within(ckeditor_id) do
within_frame(0) { has_content?(with) }
within_frame(0) { has_content?(with, exact: true) }
end
end