Method: Magellan::ExpectedLinksTracker#update

Defined in:
lib/magellan/expected_links_tracker.rb

#update(time, result) ⇒ Object

The updates that come in via a observable subject, the time the result came at and the Magellan::Result itself.



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/magellan/expected_links_tracker.rb', line 19

def update(time,result)
  if result.html_content?
    patterns_that_apply(result).each do |pattern,expectation|
      passed = result.linked_resources.include?(expectation)
      changed
      message = "#{result.url} did not contain a link to #{expectation}"
      notify_observers(Time.now, passed, message)
      @errors << message unless passed
    end
  end
end