From 5667b5dabfb35f372291d4b69069b41db3e4ecb9 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Fri, 23 Jun 2017 11:55:29 -0700 Subject: [PATCH 1/4] Use test-suite from new rdfa.info using symlink for local access. --- lib/rdf/rdfa/reader.rb | 14 ++++++++- rdf-rdfa.gemspec | 1 - spec/.gitignore | 2 +- spec/spec_helper.rb | 14 --------- spec/suite_helper.rb | 71 ++++++++++++++++++++++++++++++++++++++++-- spec/suite_spec.rb | 2 +- 6 files changed, 84 insertions(+), 20 deletions(-) diff --git a/lib/rdf/rdfa/reader.rb b/lib/rdf/rdfa/reader.rb index 6a967e5e..9d711fbc 100644 --- a/lib/rdf/rdfa/reader.rb +++ b/lib/rdf/rdfa/reader.rb @@ -329,7 +329,19 @@ def initialize(input = $stdin, options = {}, &block) detect_host_language_version(input, options) - add_info(@doc, "version = #{@version}, host_language = #{@host_language}, library = #{@library}, rdfagraph = #{@options[:rdfagraph].inspect}, expand = #{@options[:vocab_expansion]}") + parse_lib = if @library == :nokogiri && @host_language == :html5 + begin + require 'nokogumbo' unless defined?(::Nokogumbo) + :nokobumbo + rescue LoadError + :nokogiri + end + else + @library + end + + parse_lib = @library == :nokogiri && defined?(::Nokogumbo) ? :nokogumbo : @library + add_info(@doc, "version = #{@version}, host_language = #{@host_language}, library = #{parse_lib}, rdfagraph = #{@options[:rdfagraph].inspect}, expand = #{@options[:vocab_expansion]}") begin initialize_xml(input, options) diff --git a/rdf-rdfa.gemspec b/rdf-rdfa.gemspec index 03192fef..c32cb2f9 100755 --- a/rdf-rdfa.gemspec +++ b/rdf-rdfa.gemspec @@ -29,7 +29,6 @@ Gem::Specification.new do |gem| gem.add_runtime_dependency 'rdf-aggregate-repo', '~> 2.2' gem.add_runtime_dependency 'htmlentities', '~> 4.3' - gem.add_development_dependency 'open-uri-cached', '~> 0.0', '>= 0.0.5' gem.add_development_dependency 'json-ld', '~> 2.0' gem.add_development_dependency 'rspec', '~> 3.5' gem.add_development_dependency 'rspec-its', '~> 1.2' diff --git a/spec/.gitignore b/spec/.gitignore index a4cc2ca5..f62378be 100644 --- a/spec/.gitignore +++ b/spec/.gitignore @@ -1 +1 @@ -/uri-cache/ +/test-suite diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 278448f5..3c22f5af 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -5,7 +5,6 @@ require 'rubygems' require 'rspec' require 'yaml' -require 'open-uri/cached' require 'rdf/isomorphic' require 'rdf/spec' require 'rdf/spec/matchers' @@ -32,11 +31,6 @@ end require 'rdf/rdfa' -# 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 } - ::RSpec.configure do |c| c.filter_run focus: true c.run_all_when_everything_filtered = true @@ -46,14 +40,6 @@ c.include(RDF::Spec::Matchers) end -# For testing, modify RDF::Util::File.open_file to use Kernel.open, so we can just use open-uri-cached -module RDF::Util::File - def self.open_file(filename_or_url, options = {}, &block) - options = options[:headers] || {} if filename_or_url.start_with?('http') - Kernel.open(filename_or_url, options, &block) - end -end - TMP_DIR = File.join(File.expand_path(File.dirname(__FILE__)), "tmp") # Heuristically detect the input stream diff --git a/spec/suite_helper.rb b/spec/suite_helper.rb index 00cc63a6..2bd7c03f 100644 --- a/spec/suite_helper.rb +++ b/spec/suite_helper.rb @@ -3,6 +3,73 @@ require 'rdf/turtle' require 'json/ld' +# For now, override RDF::Utils::File.open_file to look for the file locally before attempting to retrieve it +module RDF::Util + module File + REMOTE_PATH = "http://rdfa.info/test-suite/" + LOCAL_PATH = ::File.expand_path("../test-suite", __FILE__) + '/' + + class << self + alias_method :original_open_file, :open_file + end + + ## + # Override to use Patron for http and https, Kernel.open otherwise. + # + # @param [String] filename_or_url to open + # @param [Hash{Symbol => Object}] options + # @option options [Array, String] :headers + # HTTP Request headers. + # @return [IO] File stream + # @yield [IO] File stream + def self.open_file(filename_or_url, options = {}, &block) + case + when filename_or_url.to_s =~ /^file:/ + path = filename_or_url[5..-1] + Kernel.open(path.to_s, options, &block) + when (filename_or_url.to_s =~ %r{^#{REMOTE_PATH}} && Dir.exist?(LOCAL_PATH)) + #puts "attempt to open #{filename_or_url} locally" + localpath = filename_or_url.to_s.sub(REMOTE_PATH, LOCAL_PATH) + response = begin + ::File.open(localpath) + rescue Errno::ENOENT => e + raise IOError, e.message + end + document_options = { + base_uri: RDF::URI(filename_or_url), + charset: Encoding::UTF_8, + code: 200, + headers: {} + } + #puts "use #{filename_or_url} locally" + document_options[:headers][:content_type] = case filename_or_url.to_s + when /\.html$/ then 'text/html' + when /\.xhtml$/ then 'application/xhtml+xml' + when /\.xml$/ then 'application/xml' + when /\.svg$/ then 'image/svg+xml' + when /\.ttl$/ then 'text/turtle' + when /\.ttl$/ then 'text/turtle' + when /\.jsonld$/ then 'application/ld+json' + else 'unknown' + end + + document_options[:headers][:content_type] = response.content_type if response.respond_to?(:content_type) + # For overriding content type from test data + document_options[:headers][:content_type] = options[:contentType] if options[:contentType] + + remote_document = RDF::Util::File::RemoteDocument.new(response.read, document_options) + if block_given? + yield remote_document + else + remote_document + end + else + original_open_file(filename_or_url, options, &block) + end + end + end +end + module Fixtures RDFA_INFO = RDF::URI("http://rdfa.info/test-suite/") @@ -59,6 +126,6 @@ def results(host_language, version) end end - manifest = RDFA_INFO.join("manifest.json") + manifest = RDFA_INFO.join("manifest.jsonld") TestCase.from_jsonld(RDF::Util::File.open_file(manifest) {|f| JSON.load(f.read)}) -end \ No newline at end of file +end diff --git a/spec/suite_spec.rb b/spec/suite_spec.rb index 2ae258cf..7ac90b4a 100644 --- a/spec/suite_spec.rb +++ b/spec/suite_spec.rb @@ -17,7 +17,7 @@ pending "Invalid SPARQL query" if %w(0279 0284).include?(t.num) skip "CDN messes up email addresses" if %w(0065 0176).include?(t.num) pending "Nokogumbo error" if t.num == "0216" && host_language == "xhtml5" - skip "XMLLiteral" if %w(0198).include?(t.num) + skip "XMLLiteral" if %w(0198 0212).include?(t.num) begin t.logger = RDF::Spec.logger t.logger.info t.inspect From 1e13230db5a1ba995a9ec2962759d595fb08e834 Mon Sep 17 00:00:00 2001 From: Aymeric Brisse Date: Tue, 25 Jul 2017 17:39:04 +0200 Subject: [PATCH 2/4] Change HAML default format to :xhtml --- lib/rdf/rdfa/writer.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/rdf/rdfa/writer.rb b/lib/rdf/rdfa/writer.rb index 507f65f9..4f08802f 100644 --- a/lib/rdf/rdfa/writer.rb +++ b/lib/rdf/rdfa/writer.rb @@ -63,7 +63,9 @@ class Writer < RDF::Writer # @return [Array] attr :heading_predicates - HAML_OPTIONS = {} + HAML_OPTIONS = { + format: :xhtml + } # @return [Graph] Graph of statements serialized attr_accessor :graph @@ -629,7 +631,7 @@ def get_content(literal) end end - # Haml rendering helper. Display value for object, may be humanized into a non-canonical form + # Haml rendering helper. Display value for object, may be humanized into a non-canonical form # # @param [RDF::Literal] literal # @return [String] From f7520f7bfa5753e4703b57c19666567d4cb4cf79 Mon Sep 17 00:00:00 2001 From: Aymeric Brisse Date: Tue, 25 Jul 2017 17:41:03 +0200 Subject: [PATCH 3/4] Remove trailing spaces --- lib/rdf/rdfa.rb | 4 +- lib/rdf/rdfa/context.rb | 26 +++---- lib/rdf/rdfa/expansion.rb | 6 +- lib/rdf/rdfa/patches/string_hacks.rb | 2 +- lib/rdf/rdfa/reader.rb | 86 +++++++++++------------ lib/rdf/rdfa/reader/nokogiri.rb | 14 ++-- lib/rdf/rdfa/reader/rexml.rb | 16 ++--- lib/rdf/rdfa/writer/haml_templates.rb | 8 +-- spec/context_spec.rb | 12 ++-- spec/expansion_spec.rb | 18 ++--- spec/matchers.rb | 6 +- spec/reader_spec.rb | 98 +++++++++++++-------------- spec/suite_helper.rb | 4 +- spec/suite_spec.rb | 2 +- spec/writer_spec.rb | 32 ++++----- 15 files changed, 167 insertions(+), 167 deletions(-) diff --git a/lib/rdf/rdfa.rb b/lib/rdf/rdfa.rb index 4106851f..bf0cea39 100644 --- a/lib/rdf/rdfa.rb +++ b/lib/rdf/rdfa.rb @@ -31,9 +31,9 @@ module RDFa autoload :Reader, 'rdf/rdfa/reader' autoload :Writer, 'rdf/rdfa/writer' autoload :VERSION, 'rdf/rdfa/version' - + HTML_RDFA_CONTEXT = "http://www.w3.org/2011/rdfa-context/html-rdfa-1.1" XHTML_RDFA_CONTEXT = "http://www.w3.org/2011/rdfa-context/xhtml-rdfa-1.1" XML_RDFA_CONTEXT = "http://www.w3.org/2011/rdfa-context/rdfa-1.1" end -end \ No newline at end of file +end diff --git a/lib/rdf/rdfa/context.rb b/lib/rdf/rdfa/context.rb index 72a17646..7261cc9c 100644 --- a/lib/rdf/rdfa/context.rb +++ b/lib/rdf/rdfa/context.rb @@ -19,7 +19,7 @@ class Context # @!attribute [r] terms # @return [Hash{Symbol => RDF::URI}] attr_reader :terms - + # Default URI defined for this vocabulary # @!attribute [r] vocabulary # @return [RDF::URI] @@ -29,7 +29,7 @@ class Context # @!attribute [r] uri # @return [RDF::URI] attr_reader :uri - + ## # Initialize a new context from the given URI. # @@ -46,11 +46,11 @@ def initialize(uri, options = {}, &block) @terms = options.fetch(:terms, {}) @vocabulary = options[:vocabulary] @options = options.dup - + yield(self) if block_given? self end - + ## # @return [RDF::Util::Cache] # @private @@ -67,7 +67,7 @@ def self.cache def self.repository @repository ||= RDF::Repository.new(title: "RDFa Contexts") end - + ## # Set repository used for saving contexts # @param [RDF::Repository] repo @@ -82,14 +82,14 @@ def self.repository=(repo) end @repository = repo end - + # Return a context faulting through the cache # @return [RDF::RDFa::Context] def self.find(uri) uri = RDF::URI.intern(uri) - + return cache[uri] unless cache[uri].nil? - + # Two part creation to prevent re-entrancy problems if p1 => p2 and p2 => p1 # Return something to make the caller happy if we're re-entered cache[uri] = Struct.new(:prefixes, :terms, :vocabulary).new({}, {}, nil) @@ -112,12 +112,12 @@ def self.load(uri) uri = RDF::URI.intern(uri) repository.load(uri.to_s, base_uri: uri, graph_name: uri) unless repository.has_graph?(uri) end - + # @return [RDF::Repository] def repository Context.repository end - + ## # Defines the given named URI prefix for this context. # @@ -151,7 +151,7 @@ def term(name, uri = nil) name = name.to_s.empty? ? nil : (name.respond_to?(:to_sym) ? name.to_sym : name.to_s.to_sym) uri.nil? ? terms[name] : terms[name] = uri end - + ## # Extract vocabulary, prefix mappings and terms from a enumerable object into an instance # @@ -179,14 +179,14 @@ def parse(enumerable) log_debug("process_context: uri=#{uri.inspect}, term=#{term.inspect}, prefix=#{prefix.inspect}, vocabulary=#{vocab.inspect}") if respond_to?(:log_debug) @vocabulary = vocab if vocab - + # For every extracted triple that is the common subject of an rdfa:prefix and an rdfa:uri # predicate, create a mapping from the object literal of the rdfa:prefix predicate to the # object literal of the rdfa:uri predicate. Add or update this mapping in the local list of # URI mappings after transforming the 'prefix' component to lower-case. # For every extracted prefix(prefix.downcase, uri) if uri && prefix && prefix != "_" - + # triple that is the common subject of an rdfa:term and an rdfa:uri predicate, create a # mapping from the object literal of the rdfa:term predicate to the object literal of the # rdfa:uri predicate. Add or update this mapping in the local term mappings. diff --git a/lib/rdf/rdfa/expansion.rb b/lib/rdf/rdfa/expansion.rb index 6f8c9076..14eb9a98 100644 --- a/lib/rdf/rdfa/expansion.rb +++ b/lib/rdf/rdfa/expansion.rb @@ -108,7 +108,7 @@ def antecedent(subject, prediate, object) def consequent(subject, prediate, object) consequents << RDF::Query::Pattern.new(subject, prediate, object) end - + ## # Execute the rule against queryable, yielding each consequent with bindings # @@ -227,7 +227,7 @@ def entailment(repository, vocabs) to_add << statement end end - + repository.insert(*to_add) end end @@ -250,7 +250,7 @@ def fold(repository) to_add << statement end end - + repository.insert(*to_add) end diff --git a/lib/rdf/rdfa/patches/string_hacks.rb b/lib/rdf/rdfa/patches/string_hacks.rb index 9c9f35f8..7e2537a9 100644 --- a/lib/rdf/rdfa/patches/string_hacks.rb +++ b/lib/rdf/rdfa/patches/string_hacks.rb @@ -6,4 +6,4 @@ def align_left ws = str.match(/^(\s*)\S/m) ? $1 : '' str.gsub(/^#{ws}/m, '') end -end \ No newline at end of file +end diff --git a/lib/rdf/rdfa/reader.rb b/lib/rdf/rdfa/reader.rb index 9d711fbc..a44b0236 100644 --- a/lib/rdf/rdfa/reader.rb +++ b/lib/rdf/rdfa/reader.rb @@ -31,7 +31,7 @@ class Reader < RDF::Reader include RDF::Util::Logger XHTML = "http://www.w3.org/1999/xhtml" - + # Content model for @about and @resource. In RDFa 1.0, this was URIorSafeCURIE SafeCURIEorCURIEorIRI = { :"rdfa1.0" => [:safe_curie, :uri, :bnode], @@ -83,17 +83,17 @@ class Reader < RDF::Reader # @!attribute [r] host_language # @return [:xml, :xhtml1, :xhtml5, :html4, :html5, :svg] attr_reader :host_language - + # Version # @!attribute [r] version # @return [:"rdfa1.0", :"rdfa1.1"] attr_reader :version - + # Repository used for collecting triples. # @!attribute [r] repository # @return [RDF::Repository] attr_reader :repository - + # Returns the XML implementation module for this reader instance. # # @!attribute [rw] implementation @@ -124,7 +124,7 @@ class EvaluationContext # :nodoc: # @!attribute [rw] parent_subject # @return [RDF::URI] attr_accessor :parent_subject - + ## # The parent object. # @@ -138,14 +138,14 @@ class EvaluationContext # :nodoc: # @!attribute [rw] parent_object # @return [RDF::URI] attr_accessor :parent_object - + ## # A list of current, in-scope URI mappings. # # @!attribute [rw] uri_mappings # @return [Hash{Symbol => String}] attr_accessor :uri_mappings - + ## # A list of current, in-scope Namespaces. This is the subset of uri_mappings # which are defined using xmlns. @@ -153,7 +153,7 @@ class EvaluationContext # :nodoc: # @!attribute [rw] namespaces # @return [Hash{String => Namespace}] attr_accessor :namespaces - + ## # A list of incomplete triples. # @@ -165,14 +165,14 @@ class EvaluationContext # :nodoc: # @!attribute [rw] incomplete_triples # @return [Array>] attr_accessor :incomplete_triples - + ## # The language. Note that there is no default language. # # @!attribute [rw] language # @return [Symbol] attr_accessor :language - + ## # The term mappings, a list of terms and their associated URIs. # @@ -183,7 +183,7 @@ class EvaluationContext # :nodoc: # @!attribute [rw] term_mappings # @return [Hash{Symbol => RDF::URI}] attr_accessor :term_mappings - + ## # The default vocabulary # @@ -230,7 +230,7 @@ def initialize_copy(from) @namespaces = from.namespaces.clone @list_mapping = from.list_mapping # Don't clone end - + def inspect v = ['base', 'parent_subject', 'parent_object', 'language', 'default_vocabulary'].map do |a| "#{a}=#{o = self.send(a); o.respond_to?(:to_ntriples) ? o.to_ntriples : o.inspect}" @@ -431,7 +431,7 @@ def extract_script(el, input, type, options, &block) add_debug(el, "=> no reader found") end end - + # Look for Embedded RDF/XML unless @root.xpath("//rdf:RDF", "rdf" => "http://www.w3.org/1999/02/22-rdf-syntax-ns#").empty? extract_script(@root, @doc, "application/rdf+xml", @options) do |statement| @@ -449,7 +449,7 @@ def extract_script(el, input, type, options, &block) @repository << statement end end - + # Look for Embedded microdata unless @root.xpath("//@itemscope").empty? begin @@ -466,7 +466,7 @@ def extract_script(el, input, type, options, &block) # Perform vocabulary expansion expand(@repository) if @options[:vocab_expansion] - + @processed = true end @@ -505,7 +505,7 @@ def each_triple(&block) end enum_for(:each_triple) end - + private # Keep track of allocated BNodes @@ -513,12 +513,12 @@ def bnode(value = nil) @bnode_cache ||= {} @bnode_cache[value.to_s] ||= RDF::Node.new(value) end - + # Figure out the document path, if it is an Element or Attribute def node_path(node) "<#{base_uri}>#{node.respond_to?(:display_path) ? node.display_path : node}" end - + # Add debug event to debug array, if specified # # @param [#display_path, #to_s] node XML Node or string for showing context @@ -531,15 +531,15 @@ def add_debug(node, message = "", &block) def add_info(node, message, process_class = RDF::RDFA.Info, &block) add_processor_message(node, message, process_class, &block) end - + def add_warning(node, message, process_class = RDF::RDFA.Warning) add_processor_message(node, message, process_class) end - + def add_error(node, message, process_class = RDF::RDFA.Error) add_processor_message(node, message, process_class) end - + def add_processor_message(node, message, process_class, &block) case process_class when RDF::RDFA.Error then log_error(node_path(node), message, &block) @@ -564,7 +564,7 @@ def add_processor_message(node, message, process_class, &block) RDF::Statement.new(nc, RDF::PTR.expression, node.path, graph_name: RDF::RDFA.ProcessorGraph) ] end - + @repository.insert(*processor_statements) if cb = @options[:processor_callback] processor_statements.each {|s| cb.call(s)} @@ -603,7 +603,7 @@ def parse_whole_document(doc, base) # initialize the evaluation context with the appropriate base evaluation_context = EvaluationContext.new(base, @host_defaults) - + if @version != :"rdfa1.0" # Process default vocabularies load_initial_contexts(@host_defaults[:initial_contexts]) do |which, value| @@ -615,11 +615,11 @@ def parse_whole_document(doc, base) end end end - + traverse(root, evaluation_context) add_debug("", "parse_whole_doc: traversal complete'") end - + # Parse and process URI mappings, Term mappings and a default vocabulary from @context # # Yields each mapping @@ -737,7 +737,7 @@ def traverse(element, evaluation_context) add_error(element, "Can't parse nil element") return nil end - + add_debug(element) { "ec: #{evaluation_context.inspect}" } # local variables [7.5 Step 1] @@ -819,12 +819,12 @@ def traverse(element, evaluation_context) "[Step 2] default_vocaulary: #{default_vocabulary.inspect}" } end - + # Local term mappings [7.5 Step 3] # Next, the current element is then examined for URI mapping s and these are added to the local list of URI mappings. # Note that a URI mapping will simply overwrite any current mapping in the list that has the same name extract_mappings(element, uri_mappings, namespaces) - + # Language information [7.5 Step 4] language = element.language || language language = nil if language.to_s.empty? @@ -856,14 +856,14 @@ def traverse(element, evaluation_context) term_mappings: term_mappings, vocab: default_vocabulary, restrictions: TERMorCURIEorAbsIRI.fetch(@version, [])) - + add_debug(element) do "rels: #{rels.join(" ")}, revs: #{revs.join(" ")}" end unless (rels + revs).empty? if !(attrs[:rel] || attrs[:rev]) # Establishing a new subject if no rel/rev [7.5 Step 5] - + if @version == :"rdfa1.0" new_subject = if attrs[:about] process_uri(element, attrs[:about], evaluation_context, base, @@ -1001,7 +1001,7 @@ def traverse(element, evaluation_context) new_subject ||= process_uri(element, attrs[:src], evaluation_context, base, uri_mappings: uri_mappings, restrictions: [:uri]) if @version == :"rdfa1.0" - + # if the @typeof attribute is present, set typed resource to new subject typed_resource = new_subject if attrs[:typeof] @@ -1020,7 +1020,7 @@ def traverse(element, evaluation_context) evaluation_context.parent_object # no skip flag set this time end - + # Then the current object resource is set to the URI obtained from the first match from the following rules: current_object_resource = process_uri(element, attrs[:resource], evaluation_context, base, uri_mappings: uri_mappings, @@ -1046,7 +1046,7 @@ def traverse(element, evaluation_context) "typed_resource: #{typed_resource.to_ntriples rescue 'nil'}, " } end - + # [Step 7] If in any of the previous steps a typed resource was set to a non-null value, it is now used to provide a subject for type values; if typed_resource # Typeof is TERMorCURIEorAbsIRIs @@ -1094,7 +1094,7 @@ def traverse(element, evaluation_context) add_triple(element, new_subject, r, current_object_resource) end end - + revs.each do |r| add_triple(element, current_object_resource, r, new_subject) end @@ -1102,7 +1102,7 @@ def traverse(element, evaluation_context) # Incomplete triples and bnode creation [Step 10] add_debug(element) {"[Step 10] incompletes: rels: #{rels}, revs: #{revs}"} current_object_resource = RDF::Node.new - + # predicate: full IRI # direction: forward/reverse # lists: Save into list, don't generate triple @@ -1120,12 +1120,12 @@ def traverse(element, evaluation_context) incomplete_triples << {predicate: r, direction: :forward} end end - + revs.each do |r| incomplete_triples << {predicate: r, direction: :reverse} end end - + # Establish current object literal [Step 11] # # If the current element has a @inlist attribute, add the property to the @@ -1279,11 +1279,11 @@ def traverse(element, evaluation_context) add_debug(element) {"[Step 11] add #{current_property_value.to_ntriples} to #{p.to_ntriples} #{list_mapping[p].inspect}"} list_mapping[p] << current_property_value elsif new_subject - add_triple(element, new_subject, p, current_property_value) + add_triple(element, new_subject, p, current_property_value) end end end - + if !skip and new_subject && !evaluation_context.incomplete_triples.empty? # Complete the incomplete triples from the evaluation context [Step 12] add_debug(element) do @@ -1341,12 +1341,12 @@ def traverse(element, evaluation_context) new_ec.list_mapping = list_mapping add_debug(element, "[Step 13] new ec") end - + element.children.each do |child| # recurse only if it's an element traverse(child, new_ec) if child.element? end - + # Step 14: after traversing through child elements, for each list associated with # a property (list_mapping || {}).each do |p, l| @@ -1456,7 +1456,7 @@ def process_uri(element, value, evaluation_context, base, options = {}) add_warning(element, "Relative URI #{value}") end end - + # [7.4.3] General Use of Terms in Attributes def process_term(element, value, options) if options[:vocab] @@ -1465,7 +1465,7 @@ def process_term(element, value, options) elsif options[:term_mappings].is_a?(Hash) # If the term is in the local term mappings, use the associated URI (case sensitive). return uri(options[:term_mappings][value.to_s.to_sym]) if options[:term_mappings].has_key?(value.to_s.to_sym) - + # Otherwise, check for case-insensitive match options[:term_mappings].each_pair do |term, uri| return uri(uri) if term.to_s.downcase == value.to_s.downcase diff --git a/lib/rdf/rdfa/reader/nokogiri.rb b/lib/rdf/rdfa/reader/nokogiri.rb index e0c05a71..2dbf5a81 100644 --- a/lib/rdf/rdfa/reader/nokogiri.rb +++ b/lib/rdf/rdfa/reader/nokogiri.rb @@ -82,7 +82,7 @@ def text_content? def namespaces @node.namespace_definitions.inject({}) {|memo, ns| memo[ns.prefix] = ns.href.to_s; memo } end - + ## # Children of this node # @@ -168,7 +168,7 @@ def initialize_xml(input, options = {}) else # Try to detect charset from input options[:encoding] ||= input.charset if input.respond_to?(:charset) - + # Otherwise, default is utf-8 options[:encoding] ||= 'utf-8' options[:encoding] = options[:encoding].to_s if options[:encoding] @@ -277,13 +277,13 @@ def detect_host_language_version(input, options) end # Accessor methods to mask native elements & attributes - + ## # Return proxy for document root def root @root ||= NodeProxy.new(@doc.root) if @doc && @doc.root end - + ## # Document errors def doc_errors @@ -295,7 +295,7 @@ def doc_errors @doc.errors.reject {|e| e.to_s =~ /(?:Tag \w+ invalid)|(?:Missing attribute name)/} end end - + ## # Find value of document base # @@ -305,13 +305,13 @@ def doc_base(base) # find if the document has a base element case @host_language when :xhtml1, :xhtml5, :html4, :html5 - base_el = @doc.at_css("html>head>base") + base_el = @doc.at_css("html>head>base") base = base_el.attribute("href").to_s.split("#").first if base_el else xml_base = root.attribute_with_ns("base", RDF::XML.to_s) if root base = xml_base if xml_base end - + base end end diff --git a/lib/rdf/rdfa/reader/rexml.rb b/lib/rdf/rdfa/reader/rexml.rb index 89c02aba..bcd44274 100644 --- a/lib/rdf/rdfa/reader/rexml.rb +++ b/lib/rdf/rdfa/reader/rexml.rb @@ -85,7 +85,7 @@ def namespaces end ns_decls end - + ## # Children of this node # @@ -93,7 +93,7 @@ def namespaces def children NodeSetProxy.new(@node.children, self) end - + # Ancestors of this element, in order def ancestors @ancestors ||= parent ? parent.ancestors + [parent] : [] @@ -166,7 +166,7 @@ def method_missing(method, *args) @node.send(method, *args) end end - + ## # NodeSet proxy class NodeSetProxy @@ -214,7 +214,7 @@ def initialize_xml(input, options = {}) else # Try to detect charset from input options[:encoding] ||= input.charset if input.respond_to?(:charset) - + # Otherwise, default is utf-8 options[:encoding] ||= 'utf-8' @@ -306,19 +306,19 @@ def detect_host_language_version(input, options) end # Accessor methods to mask native elements & attributes - + ## # Return proxy for document root def root @root ||= NodeProxy.new(@doc.root) if @doc && @doc.root end - + ## # Document errors def doc_errors [] end - + ## # Find value of document base # @@ -334,7 +334,7 @@ def doc_base(base) xml_base = root.attribute("base", RDF::XML.to_s) if root base = xml_base if xml_base end - + base || @base_uri end end diff --git a/lib/rdf/rdfa/writer/haml_templates.rb b/lib/rdf/rdfa/writer/haml_templates.rb index 95893b74..cda998b6 100644 --- a/lib/rdf/rdfa/writer/haml_templates.rb +++ b/lib/rdf/rdfa/writer/haml_templates.rb @@ -3,7 +3,7 @@ module RDF::RDFa class Writer # The default set of HAML templates used for RDFa code generation BASE_HAML = { - identifier: "base", + identifier: "base", # Document # Locals: language, title, prefix, base, subjects # Yield: subjects.each @@ -99,7 +99,7 @@ class Writer # This version does not perform recursive object generation and does not attempt # to create human readable output. MIN_HAML = { - identifier: "min", + identifier: "min", # Document # Locals: language, title, prefix, base, subjects # Yield: subjects.each @@ -149,7 +149,7 @@ class Writer } DISTILLER_HAML = { - identifier: "distiller", + identifier: "distiller", # Document # Locals: language, title, prefix, base, subjects # Yield: subjects.each @@ -264,4 +264,4 @@ class Writer HAML_TEMPLATES = {base: BASE_HAML, min: MIN_HAML, distiller: DISTILLER_HAML} DEFAULT_HAML = BASE_HAML end -end \ No newline at end of file +end diff --git a/spec/context_spec.rb b/spec/context_spec.rb index 336798b2..71f04965 100644 --- a/spec/context_spec.rb +++ b/spec/context_spec.rb @@ -5,25 +5,25 @@ describe ".new" do describe "foaf" do subject { RDF::RDFa::Context.new("http://example/") } - + it "has a URI" do expect(subject.uri).to eq RDF::URI("http://example/") end - + it "has no terms" do expect(subject.terms).to be_empty end - + it "has no vocabulary" do expect(subject.vocabulary).to be_nil end - + it "has no prefixes" do expect(subject.prefixes).to be_empty end end end - + describe ".find" do describe "rdfa-1.1" do subject { RDF::RDFa::Context.find("http://www.w3.org/2011/rdfa-context/rdfa-1.1") } @@ -31,7 +31,7 @@ it "has 3 terms" do expect(subject.terms.keys.length).to eq 3 end - + it "uses symbols for term lookup" do expect(subject.terms.keys).to be_all {|k| k.is_a?(Symbol)} end diff --git a/spec/expansion_spec.rb b/spec/expansion_spec.rb index c67ff2cb..f6234f65 100644 --- a/spec/expansion_spec.rb +++ b/spec/expansion_spec.rb @@ -38,11 +38,11 @@ def expectedResults; RDF::Literal::Boolean.new(true); end def add_debug(node, message = "", &block) log_debug(node, message, &block) end - + def add_warning(node, message, process_class = RDF::RDFA.Warning) log_warn(node, message, &block) end - + def load(elements) @options = {} result = nil @@ -67,10 +67,10 @@ def load(elements) ) end end - + result end - + def parse(ttl) RDF::Graph.new << RDF::Turtle::Reader.new(ttl, prefixes: { dc: RDF::Vocab::DC.to_uri, @@ -246,7 +246,7 @@ def parse(ttl) end end end - + describe :copy_properties do { "simple" => { @@ -283,7 +283,7 @@ def parse(ttl) expect(parse(rdfa)).to be_equivalent_graph("", logger: logger) end end - + context "with graph not referencing vocabularies" do it "returns unexpanded input" do rdfa = %( @@ -314,7 +314,7 @@ def parse(ttl) expect(parse(rdfa)).to pass_query(query, logger: logger) end end - + context "with @vocab" do it "returns unexpanded input", pending: "vocabulary change?" do rdfa = %( @@ -368,7 +368,7 @@ def parse(ttl) end end end - + context "rdfa:Pattern" do { "to single id" => @@ -501,7 +501,7 @@ def parse(ttl) ?a schema:name "Amanda" . } ) - + ], }.each do |title, (input, query)| it title do diff --git a/spec/matchers.rb b/spec/matchers.rb index a893580e..0fb07946 100644 --- a/spec/matchers.rb +++ b/spec/matchers.rb @@ -20,7 +20,7 @@ @result.to_s == value end end - + failure_message do |actual| msg = "expected that #{path.inspect}\nwould be: #{value.inspect}" msg += "\n was: #{@result}" @@ -82,7 +82,7 @@ "\n#{@expected}" + "\nResults:\n#{@actual.dump(:ttl, standard_prefixes: true)}" + "\nDebug:\n#{trace}" - end + end failure_message_when_negated do |actual| trace = case @info.logger @@ -102,5 +102,5 @@ "\n#{@expected}" + "\nResults:\n#{@actual.dump(:ttl, standard_prefixes: true)}" + "\nDebug:\n#{trace}" - end + end end diff --git a/spec/reader_spec.rb b/spec/reader_spec.rb index ffacdef9..7902334d 100644 --- a/spec/reader_spec.rb +++ b/spec/reader_spec.rb @@ -82,13 +82,13 @@ inner.called(subject.class, predicate.class, object.class) end end - + it "calls Proc with processor statements for :processor_callback" do lam = double("lambda") expect(lam).to receive(:call).at_least(1) {|s| expect(s).to be_statement} RDF::RDFa::Reader.new(subject, base_uri: "http://example/", processor_callback: lam).each_triple {} end - + context "rdfagraph option" do let(:source) do %( @@ -107,7 +107,7 @@ } ) end - + let(:processor) do %( PREFIX rdfa: @@ -161,7 +161,7 @@ next unless Module.constants.map(&:to_s).include?(impl) context impl do before(:all) {@library = impl.downcase.to_s.to_sym} - + context "sanity checking" do it "simple doc" do html = %( @@ -277,7 +277,7 @@ ) expect(parse(html)).to be_equivalent_graph(expected, logger: logger, format: :ttl) end - + it "creates a typed subject with @typeof" do html = %( Title @@ -383,7 +383,7 @@ expect(parse(subject, version: "rdfa1.0")).to be_equivalent_graph(expected, logger: logger, format: :ttl) end end - + context "RDFa 1.1" do it "creates a statement with object from @src" do expected = RDF::Graph.new << @@ -420,7 +420,7 @@ expect(parse(html)).to be_equivalent_graph(expected, logger: logger) end - + it "empty @typeof on root" do html = %(Title) expected = RDF::Graph.new << RDF::Statement.new(RDF::URI(""), RDF::Vocab::DC.title, "Title") @@ -487,7 +487,7 @@ host_language: hl )).to be_equivalent_graph(expected, logger: logger, format: :ttl) end - + it %(#{does ? "uses" : "does not use"} xml:base in non-root) do html = %(
Value @@ -578,7 +578,7 @@ it "creates triple with invalid literal" do expect(parse(@rdfa, validate: false)).to be_equivalent_graph(@expected, logger: logger) end - + it "does not create triple when validating" do expect {parse(@rdfa, validate: true)}.to raise_error(RDF::ReaderError) end @@ -617,7 +617,7 @@ )} - + it "uses vocabulary when creating property IRI" do query = %q( PREFIX foaf: @@ -642,7 +642,7 @@ ) expect(parse(subject)).to pass_query(query, logger: logger) end - + context "with terms" do [ %q(term), @@ -694,7 +694,7 @@ %q( @prefix rdf: . @prefix rdfs: . - + rdf:value () . ) ], @@ -707,7 +707,7 @@ %q( @prefix rdf: . @prefix rdfs: . - + rdf:value ("Foo") . ) ], @@ -720,7 +720,7 @@ %q( @prefix rdf: . @prefix rdfs: . - + rdf:value () . ) ], @@ -734,7 +734,7 @@ %q( @prefix rdf: . @prefix rdfs: . - + rdf:value ("Foo" ) . ) ], @@ -748,7 +748,7 @@ %q( @prefix rdf: . @prefix rdfs: . - + rdf:value ("Foo" "Bar") . ) ], @@ -763,7 +763,7 @@ %q( @prefix rdf: . @prefix rdfs: . - + rdf:value ("Foo" "Bar"), "Baz" . ) ], @@ -779,7 +779,7 @@ %q( @prefix rdf: . @prefix rdfs: . - + rdf:value ( ) . ) ], @@ -797,7 +797,7 @@ %q( @prefix rdf: . @prefix rdfs: . - + rdf:value ("Foo"), ("Bar") . ) ], @@ -813,7 +813,7 @@ %q( @prefix rdf: . @prefix rdfs: . - + rdf:value ("Foo"); rdf:inlist . rdf:value ("Bar") . ) @@ -830,7 +830,7 @@ %q( @prefix rdf: . @prefix rdfs: . - + rdf:value ("Foo"); rdf:inlist . rdf:value ("Bar") . ) @@ -852,7 +852,7 @@ ), %q( @prefix rdf: . - + rdf:value "Foo" . ) ], @@ -864,7 +864,7 @@ ), %q( @prefix rdf: . - + rdf:value "Foo"@en . ) ], @@ -876,7 +876,7 @@ ), %q( @prefix rdf: . - + rdf:value "Foo"@en . ) ], @@ -888,7 +888,7 @@ ), %q( @prefix rdf: . - + rdf:value "Foo" . ) ], @@ -900,7 +900,7 @@ ), %q( @prefix rdf: . - + rdf:value . ) ], @@ -912,7 +912,7 @@ ), %q( @prefix rdf: . - + rdf:value . ) ], @@ -924,7 +924,7 @@ ), %q( @prefix rdf: . - + rdf:value "00:00:00Z"^^ . ) ], @@ -936,7 +936,7 @@ ), %q( @prefix rdf: . - + rdf:value "2011-06-28Z"^^ . ) ], @@ -948,7 +948,7 @@ ), %q( @prefix rdf: . - + rdf:value "00:00:00Z"^^ . ) ], @@ -960,7 +960,7 @@ ), %q( @prefix rdf: . - + rdf:value "2011-06-28T00:00:00Z"^^ . ) ], @@ -972,7 +972,7 @@ ), %q( @prefix rdf: . - + rdf:value "2011-06-28T00:00:00-08:00"^^ . ) ], @@ -985,7 +985,7 @@ %q( @prefix rdf: . @prefix xsd: . - + rdf:value "2012-03-18T00:00:00Z"^^xsd:string . ) ], @@ -997,7 +997,7 @@ ), %q( @prefix rdf: . - + rdf:value "2011"^^ . ) ], @@ -1009,7 +1009,7 @@ ), %q( @prefix rdf: . - + rdf:value "2011-06"^^ . ) ], @@ -1021,7 +1021,7 @@ ), %q( @prefix rdf: . - + rdf:value "P2011Y06M28DT00H00M00S"^^ . ) ], @@ -1033,7 +1033,7 @@ ), %q( @prefix rdf: . - + rdf:value "foo" . ) ], @@ -1045,7 +1045,7 @@ ), %q( @prefix rdf: . - + rdf:value "D-Day"@en . ) ], @@ -1058,7 +1058,7 @@ %q( @prefix rdf: . @prefix xsd: . - + rdf:value "this" . ) ], @@ -1070,7 +1070,7 @@ ), %q( @prefix rdf: . - + rdf:value . ) ], @@ -1082,7 +1082,7 @@ ), %q( @prefix rdf: . - + rdf:value [] . ) ], @@ -1094,7 +1094,7 @@ ), %q( @prefix rdf: . - + rdf:value " Bar ", "Bar" . ) ], @@ -1108,7 +1108,7 @@ ), %q( @prefix rdf: . - + rdf:value , "Bar" . ) ], @@ -1295,7 +1295,7 @@ ) + expected1 expect(parse(input, host_language: :xhtml1)).to be_equivalent_graph(expected1, logger: logger, format: :ttl) end - + it "xhtml5" do expected5 = %( @prefix rdf: . @@ -1307,7 +1307,7 @@ end end end - + context "@role" do { "with @id" => [ @@ -1521,7 +1521,7 @@ expect(parse(svg)).to pass_query(query, logger: logger) end end - + context "script" do { "text/turtle" => [ @@ -1731,7 +1731,7 @@ ) expect(parse(html, rdfagraph: :processor)).to pass_query(query, logger: logger) end - + it "generates rdfa:UnresolvedCURIE on missing CURIE definition" do html = %(
Undefined Curie
@@ -1749,7 +1749,7 @@ ) expect(parse(html, rdfagraph: :processor)).to pass_query(query, logger: logger) end - + %w( \x01foo foo\x01 @@ -1777,7 +1777,7 @@ expect(parse(html, rdfagraph: :processor)).to pass_query(query, logger: logger) end end - + it "generates rdfa:UnresolvedTerm on missing Term definition" do html = %(
Undefined Term
diff --git a/spec/suite_helper.rb b/spec/suite_helper.rb index 2bd7c03f..950d09a5 100644 --- a/spec/suite_helper.rb +++ b/spec/suite_helper.rb @@ -23,7 +23,7 @@ class << self # @return [IO] File stream # @yield [IO] File stream def self.open_file(filename_or_url, options = {}, &block) - case + case when filename_or_url.to_s =~ /^file:/ path = filename_or_url[5..-1] Kernel.open(path.to_s, options, &block) @@ -119,7 +119,7 @@ def input(host_language, version) else RDF::URI(base) end end - + def results(host_language, version) RDF::URI(self.property('results').to_s. sub('test-cases/', "test-cases/#{version}/#{host_language}/")) diff --git a/spec/suite_spec.rb b/spec/suite_spec.rb index 7ac90b4a..cf2e5b43 100644 --- a/spec/suite_spec.rb +++ b/spec/suite_spec.rb @@ -7,7 +7,7 @@ # W3C Test suite from http://www.w3.org/2006/07/SWD/RDFa/testsuite/ describe "w3c test cases" do require 'suite_helper' - + Fixtures::TestCase::HOST_LANGUAGE_VERSION_SETS.each do |(host_language, version)| describe "for #{host_language} #{version}" do %w(required optional buggy).each do |classification| diff --git a/spec/writer_spec.rb b/spec/writer_spec.rb index 7234a231..198296d6 100644 --- a/spec/writer_spec.rb +++ b/spec/writer_spec.rb @@ -15,7 +15,7 @@ class EX < RDF::Vocabulary("http://example/"); end before(:each) do @graph = RDF::Repository.new end - + describe ".for" do [ :rdfa, @@ -173,7 +173,7 @@ class EX < RDF::Vocabulary("http://example/"); end end end end - + context "property and rel serialize to different elements" do subject do @graph << [EX.a, RDF.value, "foo"] @@ -314,7 +314,7 @@ class EX < RDF::Vocabulary("http://example/"); end end end end - + context "xsd:string" do subject do @graph << [EX.a, EX.b, RDF::Literal.new("Albert Einstein", datatype: RDF::XSD.string)] @@ -331,7 +331,7 @@ class EX < RDF::Vocabulary("http://example/"); end end end end - + context "unknown" do subject do @graph << [EX.a, EX.b, RDF::Literal.new("Albert Einstein", datatype: EX.unknown)] @@ -349,7 +349,7 @@ class EX < RDF::Vocabulary("http://example/"); end end end end - + context "multi-valued literals", skip: ("Not unless Nokogiri loaded" if !defined?(Nokogiri)) do subject do @graph << [EX.a, EX.b, "c"] @@ -366,7 +366,7 @@ class EX < RDF::Vocabulary("http://example/"); end end end end - + context "resource objects" do subject do @graph << [EX.a, EX.b, EX.c] @@ -383,7 +383,7 @@ class EX < RDF::Vocabulary("http://example/"); end end end end - + context "multi-valued resource objects", skip: ("Not unless Nokogiri loaded" if !defined?(Nokogiri)) do subject do @graph << [EX.a, EX.b, EX.c] @@ -401,14 +401,14 @@ class EX < RDF::Vocabulary("http://example/"); end end end end - + context "lists" do { "empty list" => [ %q( @prefix rdf: . @prefix rdfs: . - + <> rdf:value () . ), { @@ -420,7 +420,7 @@ class EX < RDF::Vocabulary("http://example/"); end %q( @prefix rdf: . @prefix rdfs: . - + <> rdf:value ("Foo") . ), { @@ -432,7 +432,7 @@ class EX < RDF::Vocabulary("http://example/"); end %q( @prefix rdf: . @prefix rdfs: . - + <> rdf:value () . ), { @@ -444,7 +444,7 @@ class EX < RDF::Vocabulary("http://example/"); end %q( @prefix rdf: . @prefix rdfs: . - + <> rdf:value ("Foo" ) . ), { @@ -458,7 +458,7 @@ class EX < RDF::Vocabulary("http://example/"); end %q( @prefix rdf: . @prefix rdfs: . - + <> rdf:value ("Foo" "Bar"), "Baz" . ), { @@ -471,7 +471,7 @@ class EX < RDF::Vocabulary("http://example/"); end %q( @prefix rdf: . @prefix rdfs: . - + <> rdf:value ( ) . ), { @@ -483,7 +483,7 @@ class EX < RDF::Vocabulary("http://example/"); end %q( @prefix rdf: . @prefix rdfs: . - + rdf:value ("Foo"), ("Bar") . ), { @@ -579,7 +579,7 @@ class EX < RDF::Vocabulary("http://example/"); end def parse(input, options = {}) reader_class = RDF::Reader.for(options[:format]) if options[:format] reader_class ||= options.fetch(:reader, RDF::Reader.for(detect_format(input))) - + graph = RDF::Repository.new reader_class.new(input, options).each do |statement| graph << statement From 45d88c9f95a233b6b4025080a246d4fa7926418b Mon Sep 17 00:00:00 2001 From: Aymeric Brisse Date: Tue, 25 Jul 2017 17:45:45 +0200 Subject: [PATCH 4/4] Specs now use require_relative --- spec/context_spec.rb | 3 +-- spec/expansion_spec.rb | 3 +-- spec/format_spec.rb | 3 +-- spec/jruby_spec.rb | 3 +-- spec/reader_spec.rb | 3 +-- spec/spec_helper.rb | 4 ++-- spec/suite_spec.rb | 3 +-- spec/writer_spec.rb | 3 +-- 8 files changed, 9 insertions(+), 16 deletions(-) diff --git a/spec/context_spec.rb b/spec/context_spec.rb index 71f04965..3519b7fd 100644 --- a/spec/context_spec.rb +++ b/spec/context_spec.rb @@ -1,5 +1,4 @@ -$:.unshift "." -require 'spec_helper' +require_relative 'spec_helper' describe RDF::RDFa::Context do describe ".new" do diff --git a/spec/expansion_spec.rb b/spec/expansion_spec.rb index f6234f65..61ead2e4 100644 --- a/spec/expansion_spec.rb +++ b/spec/expansion_spec.rb @@ -1,5 +1,4 @@ -$:.unshift "." -require 'spec_helper' +require_relative 'spec_helper' class EXP < RDF::Vocabulary("http://example.org/vocab#") property :name, subPropertyOf: "foaf:name", type: "rdf:Property" diff --git a/spec/format_spec.rb b/spec/format_spec.rb index f12f0c4e..784157bc 100644 --- a/spec/format_spec.rb +++ b/spec/format_spec.rb @@ -1,5 +1,4 @@ -$:.unshift "." -require 'spec_helper' +require_relative 'spec_helper' require 'rdf/spec/format' describe RDF::RDFa::Format do diff --git a/spec/jruby_spec.rb b/spec/jruby_spec.rb index 50f0614d..23589814 100644 --- a/spec/jruby_spec.rb +++ b/spec/jruby_spec.rb @@ -1,6 +1,5 @@ # coding: utf-8 -$:.unshift "." -require 'spec_helper' +require_relative 'spec_helper' require 'rdf/spec/reader' if RUBY_PLATFORM.to_s == 'jruby' diff --git a/spec/reader_spec.rb b/spec/reader_spec.rb index 7902334d..97190624 100644 --- a/spec/reader_spec.rb +++ b/spec/reader_spec.rb @@ -1,5 +1,4 @@ -$:.unshift "." -require 'spec_helper' +require_relative 'spec_helper' require 'rdf/spec/reader' describe "RDF::RDFa::Reader" do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 3c22f5af..04a5922b 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,5 +1,4 @@ $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) -$:.unshift File.dirname(__FILE__) require "bundler/setup" require 'rubygems' @@ -8,9 +7,10 @@ require 'rdf/isomorphic' require 'rdf/spec' require 'rdf/spec/matchers' -require 'matchers' require 'rdf/turtle' require 'rdf/vocab' +require_relative 'matchers' + begin require 'nokogiri' rescue LoadError diff --git a/spec/suite_spec.rb b/spec/suite_spec.rb index cf2e5b43..1defe446 100644 --- a/spec/suite_spec.rb +++ b/spec/suite_spec.rb @@ -1,5 +1,4 @@ -$:.unshift "." -require 'spec_helper' +require_relative 'spec_helper' require 'rdf/spec/reader' unless ENV['CI'] # Skip for continuous integration diff --git a/spec/writer_spec.rb b/spec/writer_spec.rb index 198296d6..4c804c74 100644 --- a/spec/writer_spec.rb +++ b/spec/writer_spec.rb @@ -1,5 +1,4 @@ -$:.unshift "." -require 'spec_helper' +require_relative 'spec_helper' require 'rdf/xsd' require 'rdf/spec/writer' require 'rspec/matchers'