linked_vocabs 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +8 -0
- data/lib/linked_vocabs/validators/property_validator.rb +5 -1
- data/lib/linked_vocabs/version.rb +1 -1
- data/spec/property_validator_spec.rb +2 -0
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f07e3a0cbaad822e655b8c127b4b1edb1fa49e11
|
4
|
+
data.tar.gz: f13ef24b670aa873927f24fe6c9110bda117ad0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ebf54b1a679a6f847972e17d60dc9d7c71eaa31d1a4aa85c55dbfe128ecb8795d1bb309ebca3b3199cdbf314998ba8da310c24a58889676030a00910d070a294
|
7
|
+
data.tar.gz: 5c8882ea44350228f766a073b7be0f2c6db899fb4657dca3e101d60dd3c3239619037aa524abee4da161915912b69809584f8a99ca0df244d7d17200ed2b0a76
|
data/Rakefile
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
#!/usr/bin/env rake
|
2
2
|
|
3
|
+
begin
|
4
|
+
require 'bundler/setup'
|
5
|
+
rescue LoadError
|
6
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
7
|
+
end
|
8
|
+
|
3
9
|
require 'linked_vocabs'
|
4
10
|
|
11
|
+
Bundler::GemHelper.install_tasks
|
12
|
+
|
5
13
|
desc "Generate Vocabularies"
|
6
14
|
|
7
15
|
task :gen_vocabs do
|
@@ -7,7 +7,11 @@ module LinkedVocabs::Validators
|
|
7
7
|
unless v.try(:in_vocab?)
|
8
8
|
term = v.try(:rdf_subject) || v
|
9
9
|
vocabularies = record.class.properties[attribute.to_s].class_name.vocabularies.keys
|
10
|
-
|
10
|
+
if term.is_a? RDF::URI
|
11
|
+
record.errors.add :base, "value `#{term}' for `#{attribute}' property is not a term in a controlled vocabulary #{vocabularies.join(', ')}"
|
12
|
+
else
|
13
|
+
record.errors.add :base, "`#{term}' for `#{attribute}' property is expected to be a URI, but it is a #{term.class}"
|
14
|
+
end
|
11
15
|
end
|
12
16
|
end
|
13
17
|
end
|
@@ -66,8 +66,10 @@ describe LinkedVocabs::Validators::PropertyValidator do
|
|
66
66
|
before do
|
67
67
|
subject.dctype = 'freetext value'
|
68
68
|
end
|
69
|
+
|
69
70
|
it 'is invalid' do
|
70
71
|
expect(subject).not_to be_valid
|
72
|
+
expect(subject.errors.full_messages).to eq ["`freetext value' for `dctype' property is expected to be a URI, but it is a String"]
|
71
73
|
end
|
72
74
|
end
|
73
75
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: linked_vocabs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Johnson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -196,7 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
196
196
|
version: '0'
|
197
197
|
requirements: []
|
198
198
|
rubyforge_project:
|
199
|
-
rubygems_version: 2.
|
199
|
+
rubygems_version: 2.4.5.1
|
200
200
|
signing_key:
|
201
201
|
specification_version: 4
|
202
202
|
summary: Linked Data Controlled Vocabularies for ActiveFedora::Rdf.
|
@@ -205,4 +205,3 @@ test_files:
|
|
205
205
|
- spec/linked_vocabs_spec.rb
|
206
206
|
- spec/property_validator_spec.rb
|
207
207
|
- spec/spec_helper.rb
|
208
|
-
has_rdoc:
|