Rails Rspec Capybara Testing Javascript

I’m testing a Rails 3 app with Rspec and Capybara.

For my integration tests, I need to test javascript. Of course, I
watched #257 Request Specs and Capybara - RailsCasts
which presents the basics very well.

Unfortunately an error is raised in the javascript as I can see using
save_and_open_page

It seems characters are encoded by Capybara or Selenium so this js
loop crashes because of the <:

Reason:

Uncaught SyntaxError: Unexpected token ;

I did put:

in my head so I can’t understand the problem.