Sha256: bc8bb2722ca9d47ffc973d1ebcf48a13e27563f91e5ff0948112fc21d11da621

Contents?: true

Size: 1.49 KB

Versions: 8

Compression:

Stored size: 1.49 KB

Contents

require 'spidr/filters'
require 'spidr/agent'

require 'spec_helper'

describe Filters do
  it "should allow setting the acceptable schemes" do
    agent = Agent.new

    agent.schemes = [:http]
    agent.schemes.should == ['http']
  end

  it "should provide the hosts that will be visited" do
    agent = Agent.new(:hosts => ['spidr.rubyforge.org'])
    agent.visit_hosts.should == ['spidr.rubyforge.org']
  end

  it "should provide the hosts that will not be visited" do
    agent = Agent.new(:ignore_hosts => ['example.com'])
    agent.ignore_hosts.should == ['example.com']
  end

  it "should provide the ports that will be visited" do
    agent = Agent.new(:ports => [80, 443, 8000])
    agent.visit_ports.should == [80, 443, 8000]
  end

  it "should provide the ports that will not be visited" do
    agent = Agent.new(:ignore_ports => [8000, 8080])
    agent.ignore_ports.should == [8000, 8080]
  end

  it "should provide the links that will be visited" do
    agent = Agent.new(:links => ['index.php'])
    agent.visit_links.should == ['index.php']
  end

  it "should provide the links that will not be visited" do
    agent = Agent.new(:ignore_links => [/login/])
    agent.ignore_links.should == [/login/]
  end

  it "should provide the exts that will be visited" do
    agent = Agent.new(:exts => ['htm'])
    agent.visit_exts.should == ['htm']
  end

  it "should provide the exts that will not be visited" do
    agent = Agent.new(:ignore_exts => ['cfm'])
    agent.ignore_exts.should == ['cfm']
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
spidr-0.2.7 spec/filters_spec.rb
spidr-0.2.6 spec/filters_spec.rb
spidr-0.2.5 spec/filters_spec.rb
spidr-0.2.4 spec/filters_spec.rb
spidr-0.2.3 spec/filters_spec.rb
spidr-0.2.2 spec/filters_spec.rb
spidr-0.2.1 spec/filters_spec.rb
spidr-0.2.0 spec/filters_spec.rb