[rspec-users] Step tables

Juanma Cervera lists at ruby-forum.com
Thu Jan 15 06:22:16 EST 2009


I am having some trouble using step tables.

I am trying with an step similar to the sample step generarated by the
cucumber generator

Then /^I should see the following froobles:$/ do |froobles|
  froobles.raw[1..-1].each_with_index do |row, i|
    row.each_with_index do |cell, j|
      response.should have_selector("table > tr:nth-child(#{i+2}) >
td:nth-child(#{j+1})") { |td|
        td.inner_text.should == cell
      }
    end
  end
end

This works, and I understand the sintaxis, but the problem is that it
works even if I make an error with the data, because it seems that the
block of have_selector is never entered in, and I can't check nothing
inside the block.

And another question.
I have seen that Cucumber::Model::Table has a 'rows' method for
accessing the rows of the table, but is not still in cucumber 0.1.15.
¿Where is the method raw defined?

Thanks.
-- 
Posted via http://www.ruby-forum.com/.


More information about the rspec-users mailing list