[Ruby] matching spaces as \s+ in assert_select

Laurel Fan laurel.fan at gmail.com
Thu Dec 6 14:12:29 PST 2007


On Dec 6, 2007 12:20 PM, Mikhail Seregine <seregine at yahoo.com> wrote:
> OK, enlighten me, why the '\s+'? Why not:
>
> assert_select 'h3', Regexp.new("Wants to do 1 thing".gsub!(/\s+/, ' '))

I guess I wasn't clear enough about what I want to do.

A. I want to match this:
<h3>Wants to do 1 thing</h3>

B. but this is also ok because it's essentially the same thing in html:
<h3>Wants to do
1
thing</h3>

If I have
  assert_select 'h3', Regexp.new("Wants to do 1 thing".gsub!(/\s+/, ' '))
or
  assert_select 'h3', "Wants to do 1 thing"
they will fail on B.

-- 
Laurel Fan
http://blog.gorgorg.org


More information about the Ruby mailing list