horsefield 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,42 +0,0 @@
1
- require 'spec_helper'
2
- require 'horsefield/scraper'
3
-
4
- describe Horsefield::Scraper do
5
- let(:scraper) { Horsefield::Scraper.new('http://www.linkedin.com/in/lunarmobiscuit') }
6
-
7
- it 'should accept HTML or a URL as argument' do
8
- VCR.use_cassette('linkedin_lunarmobiscuit') do
9
- scraper.html.should match('<!DOCTYPE html>')
10
- end
11
- end
12
-
13
- describe '#scrape' do
14
- it 'should take a block with attributes to scrape' do
15
- data = scraper.scrape do
16
- scope '.profile-header' do
17
- one :name, '//span[@class="full-name"]'
18
- end
19
-
20
- many :skills, '#skills-list li'
21
-
22
- many :experiences, '#profile-experience .position' do
23
- one :headline, 'span.title'
24
-
25
- one :start_year, '.period .dtstart' do
26
- attr('title').split('-').first.to_i
27
- end
28
- end
29
-
30
- one :company do
31
- one :name, '.postitle h4'
32
- end
33
- end
34
-
35
- p data[:company]
36
-
37
- data[:name].should == "Michael 'Luni' Libes"
38
- data[:experiences].first[:headline].should == 'Founder and Managing Director'
39
- data[:skills].should == ["Entrepreneurship", "Business Planning", "Fundraising", "Team Building", "Start-ups", "Venture Capital", "Social Entrepreneurship", "Strategic Planning", "Strategic Partnerships", "Strategy", "Business Development", "Management Consulting", "Marketing Strategy", "Sustainability", "Executive Management", "Marketing", "New Business Development", "Competitive Analysis", "Go-to-market Strategy", "Thought Leadership", "Corporate Development", "Software Development", "Business Strategy", "Mobile Devices", "Wireless", "Management", "Cloud Computing", "Nonprofits", "Business Modeling", "SaaS", "Mobile Applications", "Product Marketing", "Program Management", "Analytics", "E-commerce", "Leadership", "Enterprise Software", "Consulting", "Strategic Consulting"]
40
- end
41
- end
42
- end