spec/unit/base_spec.rb in rawler-0.0.4 vs spec/unit/base_spec.rb in rawler-0.0.5
- old
+ new
@@ -47,10 +47,19 @@
output.should_receive(:puts).with('200 - http://external.com')
output.should_receive(:puts).with('302 - http://external.com/foo')
rawler.validate
end
+
+ it "should validate links with #hashtags" do
+ register('http://example.com/foo1', '<a href="http://example.com/page-with#hashtag">x</a>')
+ register('http://example.com/page-with', '')
+
+ output.should_receive(:puts).with('200 - http://example.com/page-with#hashtag')
+
+ rawler.validate
+ end
end
describe "get_status_code" do
@@ -87,10 +96,10 @@
output.should_receive(:puts).with("Connection refused - '#{url}'")
rawler.send(:add_status_code, url)
end
- [Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError,
+ [Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, Errno::ETIMEDOUT, EOFError,
Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError].each do |error|
it "should rescue from #{error}" do
url = 'http://example.com'
Rawler::Request.should_receive(:get).and_raise error
\ No newline at end of file