#327 new
Bryan Helmkamp

field_labled doesn't match when ":" is in the label

Reported by Bryan Helmkamp | January 17th, 2010 @ 06:38 PM

Copied from GitHub issue # 2

Created 8 months ago by thillerson

Using 0.4.4.

I have the following erb:

<label for="permalink">Use the following URL for sharing:</label>
<input type="text" id="permalink" class="text-input" value="<%= permalink %>"/>

And I'm using (through Cucumber):

Then "the \"Use the following URL for sharing\" field should contain \"#{permalink}\""

Which uses this:

Then /^the "([^\"]*)" field should contain "([^\"]*)"$/ do |field, value|
  field_labeled(field).value.should =~ /#{value}/

When I have a colon in the label, e.g. "Use the following URL for sharing:", field_labeled will not match. If I take the colon out, e.g. "Use the following URL for sharing", it will match.


jibes21 August 05, 2009

Yea, Im also having the same issue my colleague has same versions of webrat, nokogiri, libxml2 and it works on his machine.
Some others seem to have the same issue

phinze August 17, 2009

I had a similar problem that I solved by loosening the regexp in webrat's field matcher:

Here's what I have in my code to work around the issue: http://gist.github.com/169215

atmos August 21, 2009

This is confusing in general in my experience and I'd love to see this land.

phinze August 22, 2009

I can fork and make the change to the actual codebase and see what brynary thinks. The trade-off with my regexp is that there is a possibility for unexpected matches on pages with very similar labels. I think it's probably worth the change though.

phinze August 23, 2009

So I started with some tests on my fork, and it turns out that with the current code, it looks like it will match a colon suffix, but it won't match with a number prefix.

Check it out here: phinze/webrat@d31f1ee

There is another test elsewhere that states that "fill_in should anchor at the beginning of label strings" which would be in direct conflict with my changed regexp... so I'm not sure where that leaves us.

mislav October 19, 2009

Another labels/regexp issue: GitHub issue # 30

No comments found

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.

New-ticket Create new ticket

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.

Shared Ticket Bins

People watching this ticket