Skip to content

Instantly share code, notes, and snippets.

@zealoushacker
Created July 13, 2011 17:10
Show Gist options
  • Save zealoushacker/1080768 to your computer and use it in GitHub Desktop.
Save zealoushacker/1080768 to your computer and use it in GitHub Desktop.
Credits matcher
Then /^student (\d+|\d+..\d+) should have (\d+) less credits$/ do |student_num, num_credits|
if student_num =~ /\d+..\d+/
student_num.to_range.each do |s_id|
tr_locator = "table#customer_users tbody tr:nth-of-type(#{s_id})"
selenium.get_text("css=#{tr_locator} td:nth-of-type(4)").should == (@cu.credits_active - num_credits.to_i).to_s
selenium.get_text("css=#{tr_locator} td:nth-of-type(5)").should == (@cu.attended + 1).to_s
end
else
tr_locator = "table#customer_users tbody tr:nth-of-type(#{student_num})"
selenium.get_text("css=#{tr_locator} td:nth-of-type(4)").should == (@cu.credits_active - num_credits.to_i).to_s
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment