Sha256: 0f4cc6bb4aa395c2710ae8ed88fece66a41583119b10bfac21751b7594fc3143

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

require 'spec_helper'

describe Wombat do
	it 'should provide syntactic sugar method Wombat.crawl' do
		Wombat.should respond_to(:crawl)
	end

	it 'should provide syntactic sugar method Wombat.scrape' do
		Wombat.should respond_to(:scrape)
	end

	it 'should redirect .scrape to .crawl' do
		fake_class = double :fake
		fake_class.stub :include
		fake_class.should_receive(:new).and_return(double(crawl: nil))
		Class.stub :new => fake_class
		Wombat.scrape
	end

	it 'should provide configuration method with block' do
		Wombat.configure do |config|
			config.set_proxy "10.0.0.1", 8080
			config.set_user_agent "Wombat"
			config.set_user_agent_alias 'Mac Safari'
		end
		Wombat.proxy_args.should == ["10.0.0.1", 8080]
		Wombat.user_agent.should == 'Wombat'
		Wombat.user_agent_alias.should == 'Mac Safari'
	end

	it 'should accept regular properties (non-selectors)' do
		VCR.use_cassette('broken_selector') do
			lambda {
				Wombat.crawl do
					base_url "http://www.github.com"
		  		path "/"

		  		source :obaoba
			    description 'Oba Oba'
			    website 'http://obaoba.com.br'
				end
			}.should_not raise_error
		end
	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wombat-2.4.0 spec/wombat_spec.rb