ddr-models 3.0.0.beta.12 → 3.0.0.beta.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ddr/events/fixity_check_event.rb +1 -1
- data/lib/ddr/models.rb +1 -0
- data/lib/ddr/models/base.rb +5 -3
- data/lib/ddr/models/fixity_check_results.rb +15 -0
- data/lib/ddr/models/metadata/metadata.rb +1 -1
- data/lib/ddr/models/version.rb +1 -1
- data/spec/models/administrative_metadata_spec.rb +1 -0
- data/spec/models/descriptive_metadata_spec.rb +1 -0
- data/spec/support/shared_examples_for_fixity_checkable_spec.rb +18 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd624d042a8843b603251a3e2335de11250c7cc7
|
4
|
+
data.tar.gz: 475629a158b74fcf445d2e75bc6a02df8df0eaab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9b86d95736d6d52758b5c9102fba56ec686a2e6c7d2e03904d52917009b002b4e6e533c51df410d6ef6ed2922fb38c36ffe7bcdacbeb607c6f6140e26818e10
|
7
|
+
data.tar.gz: 9bc4aab3edea2950ae8115ba3948eb976cb368b2dccb513eace66fb59bc8798e4963e0aea3560a0ec093354485c7a91c9688fefc3f6d9262ded9be1874f71e70
|
@@ -12,7 +12,7 @@ module Ddr
|
|
12
12
|
def self.call(*args)
|
13
13
|
super do |payload|
|
14
14
|
results = payload.delete(:results)
|
15
|
-
payload[:outcome] = results.
|
15
|
+
payload[:outcome] = results.success? ? SUCCESS : FAILURE
|
16
16
|
payload[:detail] = "Fixity check results:\n\n#{results}"
|
17
17
|
end
|
18
18
|
end
|
data/lib/ddr/models.rb
CHANGED
data/lib/ddr/models/base.rb
CHANGED
@@ -139,10 +139,12 @@ module Ddr::Models
|
|
139
139
|
end
|
140
140
|
|
141
141
|
def check_fixity
|
142
|
-
|
143
|
-
|
142
|
+
FixityCheckResults.new.tap do |results|
|
143
|
+
attached_files_having_content.each_with_object(results) do |(file_id, file), memo|
|
144
|
+
results[file_id] = !!file.check_fixity
|
145
|
+
end
|
146
|
+
notify_event(:fixity_check, results: results)
|
144
147
|
end
|
145
|
-
notify_event(:fixity_check, results: results)
|
146
148
|
end
|
147
149
|
alias_method :fixity_check, :check_fixity
|
148
150
|
deprecation_deprecate :fixity_check
|
data/lib/ddr/models/version.rb
CHANGED
@@ -18,6 +18,7 @@ module Ddr::Models
|
|
18
18
|
describe ".property_term" do
|
19
19
|
it "should return the correct property term" do
|
20
20
|
expect(described_class.property_term(:subject)).to eq(:dc_subject)
|
21
|
+
expect(described_class.property_term('subject')).to eq(:dc_subject)
|
21
22
|
end
|
22
23
|
end
|
23
24
|
describe "using the set_values and add_value methods" do
|
@@ -5,8 +5,25 @@ RSpec.shared_examples "a fixity checkable object" do
|
|
5
5
|
subject.thumbnail.content = '1234567890'
|
6
6
|
subject.save(validate: false)
|
7
7
|
end
|
8
|
-
|
8
|
+
specify {
|
9
9
|
expect { subject.check_fixity }.to change(subject.fixity_checks, :count).from(0).to(1)
|
10
|
+
}
|
11
|
+
describe "results" do
|
12
|
+
let(:results) { subject.check_fixity }
|
13
|
+
specify {
|
14
|
+
expect(results).to be_success
|
15
|
+
}
|
16
|
+
specify {
|
17
|
+
expect(results[:thumbnail]).to be true
|
18
|
+
}
|
19
|
+
describe "failure" do
|
20
|
+
before {
|
21
|
+
allow(subject.thumbnail).to receive(:check_fixity) { false }
|
22
|
+
}
|
23
|
+
specify {
|
24
|
+
expect(results).not_to be_success
|
25
|
+
}
|
26
|
+
end
|
10
27
|
end
|
11
28
|
end
|
12
29
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ddr-models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.0.beta.
|
4
|
+
version: 3.0.0.beta.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jim Coble
|
@@ -537,6 +537,7 @@ files:
|
|
537
537
|
- lib/ddr/models/files/fits_xml_file.rb
|
538
538
|
- lib/ddr/models/files/structural_metadata_file.rb
|
539
539
|
- lib/ddr/models/finding_aid.rb
|
540
|
+
- lib/ddr/models/fixity_check_results.rb
|
540
541
|
- lib/ddr/models/governable.rb
|
541
542
|
- lib/ddr/models/has_admin_metadata.rb
|
542
543
|
- lib/ddr/models/has_attachments.rb
|