spec/actions_spec.rb in spidr-0.2.7 vs spec/actions_spec.rb in spidr-0.3.0
- old
+ new
@@ -2,13 +2,11 @@
require 'spidr/agent'
require 'spec_helper'
describe Actions do
- before(:all) do
- @url = URI('http://spidr.rubyforge.org/')
- end
+ let(:url) { URI('http://spidr.rubyforge.org/') }
it "should be able to pause spidering" do
count = 0
agent = Agent.host('spidr.rubyforge.org') do |spider|
spider.every_page do |page|
@@ -26,24 +24,24 @@
spider.every_page do |page|
spider.pause!
end
end
- agent.enqueue(@url)
+ agent.enqueue(url)
agent.continue!
- agent.visited?(@url).should == true
+ agent.visited?(url).should == true
end
it "should allow skipping of enqueued links" do
agent = Agent.new do |spider|
spider.every_url do |url|
spider.skip_link!
end
end
- agent.enqueue(@url)
+ agent.enqueue(url)
agent.queue.should be_empty
end
it "should allow skipping of visited pages" do
@@ -51,11 +49,11 @@
spider.every_page do |url|
spider.skip_page!
end
end
- agent.visit_page(@url)
+ agent.visit_page(url)
- agent.history.should == Set[@url]
+ agent.history.should == Set[url]
agent.queue.should be_empty
end
end