tests/test-html.rb
# Checks to see that the number of years matches the data and that
# they contain the year as an id number
Checks to see that the number of years matches the data and that
they contain the year as an id number
Checks to see that the number of years matches the data and that they contain the year as an id number
def allYears?(course)
    years = @html.css("div.year")
    if years.length != course["modules"].length
      add_issue("Page doesn't display the correct number of years " +
               "#{years.length} when it should be #{course["modules"].length}")
    end
    year_numbers = (1..years.length).map { |n| "year#{n}" }
    for year in years
      y = create_element(year)
      if not year_numbers.include? y.id
        add_issue("Year #{y.id} has unexpected id tag")
      end
    end
  end
def allYears? ( course ) years = @html . css ( "div.year" ) if years . length != course [ "modules" ] . length add_issue ( "Page doesn't display the correct number of years " + "#{years.length} when it should be #{course["modules"].length}" ) end year_numbers = ( 1 .. years . length ) . map { | n | "year#{n}" } for year in years y = create_element ( year ) if not year_numbers . include? y . id add_issue ( "Year #{y.id} has unexpected id tag" ) end end end
Checks to see that the number of years matches the data and that
they contain the year as an id number
Checks to see that the number of years matches the data and that they contain the year as an id number
# Do they all have an id number?
course