Sha256: 2ff3ef2f5fcfcb6039d872fc03173e95137b76e141d394458d5ed5a6d391b538

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

Contents

# coding: utf-8
require_relative 'spec_helper'
require 'rdf/spec/format'

describe YAML_LD::Format do
  it_behaves_like 'an RDF::Format' do
    let(:format_class) {YAML_LD::Format}
  end

  describe ".for" do
    [
      :yamlld,
      "etc/doap.yamlld",
      {file_name:      'etc/doap.yamlld'},
      {file_extension: 'yamlld'},
      {content_type:   'application/ld+yaml'},
    ].each do |arg|
      it "discovers with #{arg.inspect}" do
        expect(RDF::Format.for(arg)).to eq described_class
      end
    end

    {
      yamlld:   %(---
        "@context": "foo"
      ),
      context:  %(---
        "@context": {
      ),
      id:       %(---
        "@id": "foo"
      ),
      type:       %(---
        "@type": "foo"
      ),
    }.each do |sym, str|
      it "detects #{sym}" do
        expect(described_class.for {str}).to eq described_class
      end
    end

    it "should discover 'yamlld'" do
      expect(RDF::Format.for(:yamlld).reader).to eq YAML_LD::Reader
    end
  end

  describe "#to_sym" do
    specify {expect(described_class.to_sym).to eq :yamlld}
  end

  describe "#to_uri" do
    specify {expect(described_class.to_uri).to eq RDF::URI('http://www.w3.org/ns/formats/YAML-LD')}
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
yaml-ld-0.0.1 spec/format_spec.rb