assert_no_rjs_ now negates all the JavaScript assertions listed here: http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/49fd7c9b9107d577 And assert_rjs_ now works in RSpec: it ''should use Ajax to replace person 45'' do xhr :get, :replace_person, :id => 45 @response.body.should send_js_to(:replace_html, ''person_45'') do strong ''person_45'' end end Once again, the do-end block calls Nokogiri::HTML::Builder to build a sample of HTML. The assertion then matches this to the HTML delivered in the payload of the JS Element.update() call. The committee is unaware of any other RJS solution for RSpec... (Sorry - no .should not_send_js_to yet..;) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Phlip
2009-Apr-12 16:31 UTC
Re: [ANN] assert2 presents assert_no_rjs_, and .should send_js_to
> assert_no_rjs_ now negates all the JavaScript assertions listed here: > > http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/49fd7c9b9107d577> (Sorry - no .should not_send_js_to yet..;)Version 0.5.1 fixes that: .should_not send_js_to Next, assert_xhtml (and .should be_html_with) add the any! keyword: assert_xhtml do ul.kalika do any! ''Billings report'' end end It evaluates to the XPath * operator, so the above passes if any element below the <ul class=''kalika''> contains any "Billings report". This example fails if "Billings report" appears anywhere in the document (assuming we _reeally_ don''t like it!;): assert_xhtml do without!{ any! /Billings report/ } end If anyone can think of new features to add to (or take out of) these DSLs, I''m all ears! -- Quark --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Brandon Olivares
2009-Apr-12 16:50 UTC
Re: [ANN] assert2 presents assert_no_rjs_, and .should send_js_to
Phlip, Is there any plan to allow for negative assertions (e.g., should_not be_html_with)? I use this in a custom matcher, and can''t think of a way to support negative assertions unless be_html_with does. I''m of course going by the output of negative_failure_message saying not to use it that way. Brandon> -----Original Message----- > From: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org [mailto:rubyonrails- > talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org] On Behalf Of Phlip > Sent: Sunday, April 12, 2009 12:32 PM > To: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > Cc: rspec-users-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org > Subject: [Rails] Re: [ANN] assert2 presents assert_no_rjs_, and .should > send_js_to > > > > assert_no_rjs_ now negates all the JavaScript assertions listed here: > > > > http://groups.google.com/group/rubyonrails- > talk/browse_thread/thread/49fd7c9b9107d577 > > > (Sorry - no .should not_send_js_to yet..;) > > Version 0.5.1 fixes that: .should_not send_js_to > > Next, assert_xhtml (and .should be_html_with) add the any! keyword: > > assert_xhtml do > ul.kalika do > any! ''Billings report'' > end > end > > It evaluates to the XPath * operator, so the above passes if any > element below > the <ul class=''kalika''> contains any "Billings report". > > This example fails if "Billings report" appears anywhere in the > document > (assuming we _reeally_ don''t like it!;): > > assert_xhtml do > without!{ any! /Billings report/ } > end > > If anyone can think of new features to add to (or take out of) these > DSLs, > I''m all ears! > > -- > Quark > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Phlip
2009-Apr-12 16:54 UTC
Re: [ANN] assert2 presents assert_no_rjs_, and .should send_js_to
Brandon Olivares wrote:> Is there any plan to allow for negative assertions (e.g., should_not > be_html_with)? I use this in a custom matcher, and can''t think of a way to > support negative assertions unless be_html_with does.I can''t think of a reason not to use .should be_html_with{ without!{ ...} } And it seems that .should_not be_html_with() would, in theory, pass if a page weren''t HTML... --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Brandon Olivares
2009-Apr-12 19:53 UTC
Re: [ANN] assert2 presents assert_no_rjs_, and .should send_js_to
> -----Original Message----- > From: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org [mailto:rubyonrails- > talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org] On Behalf Of Phlip > Sent: Sunday, April 12, 2009 12:54 PM > To: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > Subject: [Rails] Re: [ANN] assert2 presents assert_no_rjs_, and .should > send_js_to > > > I can''t think of a reason not to use .should be_html_with{ without!{ > ...} }It could, if I could determine whether the matcher was being called with .should or .should_not. I don''t know of a way to do this? Anyway I''m excited about this new release. Thanks. Brandon> > And it seems that .should_not be_html_with() would, in theory, pass if > a page > weren''t HTML... > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---