statement 0.5 → 0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +9 -3
- data/lib/statement/version.rb +1 -1
- data/lib/statement.rb +136 -22
- data/spec/bill_nelson_press.html +593 -0
- data/spec/cowan_press.html +1840 -0
- data/spec/statement_spec.rb +26 -0
- data/spec/vitter_press.html +2461 -0
- metadata +18 -12
data/spec/statement_spec.rb
CHANGED
@@ -31,4 +31,30 @@ describe Statement do
|
|
31
31
|
@results = Statement::Link.house_gop(@feed_url)
|
32
32
|
@results.last[:url].must_equal "http://www.gop.gov/republicans/other/relative_url_test.html"
|
33
33
|
end
|
34
|
+
|
35
|
+
it "scrapes a senate cold fusion page" do
|
36
|
+
@url = "http://www.billnelson.senate.gov/news/media.cfm?year=2013"
|
37
|
+
stub_request(:any, @url).to_return(:body => File.new(File.join(File.dirname(__FILE__), 'bill_nelson_press.html')), :status => 200)
|
38
|
+
@results = Statement::Link.billnelson(year=2013)
|
39
|
+
@results.last[:url].must_equal "http://www.billnelson.senate.gov/news/details.cfm?id=338190&"
|
40
|
+
end
|
41
|
+
|
42
|
+
it "scrapes vitter and cowan pages for 2013" do
|
43
|
+
@vitter = "http://www.vitter.senate.gov/newsroom/press?year=2013"
|
44
|
+
@cowan = "http://www.cowan.senate.gov/press?year=2013"
|
45
|
+
stub_request(:any, @vitter).to_return(:body => File.new(File.join(File.dirname(__FILE__), 'vitter_press.html')), :status => 200)
|
46
|
+
stub_request(:any, @cowan).to_return(:body => File.new(File.join(File.dirname(__FILE__), 'cowan_press.html')), :status => 200)
|
47
|
+
@results = Statement::Link.vitter_cowan(year=2013)
|
48
|
+
@results.map{|r| r[:domain]}.uniq.must_equal ["www.vitter.senate.gov", "www.cowan.senate.gov"]
|
49
|
+
end
|
50
|
+
|
51
|
+
it "only scrapes vitter page for 2012" do
|
52
|
+
@vitter = "http://www.vitter.senate.gov/newsroom/press?year=2012"
|
53
|
+
@cowan = "http://www.cowan.senate.gov/press?year=2012"
|
54
|
+
stub_request(:any, @vitter).to_return(:body => File.new(File.join(File.dirname(__FILE__), 'vitter_press.html')), :status => 200)
|
55
|
+
stub_request(:any, @cowan).to_return(:body => File.new(File.join(File.dirname(__FILE__), 'cowan_press.html')), :status => 200)
|
56
|
+
@results = Statement::Link.vitter_cowan(year=2012)
|
57
|
+
@results.map{|r| r[:domain]}.uniq.must_equal ["www.vitter.senate.gov"]
|
58
|
+
end
|
59
|
+
|
34
60
|
end
|