Skip to content

Instantly share code, notes, and snippets.

@jcoyne
Created January 6, 2015 16:42
Show Gist options
  • Save jcoyne/4c47cf6eb7ae6ec0ee07 to your computer and use it in GitHub Desktop.
Save jcoyne/4c47cf6eb7ae6ec0ee07 to your computer and use it in GitHub Desktop.
require 'spec_helper'
describe 'A controlled vocabulary' do
before do
class Foo < ActiveTriples::Resource
property :lcsubject, predicate: RDF::DC.subject, class_name: Oargun::ControlledVocabularies::Subject do |index|
index.as :stored_searchable
end
end
end
after { Object.send(:remove_const, :Foo) }
subject { Foo.new(location: location) }
context 'when the location is in the vocabulary' do
let(:location) { RDF::URI.new('http://id.loc.gov/authorities/names/n79081574') }
it "should create an object" do
subject.set_subject!('http://example.com/123')
end
end
context 'when the location is not in the vocabulary' do
let(:location) { RDF::URI.new('http://foo.bar/authorities/names/n79081574') }
it "should create an object" do
subject.set_subject!('http://example.com/123')
end
end
end
Finished in 1 minute 45.76 seconds (files took 1.79 seconds to load)
2 examples, 0 failures
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment