active-fedora 11.3.1 → 11.4.0
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 +4 -4
- data/lib/active_fedora/common.rb +10 -0
- data/lib/active_fedora/persistence.rb +5 -1
- data/lib/active_fedora/version.rb +1 -1
- data/spec/unit/core_spec.rb +22 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1bd916c70022a35b187ef375993a59aea688ccd
|
4
|
+
data.tar.gz: 39a0d43d75c884e717d79197a2776156c391502d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22973752f005bcaa4bbe221dd6fc44de2c88c4ade86c5abe71b7ca38ad7493e8ec0c23185cdc55d202f0b47ae83942825ab5e4e7e644d6cb6bf436294d99a6d7
|
7
|
+
data.tar.gz: 3a3a96e70834bd59d41660a0bd5da16520b04dd258f841386455e611c360a6cddb9961b395ca4aeab228ff4a90e3ca84aebe947334a26688a1d18c7a0f07374d
|
data/lib/active_fedora/common.rb
CHANGED
@@ -17,6 +17,16 @@ module ActiveFedora
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
+
##
|
21
|
+
# @return [String] the etag from the response headers
|
22
|
+
#
|
23
|
+
# @raise [RuntimeError] when the resource is new and has no etag
|
24
|
+
# @raise [Ldp::Gone] when the resource is deleted
|
25
|
+
def etag
|
26
|
+
raise 'Unable to produce an etag for a unsaved object' if ldp_source.new?
|
27
|
+
ldp_source.head.etag
|
28
|
+
end
|
29
|
+
|
20
30
|
def ldp_source
|
21
31
|
@ldp_source
|
22
32
|
end
|
data/spec/unit/core_spec.rb
CHANGED
@@ -43,6 +43,28 @@ describe ActiveFedora::Base do
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
+
describe '#etag' do
|
47
|
+
let(:attributes) { { id: '1234' } }
|
48
|
+
|
49
|
+
it 'before save raises an error' do
|
50
|
+
expect { book.etag }
|
51
|
+
.to raise_error 'Unable to produce an etag for a unsaved object'
|
52
|
+
end
|
53
|
+
|
54
|
+
context 'after save' do
|
55
|
+
before { book.save! }
|
56
|
+
|
57
|
+
it 'has the etag from the ldp_source' do
|
58
|
+
expect(book.etag).to eq book.ldp_source.head.etag
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'after delete raises Ldp::Gone' do
|
62
|
+
book.destroy!
|
63
|
+
expect { book.etag }.to raise_error Ldp::Gone
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
46
68
|
describe "#freeze" do
|
47
69
|
before { book.freeze }
|
48
70
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active-fedora
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 11.
|
4
|
+
version: 11.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Zumwalt
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2017-06-
|
13
|
+
date: 2017-06-28 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rsolr
|