Hi, The following code works, but I don''t know how to test ist properly: In the view there is a simple link_to_remote: | <div id="create"> | <%= link_to_remote "Create New", :url => new_category_url %> | </div> Essentially, when I click on this link the "div" box gets hidden with a | page.hide "create" How do I test this? I have so far the following test: | class CreateCategoriesTest < ActionController::IntegrationTest | def test_create_category | get ''categories'' | assert_select "#create", "Create New" | xml_http_request new_category_path | assert_response :success | # ??? | end | end How can I test, that the "#create" element is hidden? TIA and regards, chris --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Christian Mayer <trigger.error-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> How can I test, that the "#create" element is hidden?Using standard ruby functional tests, you can only check tht the correct signal was sent to the server to hide the "#create" element. If you want to test, in the browser, that the element is really hidden, then you''ll need to use a browser-oriented testing framework like Selenium. Cheers, Tyler --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Well, there are steps available to help test RJS, but there is no be-all end-all testing solution, because in the end it is javascript and you can''t run it. Check out: ARTS: http://glu.ttono.us/articles/2006/05/29/guide-test-driven-rjs-with-arts There''s also #assert_select_rjs if you''re on Rails 1.2+, but I''m not sure how to really use this: http://api.rubyonrails.org/classes/ActionController/Assertions/SelectorAssertions.html#M000209 As an example. your simple one-line RJS is testable in ARTS: assert_rjs :hide, ''create'' In the end, if you want to fully test your javascript interactions, you''ll need a browser testing solution like Selenium, or lighter-weight Systir + Watir (http://atomicobject.com/pages/System+Testing+in+Ruby) Jason On 4/5/07, Tyler MacDonald <google.com-oTuY4Vk9bUDG8MNy1oJpyw@public.gmane.org> wrote:> > > Christian Mayer <trigger.error-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > How can I test, that the "#create" element is hidden? > > Using standard ruby functional tests, you can only check tht the correct > signal was sent to the server to hide the "#create" element. > > If you want to test, in the browser, that the element is really hidden, > then you''ll need to use a browser-oriented testing framework like > Selenium. > > Cheers, > Tyler > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---