spec/spec_helper.rb in roxml-2.4.3 vs spec/spec_helper.rb in roxml-2.5.0
- old
+ new
@@ -2,15 +2,32 @@
module ROXML
SILENCE_XML_NAME_WARNING = true
end
-DIR = Pathname.new(__FILE__).dirname
-require DIR.join('../lib/roxml').expand_path
+DIR = Pathname.new(__FILE__ + '../..').expand_path.dirname
+LOAD_PATH = DIR.join('lib').to_s
+$LOAD_PATH.unshift(LOAD_PATH) unless
+ $LOAD_PATH.include?(LOAD_PATH) || $LOAD_PATH.include?(File.expand_path(LOAD_PATH))
+require 'roxml'
+require File.join(File.dirname(__FILE__), 'shared_specs')
+
def example(name)
- DIR.join("../examples/#{name}.rb").expand_path
+ DIR.join("examples/#{name}.rb")
end
+def fixture(name)
+ File.read(fixture_path(name))
+end
+
+def xml_fixture(name)
+ ROXML::XML::Parser.parse_file(fixture_path(name)).root
+end
+
+def fixture_path(name)
+ "test/fixtures/#{name}.xml"
+end
+
def xml_for(name)
- DIR.join("../examples/xml/#{name}.xml").expand_path
+ DIR.join("examples/xml/#{name}.xml")
end
\ No newline at end of file