DanS
2010-Mar-01 22:24 UTC
[rspec-users] Can have_selector Match Only Part of an Elements Class String?
I would like to find a way to check for the existence of a class on a <td> element in a calendar. The <td>s are the days of the calendar and can have various classes assigned. I want to test if a day has the ''past'' class and don''t care (in this test) if other classes (weekend, today, etc) are present. So far I''ve only been able to use have_selector(''td'', :class=>''some class'') if the class string matches exactly. Is there an easy way to match if the class ''past'' is just present in the string? (wildcards, regex, whatever) Making the test match the string exactly feels like it makes the test too complicated and loose its focus on the single thing I want to test. Thanks to anyone who can offer advice on this. Dan Steinicke
David Chelimsky
2010-Mar-01 22:26 UTC
[rspec-users] Can have_selector Match Only Part of an Elements Class String?
On Mon, Mar 1, 2010 at 4:24 PM, DanS <dansteinicke at gmail.com> wrote:> I would like to find a way to check for the existence of a class on a > <td> element in a calendar. ?The <td>s are the days of the calendar > and can have various classes assigned. ?I want to test if a day has > the ''past'' class and don''t care (in this test) if other classes > (weekend, today, etc) are present. ?So far I''ve only been able to use > have_selector(''td'', :class=>''some class'') if the class string matches > exactly. ?Is there an easy way to match if the class ''past'' is just > present in the string? (wildcards, regex, whatever) > > Making the test match the string exactly feels like it makes the test > too complicated and loose its focus on the single thing I want to > test. > > Thanks to anyone who can offer advice on this.This is a webrat question. If nobody answers you here, check the webrat group: http://groups.google.com/group/webrat. HTH, David
DanS
2010-Mar-02 05:15 UTC
[rspec-users] Can have_selector Match Only Part of an Elements Class String?
On Mar 1, 2:26?pm, David Chelimsky <dchelim... at gmail.com> wrote:> On Mon, Mar 1, 2010 at 4:24 PM, DanS <dansteini... at gmail.com> wrote: > > I would like to find a way to check for the existence of a class on a > > <td> element in a calendar. ?The <td>s are the days of the calendar > > and can have various classes assigned. ?I want to test if a day has > > the ''past'' class and don''t care (in this test) if other classes > > (weekend, today, etc) are present. ?So far I''ve only been able to use > > have_selector(''td'', :class=>''some class'') if the class string matches > > exactly. ?Is there an easy way to match if the class ''past'' is just > > present in the string? (wildcards, regex, whatever) > > > Making the test match the string exactly feels like it makes the test > > too complicated and loose its focus on the single thing I want to > > test. > > > Thanks to anyone who can offer advice on this. > > This is a webrat question. If nobody answers you here, check the > webrat group:http://groups.google.com/group/webrat. > > HTH, > David > _______________________________________________ > rspec-users mailing list > rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-usersThanks David. Sorry for posting to wrong place. Posted on webrat group here: http://groups.google.com/group/webrat/browse_thread/thread/ac30dec93f842316