statement 0.5 → 0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -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