tests/test-html.rb
# This function checks to see that a given module requires for the modules is
# should
This function checks to see that a given module requires for the modules is
should
This function checks to see that a given module requires for the modules is should
def moduleRequires?(m, mspec)
    requires = m.css("ul.requires > li")
    if mspec["requires"] and requires.empty?
      add_issue("Module #{mspec["code"]} is not listing any of its requirements!")
    end
    if not requires.empty?
      for requirement in requires
        code = requirement["class"]
        if not mspec["requires"].include? code
          add_issue("Module #{mspec["code"]} is requiring a module that it shouldn't! (#{code})")
        end
        link = requirement.css("a")[0]["href"]
        if link != "##{code}"
          add_issue("Requirement #{code} for module #{mspec["code"]} does not have a link!")
        end
        reqmod = getModuleByCode(code)
        name = requirement.text
        if reqmod["name"] != name
          add_issue("Requirement #{code} for module #{mspec["code"]} has an incorrect title! (#{name})")
        end
        provides = @html.css("div.module##{code} > div.provides > span")
        pcodes = provides.map { |p| p["class"]}
        if not pcodes.include? mspec["code"]
          add_issue("Requirement module #{code} is not providing for #{mspec["code"]}!")
        end
      end
    end
  end
def moduleRequires? ( m , mspec ) requires = m . css ( "ul.requires > li" ) if mspec [ "requires" ] and requires . empty? add_issue ( "Module #{mspec["code"]} is not listing any of its requirements!" ) end if not requires . empty? for requirement in requires code = requirement [ "class" ] if not mspec [ "requires" ] . include? code add_issue ( "Module #{mspec["code"]} is requiring a module that it shouldn't! (#{code})" ) end link = requirement . css ( "a" ) [ 0 ] [ "href" ] if link != "##{code}" add_issue ( "Requirement #{code} for module #{mspec["code"]} does not have a link!" ) end reqmod = getModuleByCode ( code ) name = requirement . text if reqmod [ "name" ] != name add_issue ( "Requirement #{code} for module #{mspec["code"]} has an incorrect title! (#{name})" ) end provides = @html . css ( "div.module##{code} > div.provides > span" ) pcodes = provides . map { | p | p [ "class" ] } if not pcodes . include? mspec [ "code" ] add_issue ( "Requirement module #{code} is not providing for #{mspec["code"]}!" ) end end end end
This function checks to see that a given module requires for the modules is
should
This function checks to see that a given module requires for the modules is should
# Check to see that the module is actaully listing requirements # Are there requirements in this moudle to test? # For each requirement # Is this module actually required? # Is there a link to the correct required module on the page? # Load the module which is required # Is the title correct? # Finally is that module providing for us (this will catch the last case # in the previous test we couldn't cover)
m
mspec