spec/helper.rb in stock_index-0.7.0 vs spec/helper.rb in stock_index-0.8.0
- old
+ new
@@ -39,10 +39,38 @@
stub_request(:get, "http://www.sec.gov/cgi-bin/browse-edgar?CIK=ZZZZ&action=getcompany").
with(:headers => {'Accept' => '*/*'}).
to_return(:status => 200, :body => "", :headers => {})
+ stub_request(:get, "http://www.londonstockexchange.com/exchange/prices-and-markets/stocks/indices/summary/summary-indices-constituents.html?index=UKX&page=1").
+ with(:headers => {'Accept' => '*/*'}).
+ to_return(:status => 200, :body => fixture_html_ftse(1), :headers => {})
+
+ stub_request(:get, "http://www.londonstockexchange.com/exchange/prices-and-markets/stocks/indices/summary/summary-indices-constituents.html?index=UKX&page=2").
+ with(:headers => {'Accept' => '*/*'}).
+ to_return(:status => 200, :body => fixture_html_ftse(2), :headers => {})
+
+ stub_request(:get, "http://www.londonstockexchange.com/exchange/prices-and-markets/stocks/indices/summary/summary-indices-constituents.html?index=UKX&page=3").
+ with(:headers => {'Accept' => '*/*'}).
+ to_return(:status => 200, :body => fixture_html_ftse(3), :headers => {})
+
+ stub_request(:get, "http://www.londonstockexchange.com/exchange/prices-and-markets/stocks/indices/summary/summary-indices-constituents.html?index=UKX&page=4").
+ with(:headers => {'Accept' => '*/*'}).
+ to_return(:status => 200, :body => fixture_html_ftse(4), :headers => {})
+
+ stub_request(:get, "http://www.londonstockexchange.com/exchange/prices-and-markets/stocks/indices/summary/summary-indices-constituents.html?index=UKX&page=5").
+ with(:headers => {'Accept' => '*/*'}).
+ to_return(:status => 200, :body => fixture_html_ftse(5), :headers => {})
+
+ stub_request(:get, "http://www.londonstockexchange.com/exchange/prices-and-markets/stocks/indices/summary/summary-indices-constituents.html?index=UKX&page=6").
+ with(:headers => {'Accept' => '*/*'}).
+ to_return(:status => 200, :body => fixture_html_ftse(6), :headers => {})
+
+ stub_request(:get, "http://en.wikipedia.org/wiki/FTSE_100_Index").
+ with(:headers => {'Accept' => '*/*'}).
+ to_return(:status => 200, :body => fixture_html('ftse_wikipedia'), :headers => {})
+
end
end
def fixture_path
File.expand_path('../fixtures', __FILE__)
@@ -65,6 +93,10 @@
YAML::load_file(fixture_yaml(symbol))
end
def edgar_html
File.new(File.join(fixture_path, 'html', "edgar.html"))
+end
+
+def fixture_html_ftse(page)
+ File.new(File.join(fixture_path, 'html', "ftse_#{page}.html"))
end
\ No newline at end of file