Sha256: 6156e84476976b6d995f62d2ea0ce3e65b05adc2c2255859514c3fcd2fbf8444

Contents?: true

Size: 1.71 KB

Versions: 1

Compression:

Stored size: 1.71 KB

Contents

$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$:.unshift File.dirname(__FILE__)

require "bundler/setup"
require 'rspec'
require 'rdf'
require 'rdf/isomorphic'
require 'rdf/nquads'
require 'rdf/turtle'
require 'rdf/trig'
require 'rdf/vocab'
require 'rdf/spec'
require 'rdf/spec/matchers'
require 'yaml'
require 'restclient/components'
require 'rack/cache'
require 'matchers'
require 'simplecov'
require 'coveralls'
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
  SimpleCov::Formatter::HTMLFormatter,
  Coveralls::SimpleCov::Formatter
]
SimpleCov.start do
  add_filter "/spec/"
end

require 'json/ld'

JSON_STATE = JSON::State.new(
  indent:       "  ",
  space:        " ",
  space_before: "",
  object_nl:    "\n",
  array_nl:     "\n"
)

# 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)
# Cache client requests
RestClient.enable Rack::Cache,
  verbose:      false, 
  metastore:   "file:" + ::File.expand_path("../uri-cache/meta", __FILE__),
  entitystore: "file:" + ::File.expand_path("../uri-cache/body", __FILE__)

::RSpec.configure do |c|
  c.filter_run focus: true
  c.run_all_when_everything_filtered = true
  c.include(RDF::Spec::Matchers)
end

# Heuristically detect the input stream
def detect_format(stream)
  # Got to look into the file to see
  if stream.respond_to?(:rewind) && stream.respond_to?(:read)
    stream.rewind
    string = stream.read(1000)
    stream.rewind
  else
    string = stream.to_s
  end
  case string
  when /<html/i           then RDF::RDFa::Reader
  when /\{\s*\"@\"/i      then JSON::LD::Reader
  else                         RDF::Turtle::Reader
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
json-ld-1.99.0 spec/spec_helper.rb