Hi there, Hoping someone can help with this or point out alternative options for testing for the presence of a css class on a specific element. We''re using rspec and I would like to check for the presence of a specific css class (''current'') on an element (link). response.should have_tag(''a#some_link'') I was hoping that the have_tag matcher might have some option to specify a class to match but can''t gleam anything from the docs. Any suggestions would be really welcome? Armand --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Armand du Plessis
2008-Oct-29 11:51 UTC
Re: RSpec and Testing for the presence of css class
We''ve switched away from using current on the element in favour of descendent selectors which makes the testing easier as well. http://www.alistapart.com/articles/slidingdoors2/ Cheers, Armand On Oct 29, 1:35 pm, "Armand du Plessis" <arman...-hSqlHpnh0GxWk0Htik3J/w@public.gmane.org> wrote:> Hi there, > > Hoping someone can help with this or point out alternative options for > testing for the presence of a css class on a specific element. > > We''re using rspec and I would like to check for the presence of a > specific css class (''current'') on an element (link). > > response.should have_tag(''a#some_link'') > > I was hoping that the have_tag matcher might have some option to > specify a class to match but can''t gleam anything from the docs. > > Any suggestions would be really welcome? > > Armand--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Christian Lescuyer
2008-Oct-29 18:11 UTC
Re: RSpec and Testing for the presence of css class
Try: have_tag(''a.current'') Christian --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Armand du Plessis
2008-Oct-30 07:30 UTC
Re: RSpec and Testing for the presence of css class
Thanks Christian. In hindsight that makes perfect sense :) On Oct 29, 8:11 pm, Christian Lescuyer <christian.lescu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Try: > have_tag(''a.current'') > > Christian--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---