Class: Magellan::Rake::ExpectedLinksTask

Inherits:
BaseMagellanTask show all
Defined in:
lib/magellan/rake/expected_links_task.rb

Overview

Example: Magellan::Rake::ExpectedLinksTask.new(“digg”) do |t|

t.origin_url = "http://digg.com/"
t.explore_depth = 2
t.patterns_and_expected_links = YAML.load_file("digg.yml")

end

Instance Attribute Summary collapse

Attributes inherited from BaseMagellanTask

#explore_depth, #failure_log, #ignored_urls, #links_to_explore, #origin_url, #success_message

Instance Method Summary collapse

Methods inherited from BaseMagellanTask

#define

Constructor Details

#initialize(name = "magellan:check_links") ⇒ ExpectedLinksTask

Defines a new task, using the name name.



21
22
23
24
25
# File 'lib/magellan/rake/expected_links_task.rb', line 21

def initialize(name="magellan:check_links")
  @success_message = "All expected links found!"
  @links_to_explore = [["a","href"]]
  super(name)
end

Instance Attribute Details

Tuple of patterns and expected links at a given pattern Example: patterns_and_expected_links = [[/.*/,‘/about_us.html’]] # => this says all pages should have a link to the about us page.



18
19
20
# File 'lib/magellan/rake/expected_links_task.rb', line 18

def patterns_and_expected_links
  @patterns_and_expected_links
end

Instance Method Details

#create_observerObject

:nodoc:



31
32
33
# File 'lib/magellan/rake/expected_links_task.rb', line 31

def create_observer # :nodoc:
  Magellan::ExpectedLinksTracker.new(@patterns_and_expected_links)
end

#descriptionObject

:nodoc:



27
28
29
# File 'lib/magellan/rake/expected_links_task.rb', line 27

def description # :nodoc:
  "Explore #{@origin_url} and find check if all given patterns are matched"
end