Testing CKEditor in Ruby on Rails with Cucumber/Capybara

Mar 09, 2011 20:25


Originally published at Sara Trice. You can comment here or there.

I have a textarea with the id of “request_details”, made into a CKEditor instance by jQuery: $(‘#request_details’).ckeditor();

(Check this page if you need some help getting CKEditor to work with jQuery, it’s dead simple)

Feature looks like this:  And I fill in "Here are some details" in the CKEditor instance "request_details"

Step looks like this:

When /^I fill in "([^"]*)" in the CKEditor instance "([^"]*)"$/ do |value, input_id|
browser = page.driver.browser
browser.execute_script("CKEDITOR.instances['#{input_id}'].setData('#{value}');")
end

tech

Previous post Next post
Up