Created
March 30, 2010 21:11
-
-
Save bhuga/349597 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CDs < RDF::Vocabulary('http://example.org/') | |
property :artist | |
property :cds | |
property :artists | |
end | |
class CD | |
include Spira::Resource | |
default_base_uri CDs.cds | |
property :name, DC.title , XSD.string | |
property :artist, CDs.artist, :artist | |
end | |
class Artist | |
include Spira::Resource | |
default_base_uri CDs.artists | |
property :name, DC.title, XSD.string | |
#has_many :cds, CD | |
end | |
before :all do | |
require 'cds' | |
require 'rdf/ntriples' | |
@cds_repository = RDF::Repository.load(fixture('relations.nt')) | |
Spira.add_repository(:default, @cds_repository) | |
end | |
it "should find the cd" do | |
CD.find('nevermind').should be_a CD | |
end | |
it "should find the artist" do | |
Artist.find('nirvana').should be_a Artist | |
end | |
context "referencing a single uri" do | |
before :each do | |
@cd = CD.find 'nevermind' | |
@artist = Artist.find 'nirvana' | |
end | |
it "should find a model object for a uri" do | |
@cd.artist.should == @artist | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment