Add matcher for CKEditor fields
This commit is contained in:
@@ -55,15 +55,15 @@ describe "Admin edit translatable records" do
|
|||||||
|
|
||||||
visit path
|
visit path
|
||||||
|
|
||||||
within_frame(0) { expect(page).to have_content "Content in English" }
|
expect(page).to have_ckeditor "Content", with: "Content in English"
|
||||||
|
|
||||||
select "Español", from: :select_language
|
select "Español", from: :select_language
|
||||||
|
|
||||||
within_frame(0) { expect(page).to have_content "Contenido en español" }
|
expect(page).to have_ckeditor "Content", with: "Contenido en español"
|
||||||
|
|
||||||
select "Français", from: :select_language
|
select "Français", from: :select_language
|
||||||
|
|
||||||
within_frame(0) { expect(page).to have_content "Contenu en Français" }
|
expect(page).to have_ckeditor "Content", with: "Contenu en Français"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ describe "Admin edit translatable records" do
|
|||||||
|
|
||||||
select "Français", from: :select_language
|
select "Français", from: :select_language
|
||||||
|
|
||||||
within_frame(0) { expect(page.text).to be_empty }
|
expect(page). to have_ckeditor "Description", with: ""
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -237,7 +237,7 @@ describe "Admin edit translatable records" do
|
|||||||
select("Español", from: "locale-switcher")
|
select("Español", from: "locale-switcher")
|
||||||
|
|
||||||
expect(page).to have_field "Respuesta", with: "Respuesta corregida"
|
expect(page).to have_field "Respuesta", with: "Respuesta corregida"
|
||||||
within_frame(0) { expect(page).to have_content "Descripción corregida" }
|
expect(page).to have_ckeditor "Descripción", with: "Descripción corregida"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ describe "Public area translatable records" do
|
|||||||
select "Español", from: "locale-switcher"
|
select "Español", from: "locale-switcher"
|
||||||
|
|
||||||
expect(page).to have_field "Título del debate", with: "Título corregido"
|
expect(page).to have_field "Título del debate", with: "Título corregido"
|
||||||
within_frame(0) { expect(page).to have_content "Texto corregido" }
|
expect(page).to have_ckeditor "Texto inicial del debate", with: "Texto corregido"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
19
spec/support/matchers/have_ckeditor.rb
Normal file
19
spec/support/matchers/have_ckeditor.rb
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
RSpec::Matchers.define :have_ckeditor do |label, with:|
|
||||||
|
match do
|
||||||
|
return false unless has_css?(".ckeditor", text: label)
|
||||||
|
|
||||||
|
page.within(".ckeditor", text: label) do
|
||||||
|
within_frame(0) { has_content?(with) }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
failure_message do
|
||||||
|
if has_css?(".ckeditor", text: label)
|
||||||
|
text = page.within(".ckeditor", text: label) { within_frame(0) { page.text } }
|
||||||
|
|
||||||
|
"expected to find visible CKEditor '#{label}' with '#{with}', but had '#{text}'"
|
||||||
|
else
|
||||||
|
"expected to find visible CKEditor '#{label}' but there were no matches."
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user