Created
March 25, 2012 15:18
-
-
Save seejee/2197192 to your computer and use it in GitHub Desktop.
student page task assertion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "test_helper" | |
describe "Student Page Integration" do | |
before do | |
@course = FactoryGirl.create(:webdev) | |
@student = build_person(:student, @course) | |
end | |
it "should display all of the course tasks on the student page" do | |
sign_in @student | |
click_link "Web Development" | |
click_link "Student" | |
@course.tasks.each do |t| | |
assert_task_is_on_page page, t | |
end | |
end | |
end | |
private | |
def assert_task_is_on_page(page, task) | |
includes_task_row?(page, task).must_equal true, "Could not find task '#{task.description}' on the page" | |
end | |
def includes_task_row?(page, task) | |
page.has_xpath?("//tr[@data-taskid='#{task.id}']") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment