spec/arachni/spider_spec.rb in arachni-0.4.5.2 vs spec/arachni/spider_spec.rb in arachni-0.4.6

- old
+ new

@@ -189,18 +189,37 @@ spider = Arachni::Spider.new spider.run.select { |url| url.include?( '/something' ) }.size.should == 1 end context 'Options.exclude_pages' do - it 'skips pages which match the configured patterns' do - @opts.exclude_pages = /skip me/i - @opts.url = @url + '/skip' + it 'skips pages which match the configured patterns (but not the seed URL)' do + @opts.exclude_pages = /skip-me/i + @opts.url = "#{@url}skip" - Arachni::Spider.new.run.should be_empty + Arachni::Spider.new.run.should == [@opts.url, "#{@url}follow-me"] end end + context 'Options.exclude' do + it 'skips paths which match the configured patterns (but not the seed URL)' do + @opts.exclude = /skip-me/i + @opts.url = "#{@url}skip" + + Arachni::Spider.new.run.should == [@opts.url, "#{@url}follow-me"] + end + end + + context 'Options.include' do + it 'skips paths which do not match the configured patterns (but not the seed URL)' do + @opts.include = /include-me/i + @opts.url = "#{@url}include" + + Arachni::Spider.new.run.sort.should == + [@opts.url, "#{@url}include-me/1", "#{@url}include-me/2"].sort + end + end + context 'Options.do_not_crawl' do it 'does not crawl the site' do @opts.do_not_crawl Arachni::Spider.new.run.should be_nil end @@ -423,19 +442,9 @@ spider.push( Arachni::Module::Utilities.to_absolute( 'test' ) ).should be_false end end end - - #context 'when called after the crawl has finished' do - # it 'should wake the crawler up after pushing the new paths' do - # s = Arachni::Spider.new - # s.run - # s.done?.should be_true - # s.push( '/a_pushed_path' ) - # s.done?.should be_false - # end - #end end describe '#done?' do context 'when not running' do it 'returns false' do