features/step_definitions/table_steps.rb in page-object-0.5.1 vs features/step_definitions/table_steps.rb in page-object-0.5.2

- old
+ new

@@ -1,6 +1,6 @@ -Then /^the data for row "([^"]*)" should be "([^"]*)" and "([^"]*)"$/ do |row, col1, col2| +Then /^the data for row "([^\"]*)" should be "([^\"]*)" and "([^\"]*)"$/ do |row, col1, col2| table_row = @element[row.to_i - 1] table_row[0].text.should == col1 table_row[1].text.should == col2 end @@ -15,12 +15,22 @@ When /^I retrieve a table element by "([^\"]*)"$/ do |how| @element = @page.send "table_#{how}_element" end -When /^I retrieve a table element by "([^"]*)" and "([^"]*)"$/ do |param1, param2| +When /^I retrieve a table element by "([^\"]*)" and "([^\"]*)"$/ do |param1, param2| @element = @page.send "table_#{param1}_#{param2}_element" end When /^I retrieve a table element while the script is executing$/ do @element = @page.table_element(:id => 'table_id') +end + +Then /^the data for the first row should be "([^\"]*)" and "([^\"]*)"$/ do |col1, col2| + @element.first_row[0].text.should == col1 + @element.first_row[1].text.should == col2 +end + +Then /^the data for the last row should be "([^\"]*)" and "([^\"]*)"$/ do |col1, col2| + @element.last_row[0].text.should == col1 + @element.last_row[1].text.should == col2 end