tags:

views:

26

answers:

0

What is the preferred way to match multiple nodes in cucumber, like checking if links exist? Without having to write the same statement over and over again.

I'm just doing this:

Then /^(?:|I )should see "\[([^"\]]*)\]"(?: within "([^"]*)")?$/ do |array, selector|
  with_scope(selector) do
    array.split(/,\s+/).each do |text|
      if page.respond_to? :should
        page.should have_content(text)
      else
        assert page.has_content?(text)
      end
    end
  end
end

Is there a better way?