test/test_helper.rb in alexrabarts-term_extraction-0.1.2 vs test/test_helper.rb in alexrabarts-term_extraction-0.1.3
- old
+ new
@@ -1,13 +1,22 @@
require 'rubygems'
require 'test/unit'
require 'shoulda'
require 'mocha'
+require 'fake_web'
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'term_extraction'
class Test::Unit::TestCase
- def read_xml_fixture(name)
- File.read("test/fixtures/#{name}.xml")
+ def fake_uri(method, uri, fixture)
+ FakeWeb.clean_registry
+ FakeWeb.allow_net_connect = false
+ response = File.open(File.join(File.dirname(__FILE__), 'fixtures', fixture)).read
+ FakeWeb.register_uri(method, uri.to_s, :string => response)
+ end
+
+ def teardown
+ FakeWeb.allow_net_connect = true
+ FakeWeb.clean_registry
end
end