[rspec-users] Just trying out cucumber

Peter Jaros peter.a.jaros at gmail.com
Mon Nov 24 22:39:38 EST 2008

On Mon, Nov 24, 2008 at 10:35 PM, Mark Wilden <mark at mwilden.com> wrote:
> 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.

I wouldn't use a Regexp to find this.  Look into assert_select, or use
response.should have_tag (which is a wrapper for assert_select) if you
prefer to stay RSpec'y.


More information about the rspec-users mailing list