Use more consistent parameter names

I incorrectly used "text" as variable name in commit 2cdc6a1b. In
similar places, we use `label`. We also use named parameters when only
`with:` is provided.
This commit is contained in:
Javi Martín
2020-04-17 16:15:33 +02:00
parent 5b97b20f96
commit a103b5392e

View File

@@ -44,8 +44,8 @@ module Verifications
end end
end end
def fill_in_ckeditor(text, params = {}) def fill_in_ckeditor(label, with:)
locator = find("label", text: text)[:for] locator = find("label", text: label)[:for]
until page.execute_script("return CKEDITOR.instances.#{locator}.status === 'ready';") do until page.execute_script("return CKEDITOR.instances.#{locator}.status === 'ready';") do
sleep 0.01 sleep 0.01
@@ -54,11 +54,11 @@ module Verifications
# Fill the editor content # Fill the editor content
page.execute_script <<-SCRIPT page.execute_script <<-SCRIPT
var ckeditor = CKEDITOR.instances.#{locator} var ckeditor = CKEDITOR.instances.#{locator}
ckeditor.setData("#{params[:with]}") ckeditor.setData("#{with}")
ckeditor.focus() ckeditor.focus()
ckeditor.updateElement() ckeditor.updateElement()
SCRIPT SCRIPT
expect(page).to have_ckeditor text, with: params[:with] expect(page).to have_ckeditor label, with: with
end end
end end