active-triples 0.7.3 → 0.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_triples/rdf_source.rb +1 -1
- data/lib/active_triples/version.rb +1 -1
- data/spec/active_triples/resource_spec.rb +41 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c34e3397c213add2e02123c9d32424db9b24200b
|
4
|
+
data.tar.gz: 9927b7db8a9ff339a86cad778b33670c678797aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1165128481af2d33a2b84cad8ad2d8ddbec664d94b655af45403d41b8c39176d4c1ec035be0b21a079703fabb6f559d3990381a1f7c01a9fcd07cc4aaa0c87f2
|
7
|
+
data.tar.gz: c1b4c9ddad387f2e04faaf47084184542b13bbba142b90e4482a8e74693caf10a2f64a43fe60a4f9f45abdc19e221dbd6936aeaea3d8656b57eeb84ecf723e2a
|
@@ -291,7 +291,7 @@ module ActiveTriples
|
|
291
291
|
# @return [true, false]
|
292
292
|
def reload
|
293
293
|
@relation_cache ||= {}
|
294
|
-
return false
|
294
|
+
return false if (node? && self.class.repository != :parent) || !repository
|
295
295
|
self << repository.query(subject: rdf_subject)
|
296
296
|
unless empty?
|
297
297
|
@persisted = true
|
@@ -90,6 +90,46 @@ describe ActiveTriples::Resource do
|
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
93
|
+
describe "#reload" do
|
94
|
+
context 'with a repository' do
|
95
|
+
let(:resource) { DummyResourceWithRepo.new }
|
96
|
+
let(:repository) { RDF::Repository.new }
|
97
|
+
before do
|
98
|
+
class DummyResourceWithRepo < ActiveTriples::Resource
|
99
|
+
configure repository: :default
|
100
|
+
property :title, predicate: RDF::DC.title
|
101
|
+
end
|
102
|
+
ActiveTriples::Repositories.add_repository :default, repository
|
103
|
+
|
104
|
+
resource.title = "bla"
|
105
|
+
end
|
106
|
+
after do
|
107
|
+
Object.send(:remove_const, :DummyResourceWithRepo)
|
108
|
+
ActiveTriples::Repositories.clear_repositories!
|
109
|
+
end
|
110
|
+
|
111
|
+
context "and a persisted resource" do
|
112
|
+
before do
|
113
|
+
resource.persist!
|
114
|
+
resource.title = 'Foo'
|
115
|
+
resource.reload
|
116
|
+
end
|
117
|
+
subject { resource.title }
|
118
|
+
it { is_expected.to eq ['Foo'] }
|
119
|
+
end
|
120
|
+
|
121
|
+
context "and a b-node" do
|
122
|
+
before do
|
123
|
+
expect(repository).not_to receive(:query).with(subject: resource.rdf_subject)
|
124
|
+
resource.reload
|
125
|
+
resource.title = 'Foo'
|
126
|
+
end
|
127
|
+
subject { resource.title }
|
128
|
+
it { is_expected.to eq ['Foo'] }
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
93
133
|
describe "#persisted?" do
|
94
134
|
context 'with a repository' do
|
95
135
|
before do
|
@@ -122,6 +162,7 @@ describe ActiveTriples::Resource do
|
|
122
162
|
expect(subject).to be_persisted
|
123
163
|
end
|
124
164
|
end
|
165
|
+
|
125
166
|
context "and then reloaded" do
|
126
167
|
before do
|
127
168
|
subject.reload
|
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.7.
|
4
|
+
version: 0.7.4
|
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: 2016-01-
|
12
|
+
date: 2016-01-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rdf
|
@@ -263,3 +263,4 @@ signing_key:
|
|
263
263
|
specification_version: 4
|
264
264
|
summary: RDF graphs in ActiveModel wrappers.
|
265
265
|
test_files: []
|
266
|
+
has_rdoc:
|