Sha256: c1e9328f6f43e7ddb4f5caa697a1516b8ed876646e5391ba0aea437d2cfbafec
Contents?: true
Size: 1.94 KB
Versions: 9
Compression:
Stored size: 1.94 KB
Contents
shared_examples 'an LDP RDFSource' do it_behaves_like 'an LDP Resource' include_context 'clear repository' error_msg = "#{described_class} requires a URI rdf_subject, but got a node." let(:subject_uri) { File.join(Krikri::Settings['marmotta']['ldp'], 'rdfsrc') } it 'is an ActiveTriples::Resource' do expect(subject).to be_a ActiveTriples::Resource end shared_context 'with RDF statements' do before do statements.each { |s| subject << s } end let(:statements) do [RDF::Statement(subject, RDF::DC.title, 'My Resource'), RDF::Statement(subject, RDF::DC.date, Date.today)] end end shared_examples 'LDP rdf_subject errors' do |method, msg| it 'raises error' do expect { subject.send(method) }.to raise_error msg end end describe '#save' do context 'without subject' do include_examples 'LDP rdf_subject errors', :save, error_msg end context 'with subject' do include_context 'with RDF subject' include_context 'with RDF statements' it "persists the graph's statements" do subject.save statements.each do |statement| expect(subject.statements).to include statement end end end end describe '#get' do context 'without subject' do include_examples 'LDP rdf_subject errors', :get, error_msg end context 'with subject' do include_context 'with RDF subject' before do subject.save end include_context 'with RDF statements' context 'before saving new data' do it 'reloads initial graph' do subject.get statements.each { |s| expect(subject.statements).not_to include s } end end context 'after saving new data' do before { subject.save } it 'retains added triples' do subject.get statements.each { |s| expect(subject.statements).to include s } end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems