I needed to add TinyMCE to a form for WYSIWYG editing (which is what it’s for, of course), so I put the jQuery TinyMCE thing in. Unfortunately, adding TinyMCE to the textarea broke the RSpec tests, complaining bitterly that
… which was no good at all.
Scouring around the internet showed a lot of people who had had similar problems, but nothing quite spelled it out. This Stackoverflow question was closest, but wasn’t quite what I needed. Beating rspec and capybara around a little more, along with some more googling, gave me this solution. Worked for me, although as that Stackoverflow commentor noted it might break on more complicated stuff. This page on TinyMCE, jQuery, Rails, and cucumber also helped, but since we aren’t using cucumber I had to adapt it a bit more.
This assumes you’re using the jQuery TinyMCE script. I believe the steps without jQuery would be similar though. Assume that foo_description_raw is your textarea holding the TinyMCE editor. In RSpec, where you would have something like this:
1 2 3 4
Change it to this:
1 2 3 4
After I did that, my tests began filling the editor in and passing again.