active-triples 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 809451f4e93b30a688fe6408869e9a854f17566b
|
4
|
+
data.tar.gz: e7245d27ba5ead992693c0287cda780552525ab6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b00382722ed8c6217be858229f817707f3e9ab79de5f9d8c286894f670c1918da137aefa2f30d852ccf6f4b61974cd28d97f9a6b0833faa6bd5dc70721208b2d
|
7
|
+
data.tar.gz: 5a1df0a4b7f39d97af9a28f78cefb34af861b0a8c4276a0c50bce79b6455838d6f705b7fc6c737b7c02a1b864d5d200f70a5afcb13decc544e03d0b2d4a1bf15
|
@@ -125,7 +125,8 @@ module ActiveTriples
|
|
125
125
|
def attributes=(values)
|
126
126
|
raise ArgumentError, "values must be a Hash, you provided #{values.class}" unless values.kind_of? Hash
|
127
127
|
values = values.with_indifferent_access
|
128
|
-
|
128
|
+
id = values.delete(:id)
|
129
|
+
set_subject!(id) if id && node?
|
129
130
|
values.each do |key, value|
|
130
131
|
if reflections.reflect_on_property(key)
|
131
132
|
set_value(rdf_subject, key, value)
|
@@ -159,7 +159,7 @@ describe "nesting attribute behavior" do
|
|
159
159
|
let(:args) { [:parts] }
|
160
160
|
subject { SpecResource.new }
|
161
161
|
|
162
|
-
context "for an existing
|
162
|
+
context "for an existing B-nodes" do
|
163
163
|
before do
|
164
164
|
subject.attributes = { parts_attributes: [
|
165
165
|
{label: 'Alternator'},
|
@@ -192,6 +192,26 @@ describe "nesting attribute behavior" do
|
|
192
192
|
end
|
193
193
|
end
|
194
194
|
|
195
|
+
context "for an existing resources" do
|
196
|
+
before do
|
197
|
+
subject.attributes = { parts_attributes: [
|
198
|
+
{ id: 'http://id.loc.gov/authorities/subjects/sh85010251' },
|
199
|
+
{ id: 'http://id.loc.gov/authorities/subjects/sh2001009145' }]}
|
200
|
+
subject.parts_attributes = new_attributes
|
201
|
+
end
|
202
|
+
|
203
|
+
let(:args) { [:parts] }
|
204
|
+
|
205
|
+
let(:new_attributes) { [{ id: 'http://id.loc.gov/authorities/subjects/sh85010251' },
|
206
|
+
{ id: 'http://id.loc.gov/authorities/subjects/sh2001009145' },
|
207
|
+
{ id: 'http://id.loc.gov/authorities/subjects/sh85052223' }] }
|
208
|
+
|
209
|
+
it "should update nested objects" do
|
210
|
+
expect(subject.parts.map{|p| p.id}).to eq ["http://id.loc.gov/authorities/subjects/sh85010251", "http://id.loc.gov/authorities/subjects/sh2001009145", "http://id.loc.gov/authorities/subjects/sh85052223"]
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
|
195
215
|
context "for a new B-node" do
|
196
216
|
context "when called with reject_if" do
|
197
217
|
let(:args) { [:parts, reject_if: reject_proc] }
|
@@ -69,7 +69,7 @@ describe ActiveTriples::Resource do
|
|
69
69
|
before do
|
70
70
|
subject.set_subject! RDF::URI(nil)
|
71
71
|
end
|
72
|
-
|
72
|
+
|
73
73
|
it 'should have a subject of <>' do
|
74
74
|
expect(subject.rdf_subject).to eq RDF::URI(nil)
|
75
75
|
end
|
@@ -144,7 +144,7 @@ describe ActiveTriples::Resource do
|
|
144
144
|
subject.title = "bla"
|
145
145
|
result
|
146
146
|
end
|
147
|
-
|
147
|
+
|
148
148
|
it "should return true" do
|
149
149
|
expect(result).to eq true
|
150
150
|
end
|
@@ -391,7 +391,7 @@ describe ActiveTriples::Resource do
|
|
391
391
|
subject << RDF::Statement(RDF::URI('http://example.org/moomi'), RDF::DC.relation, node)
|
392
392
|
subject << RDF::Statement(node, RDF::DC.title, 'bnode')
|
393
393
|
end
|
394
|
-
|
394
|
+
|
395
395
|
it 'should include data with URIs as attribute names' do
|
396
396
|
expect(subject.attributes[RDF::DC.contributor.to_s]).to eq ['Tove Jansson']
|
397
397
|
end
|
@@ -402,7 +402,7 @@ describe ActiveTriples::Resource do
|
|
402
402
|
|
403
403
|
it 'should build deep data for Resources' do
|
404
404
|
expect(subject.attributes[RDF::DC.relation.to_s].first.get_values(RDF::DC.relation).
|
405
|
-
first.get_values(RDF::DC.title)).to eq ['bnode']
|
405
|
+
first.get_values(RDF::DC.title)).to eq ['bnode']
|
406
406
|
end
|
407
407
|
|
408
408
|
it 'should include deep data in serializable_hash' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active-triples
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Johnson
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-01-
|
12
|
+
date: 2015-01-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rdf
|