manage_froobles.feature -------------------------------------- Scenario: Delete frooble Given the following froobles: |name|color|description| |name 1|color 1|description 1| |name 2|color 2|description 2| |name 3|color 3|description 3| |name 4|color 4|description 4| When I delete the 3rd frooble Then I should see the following froobles: |name|color|description| |name 1|color 1|description 1| |name 2|color 2|description 2| |name 4|color 4|description 4|
---------------------------------------------------------------------------------------------------------------- froobles_steps.rb -------------------------------------- When /^I delete the (\d+)(?:st|nd|rd|th) frooble$/ do |pos| visit froobles_url within("table > tr:nth-child(#{pos.to_i+1})") do click_link "Destroy" end end 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 I want to show a definition list instead of a table. index.html -------------------------------------- <dl> <dt>description 1</dt> <dd>show | edit| destroy</dd> <dt>description 2</dt> <dd>show | edit| destroy</dd> </dl> so I'm trying manage_froobles.feature -------------------------------------- Scenario: Delete frooble Given the following froobles: |description| |description 1| |description 2| |description 3| |description 4| When I delete the 3rd frooble Then I should see the following froobles: |description| |description 1| |description 2| |description 4| ---------------------------------------------------------------------------------------------------------------- froobles_steps.rb -------------------------------------- When /^I delete the (\d+)(?:st|nd|rd|th) frooble$/ do |pos| visit froobles_url within("dl:nth-child(#{pos.to_i})") do click_link "Destroy" end end (this passes but I really don't know if it's "clicking" the destroy link on the third list item.) Then /^I should see the following froobles:$/ do |froobles| tasks.raw[1..-1].each_with_index do |row, i| response.should have_selector("dl:nth-child(#{i+3})") { |td| td.inner_text.should == row } end end (this fails) I can follow the logic of the table but for some reason I can't write this test for a list. Any help would be appreciated. John _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users