From 38c6284655dea384de0ee471ddbcaec1c7a8a086 Mon Sep 17 00:00:00 2001 From: Mark Connell Date: Fri, 2 Jul 2010 00:08:00 +0100 Subject: [PATCH] Don't talk to the bustracker service during tests, fake out the connection with a cached xml sample. --- test/test_helper.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/test_helper.rb b/test/test_helper.rb index b6c518a..c2be6dc 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,8 +1,15 @@ require 'rubygems' require 'test/unit' require 'active_support' +require 'fakeweb' +FakeWeb.allow_net_connect = false require 'nokogiri' require 'bus_tracker' require 'bus_tracker/service' require 'bus_tracker/bus_stop' + +# Fake out the fetching of data for a bus service +FakeWeb.register_uri :get, + 'http://mybustracker.co.uk/getServicePoints.php?serviceMnemo=30', + :body => File.open('/Users/mark/workspaces/ruby/bustracker/test/fake_service_number_response.xml', 'rb').read