
regular expression bug in field_labeled_locator
Reported by Zach Dennis | January 27th, 2009 @ 12:55 PM | in 0.4.5
The field_labeled_locator uses the following regular expression to match label text:
/^\W*#{Regexp.escape(@value.to_s)}\b/i
The problem here is the word boundary at the end of the regular expression. Word boundaries only match if the character immediately preceding it was a word character. This means labels like "License #" the following will fail because # is not a word character.
Here's a patch formulated on a short discussion with brynary in IRC. Github is having some "pushing" problems right now so here's the patch file.
Comments and changes to this ticket
-
Bryan Helmkamp January 27th, 2009 @ 07:08 PM
- Milestone set to 0.4.1
-
Bryan Helmkamp February 8th, 2009 @ 11:22 PM
- Milestone changed from 0.4.1 to 0.4.2
-
Bryan Helmkamp February 9th, 2009 @ 12:23 AM
- State changed from new to open
Hey Zach,
Do you happen to know the right command to apply this patch while preserving the commit info? I never quite figured that out. :-)
As an alternative, a branch would make it easy for me to merge this.
Cheers,
-Bryan
-
Zach Dennis February 9th, 2009 @ 08:42 PM
git am <path to patch file>
git am will look for patch files in a numeric sequence, 0001, 0002, 0003, etc.
-
Deleted User February 22nd, 2009 @ 08:12 AM
ah-ha - I've just hit the same issue so thanks for submitting a patch :)
The only additional thought I have is should this also be applied to label_locator.rb?
Not being sure where this is used I don't actually know, but it seems from the naming of the files that it should use the same regex as field_labelled_locator.rb
-
Zach Dennis March 5th, 2009 @ 01:59 PM
Please please patch this. I hate updating and having to manually patch.
-
Zach Dennis March 25th, 2009 @ 12:09 PM
Upgrading Webrat is causing things to fail because this patch is missing. So another ping to include this patch.
-
Zach Dennis April 14th, 2009 @ 05:18 PM
Attached is an updated patch that applies cleanly to master as of this ticket update. It adds examples for select_datetime, select_time, select_date, and field_labeled_locator to ensure that both LabelLocator and FieldLabeledLocator work with labels that end in non-word characters.
-
gaffo April 16th, 2009 @ 01:27 PM
- Tag changed from bug, bugfix, patch to bug, bugfix, patch, verified
- Assigned user changed from Bryan Helmkamp to gaffo
applys cleanly, all tests pass.
-
-
gaffo April 16th, 2009 @ 01:39 PM
- Milestone changed from 0.4.2 to 0.4.5
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
Ruby Acceptance Testing for Web applications.