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:
@@ -15,7 +15,7 @@ RSpec::Matchers.define :have_ckeditor do |label, with:|
|
|||||||
return false unless has_ckeditor?
|
return false unless has_ckeditor?
|
||||||
|
|
||||||
page.within(ckeditor_id) do
|
page.within(ckeditor_id) do
|
||||||
within_frame(0) { has_content?(with) }
|
within_frame(0) { has_content?(with, exact: true) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user