eolclub_scraper 0.0.2 → 0.0.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1aa81ece4ef8fbd1d10cc1794c302b88c56e3ac1
|
4
|
+
data.tar.gz: c529ba35fdb15771a21f7614007b729cb75aca3b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d8591d3ea3391ba59c783251cc3f5e32af95a512d5ac4d0e9dabc5691b998645662374b994430f52133b53ab8c66f30b5273e7811d943cd90b9aba762596a80
|
7
|
+
data.tar.gz: e2ca1d3ae68c831e8b1016e9edaa0c3abfb4914dd221f048f502b1c91ab6fe12bbdf995cd6da75ab33527fa66aac4cee67cb4034b0569c0187e936a3bb36c215
|
@@ -10,12 +10,14 @@ module EolclubScraper
|
|
10
10
|
# the same format, so that may be okay.
|
11
11
|
def parse(content)
|
12
12
|
doc = Nokogiri::HTML.parse(content)
|
13
|
+
description = doc.css('p').first(3).to_s
|
13
14
|
schedule_text = doc.css('p')[1].text.split("\n")[2].split(',').last.strip.split
|
14
15
|
start_time, end_time = schedule_text.last.split(/\W/)
|
15
16
|
|
16
17
|
Event.new(
|
17
18
|
Chronic.parse( [ schedule_text[0], schedule_text[1], start_time ].join(' ') ),
|
18
|
-
Chronic.parse( [ schedule_text[0], schedule_text[1], end_time ].join(' ') )
|
19
|
+
Chronic.parse( [ schedule_text[0], schedule_text[1], end_time ].join(' ') ),
|
20
|
+
description
|
19
21
|
)
|
20
22
|
end
|
21
23
|
|
@@ -3,13 +3,18 @@ require 'eolclub_scraper/event_parser'
|
|
3
3
|
describe EolclubScraper::EventParser do
|
4
4
|
|
5
5
|
describe '#parse' do
|
6
|
+
let(:parsed) { subject.parse(content) }
|
7
|
+
|
6
8
|
it 'parses an Event from the supplied content' do
|
7
|
-
expect(
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
expect( parsed.start_time ).to eq( Time.local(2013, 12, 9, 18, 0, 0) )
|
10
|
+
expect( parsed.end_time ).to eq( Time.local(2013, 12, 9, 23, 0, 0) )
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'provides the HTML description from the scraped page' do
|
14
|
+
desc = parsed.description
|
15
|
+
expect(desc).to include("Monthly Providence, RI hacknight.")
|
16
|
+
expect(desc).to include("Our next meetup is")
|
17
|
+
expect(desc).to include("@EOLclub")
|
13
18
|
end
|
14
19
|
end
|
15
20
|
|