I have a number of functional tests that check the response that was created by the JavaScriptGenerator for some redirects. ie:
render :update do |page| page.redirect_to comment_path(@comment) end
The tests' assertions look like this:
@javascript = @response.body assert_equal "window.location.href = \"#{comment_path(@comment)}\";", @javascript
This is fine except that when I run 'rake test', I get failures stating that:
<"window.location.href = \"/comments/1\";"> expected but was <"window.location.href = \"\\/comments\\/1\";">.
But when I run only the specific Comments functional test ('ruby test/functional/comments_controller_test.rb'), no failures show up. Why would 'rake test' escape these javascript strings differently? How can I make it so that both the 'rake test' and 'ruby test/functional/comments_controller_test.rb' pass?
Thanks