Given /^the following posts:$/ do |posts| Post.create!(posts.hashes) end When /^I delete the (\d+)(?:st|nd|rd|th) post$/ do |pos| visit posts_path within("table tr:nth-child(#{pos.to_i+1})") do click_link "Destroy" end end Then /^I should see the following posts:$/ do |expected_posts_table| expected_posts_table.diff!(tableish('table tr', 'td,th')) end