Check out the ARTS plugin
http://glu.ttono.us/articles/2006/05/29/guide-test-driven-rjs-with-arts
assert_rjs :redirect_to, ...
Makes it much easier to test the simple RJS.
Jason
On Jan 9, 2008 3:29 PM, Jon Glick
<rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:
>
> 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
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---