[rspec-users] Just trying out cucumber

Mark Wilden mark at mwilden.com
Mon Nov 24 22:35:25 EST 2008

On Mon, Nov 24, 2008 at 6:56 PM, Pau Cor <lists at ruby-forum.com> wrote:

> Pau Cor wrote:
> > /\<p\>\s*\<b\>Token\:\<\/b\>\s*[a-f0-9]{40}\s*\<\/p\>/m
> On second thought, you might want to make that regex more generic. When
> you refactor your view code (i.e. insert divs, add ids/classes, and get
> rid of the <b> tags--which are evil) then your test won't break.
> The customer cares that there is a token, not that the token is in a <p>
> tag and the label is bold.

Yes, but it's important that the token appear under the Token label. I think
it might be difficult to specify that in a generic way.

This is why I don't mind doing things like adding ids solely for the sake of
testing. Testing is good thing to do - there's no shame in making code
changes to make tests better.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20081124/acb42932/attachment-0001.html>

More information about the rspec-users mailing list