spec/pragmatic_context_spec.rb in active-triples-0.6.1 vs spec/pragmatic_context_spec.rb in active-triples-0.7.0

- old
+ new

@@ -1,18 +1,20 @@ require 'spec_helper' require 'pragmatic_context' describe 'PragmaticContext integration' do before do - class DummyLicense < ActiveTriples::Resource + class DummyLicense + include ActiveTriples::RDFSource include PragmaticContext::Contextualizable property :title, :predicate => RDF::DC.title contextualize :title, :as => RDF::DC.title.to_s end - class DummyResource < ActiveTriples::Resource + class DummyResource + include ActiveTriples::RDFSource include PragmaticContext::Contextualizable configure :type => RDF::URI('http://example.org/SomeClass') property :license, :predicate => RDF::DC.license, :class_name => DummyLicense property :title, :predicate => RDF::DC.title @@ -39,12 +41,12 @@ g = RDF::Graph.new << JSON::LD::API.toRdf(subject.as_jsonld) expect(subject == g).to be true end it 'should have contexts' do - expect(subject.as_jsonld['@context'].keys).to eq ["license", "title"] + expect(subject.as_jsonld['@context'].keys).to contain_exactly('license', 'title') end - + it 'should use context with dump' do context = JSON.parse(subject.dump :jsonld)['@context'] subject.class.properties.keys.each do |prop| expect(context).to include prop end