spec/spec_helper.rb in rdf-rdfa-0.3.1.2 vs spec/spec_helper.rb in rdf-rdfa-0.3.3
- old
+ new
@@ -1,51 +1,30 @@
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$:.unshift File.dirname(__FILE__)
+require "bundler/setup"
require 'rubygems'
require 'rspec'
require 'bigdecimal' # XXX Remove Me
require 'rdf/rdfa'
require 'rdf/spec'
require 'rdf/spec/matchers'
require 'rdf/isomorphic'
-
-begin
- require 'rdf/redland'
- $redland_enabled = true
-rescue LoadError
-end
+require 'open-uri/cached'
require 'matchers'
-include Matchers
+# Create and maintain a cache of downloaded URIs
+URI_CACHE = File.expand_path(File.join(File.dirname(__FILE__), "uri-cache"))
+Dir.mkdir(URI_CACHE) unless File.directory?(URI_CACHE)
+OpenURI::Cache.class_eval { @cache_path = URI_CACHE }
-module RDF
- module Isomorphic
- alias_method :==, :isomorphic_with?
- end
- class Graph
- def to_ntriples
- RDF::Writer.for(:ntriples).buffer do |writer|
- writer << self
- end
- end
-
- def to_rdfxml
- RDF::Writer.for(:rdfxml).buffer do |writer|
- writer << self
- end
- end
- end
-end
-
::RSpec.configure do |c|
c.filter_run :focus => true
c.run_all_when_everything_filtered = true
c.exclusion_filter = {
:ruby => lambda { |version| !(RUBY_VERSION.to_s =~ /^#{version.to_s}/) },
}
- c.include(Matchers)
c.include(RDF::Spec::Matchers)
end
TMP_DIR = File.join(File.expand_path(File.dirname(__FILE__)), "tmp")
@@ -58,11 +37,9 @@
stream.rewind
else
string = stream.to_s
end
case string
- when /<\w+:RDF/ then RDF::RDFXML::Reader
- when /<RDF/ then RDF::RDFXML::Reader
when /<html/i then RDF::RDFa::Reader
when /@prefix/i then RDF::N3::Reader
else RDF::NTriples::Reader
end
end