Sha256: 7968f5a9a4f5c5046c0d7e692cae0d060ca2ac09ce49b0db6f0d00abbfac9266

Contents?: true

Size: 1.19 KB

Versions: 6

Compression:

Stored size: 1.19 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

6 entries across 6 versions & 1 rubygems

Version Path
wombat-2.9.0 spec/wombat_spec.rb
wombat-2.8.0 spec/wombat_spec.rb
wombat-2.7.0 spec/wombat_spec.rb
wombat-2.6.0 spec/wombat_spec.rb
wombat-2.5.1 spec/wombat_spec.rb
wombat-2.5.0 spec/wombat_spec.rb