horsefield 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 34008644a306fa5e55a16538a5734903db869164
4
- data.tar.gz: af8cf64a385080160f962d6fade650272746c989
3
+ metadata.gz: 909d1fbaae07e72abcbfc56411f56eb13cdf3fb6
4
+ data.tar.gz: ad10de7bd9e695deac3b849be8aa643208253b44
5
5
  SHA512:
6
- metadata.gz: 5cbe9936e3a71217282b89be75d17d0db17b346304fbc51d7067c4e1f7554f8d77c2293abd39045be98ca5250524d47655f5fd622915044d609d3fe247c13e46
7
- data.tar.gz: a7ae95a88e592ada5f1f3e2cf015271d604bf9801e741223e9d003ca133c55a8904b31e5e01a2d75d48c396ecebdd56fc70fabae52cd360b8c58e7eb4cc57962
6
+ metadata.gz: 8d84f4e592ca0380e20515e7b1f8ea43c66931443c9ede76b89ac0ba6061bb3bc4ddeabb6774fc8147a1bc271d4756b50c532a09e7d38714c4d9b21c54b40500
7
+ data.tar.gz: e06816739c97b086416c7ee544506203d5607d85dd4c497b63886c501d065cc01f308e64499ea90f64ef23a333e4e4396a10f7501cb3c5d221479c49b75cda1e
data/horsefield.gemspec CHANGED
@@ -26,4 +26,5 @@ Gem::Specification.new do |spec|
26
26
  spec.add_development_dependency "pry"
27
27
  spec.add_development_dependency "vcr"
28
28
  spec.add_development_dependency "webmock", "1.12.0"
29
+ spec.add_development_dependency "watir-webdriver"
29
30
  end
@@ -31,7 +31,11 @@ module Horsefield
31
31
  end
32
32
 
33
33
  def html
34
- @html || browser.get(@url).content
34
+ if browser.is_a? Mechanize
35
+ @html || browser.get(@url).content
36
+ elsif browser.is_a? Watir::Browser
37
+ @html || browser.goto(@url); browser.html
38
+ end
35
39
  end
36
40
 
37
41
  def browser
@@ -1,3 +1,3 @@
1
1
  module Horsefield
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
data/spec/scraper_spec.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'spec_helper'
2
2
  require 'horsefield/scraper'
3
+ require 'watir-webdriver'
3
4
 
4
5
  describe Horsefield::Scraper do
5
6
  describe 'with HTML' do
@@ -29,5 +30,15 @@ describe Horsefield::Scraper do
29
30
 
30
31
  result[:job][:missing].should be_nil
31
32
  end
33
+
34
+ it 'works with Watir' do
35
+ browser = Watir::Browser.new :phantomjs
36
+
37
+ result = Horsefield::Scraper.new(browser).scrape 'https://github.com/apa512' do
38
+ one :email, 'a.email'
39
+ end
40
+
41
+ p result
42
+ end
32
43
  end
33
44
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: horsefield
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erik Strömberg
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - '='
109
109
  - !ruby/object:Gem::Version
110
110
  version: 1.12.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: watir-webdriver
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
111
125
  description: It's a scraper
112
126
  email:
113
127
  - erik.stromberg@gmail.com