I''m only a few days old in this whiz-bang rails world, so bear with me. I''m in the middle of running functional tests, I''ve got some assert statements that check for the presence of a various tags on the page... One of the tags being checked is a form, and assert_tag checks that its :method => "POST". Unfortunately, the autogenerated form shows the value "post", and apparently that''s just too much different (the assert fails). Is there a way to call a case-insensitive assert? Here''s the code in question: assert_tag "form", :attributes => { :action => "/user/register", :method => "POST" } I realize I can just change the assert to check for "post" and everything will be peachy, but this seems like something that could cause me problems again down the road if I don''t figure it out now. Thanks in advance. -- 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 -~----------~----~----~----~------~----~------~--~---
On Apr 8, 4:01 am, William Tell <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Is there a way to call a case-insensitive assert? Here''s the code in > question: > > assert_tag "form", > :attributes => { :action => "/user/register", > :method => "POST" } > > I realize I can just change the assert to check for "post" and > everything will be peachy, but this seems like something that could > cause me problems again down the road if I don''t figure it out now. >You can give assert_tag a regular expression instead of just a string (and assert_select is often used instead of assert_tag these days) Fred --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> On Apr 8, 4:01�am, William Tell <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote: >> cause me problems again down the road if I don''t figure it out now. >> > > You can give assert_tag a regular expression instead of just a string > (and assert_select is often used instead of assert_tag these days) > > FredDoh. Thanks, and for the assert tip. Cheers cb -- 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
William Tell wrote:>> You can give assert_tag a regular expression instead of just a string >> (and assert_select is often used instead of assert_tag these days)> Doh. Thanks, and for the assert tip.Can you improve the code so its case is consistent? That would seem to fix the root problem here... -- Phlip --~--~---------~--~----~------------~-------~--~----~ 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 wrote:> William Tell wrote: > >>> You can give assert_tag a regular expression instead of just a string >>> (and assert_select is often used instead of assert_tag these days) > >> Doh. Thanks, and for the assert tip. > > Can you improve the code so its case is consistent? That would seem to > fix the > root problem here... > > -- > PhlipI''m not really sure -- the code is generated with form_for, and while I would imagine that function will consistently generate a lower-case "post", I''m not comfortable trusting the rest of the language (or myself) to stick with that convention. The regular expression did it. -- 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 -~----------~----~----~----~------~----~------~--~---