Strange testing situation

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)

The tests’ assertions look like this:

@javascript = @response.body
assert_equal “window.location.href = “#{comment_path(@comment)}”;”,

This is fine except that when I run ‘rake test’, I get failures stating

<“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?


Check out the ARTS plugin

assert_rjs :redirect_to, …

Makes it much easier to test the simple RJS.