hydra-validations 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f00975706cfd4a91b57c5a09f1213dd3c70d7f94
4
- data.tar.gz: 5cd13aed9137be4e5b7a1d5a2613e480714c769e
3
+ metadata.gz: d2420e8bab9e84e4208c4cad52baeb3b8b0e7f4b
4
+ data.tar.gz: 889cba23c9ce004052a4418fca5998f5243e8c1b
5
5
  SHA512:
6
- metadata.gz: c1693bbdea424392a36c1ce404bfa101c4b0b50018bcc3bcf547aeb3c9080f846a70e3c3db369cd65c8ab9bcf9a9f4815db8c52c73b3ea75d02e70f651676a2d
7
- data.tar.gz: fcf3f038f0dea92121caab4e694c8acb2bbc3a34f11ec8e4abe52d4df7a8eeb12ad05d7143b3d3a30f238f219441c32df6b41097a7630ef928f1f9fe68f23f53
6
+ metadata.gz: d076b873438ea19423e095d61aa24425cb160dd0c918346c6b1c480bf180919b42df10cd6865e9e13d7a741f5e2a5852980d1e3938e369dcae8a001a5823cc2e
7
+ data.tar.gz: 70ef6f6ec3a124046861bfc361a5d9486776d3efb9dbb788d3a969f081a6e94612aeb60c9c440601bc52eea8a78d224813c032882a6a18292fd046f1a2140e8a
data/CONTRIBUTORS.md CHANGED
@@ -1,3 +1,4 @@
1
1
  Contributors to this project:
2
2
 
3
3
  * David Chandek-Stark
4
+ * Jeremy Friesen
data/README.md CHANGED
@@ -10,7 +10,6 @@ Custom validators for Hydra applications, based on ActiveModel::Validations.
10
10
 
11
11
  * Ruby >= 1.9.3
12
12
  * ActiveModel 4.x
13
- * ActiveFedora 7.x
14
13
 
15
14
  ## Installation
16
15
 
@@ -92,10 +91,12 @@ end
92
91
  => ["Field value \"spam\" is not included in the list", "Field value \"eggs\" is not included in the list"]
93
92
  ```
94
93
 
95
- ### UniquenessValidator (ActiveFedora)
94
+ ### UniquenessValidator
96
95
 
97
96
  Validates the uniqueness of an attribute based on a Solr index query.
98
97
 
98
+ Intended for ActiveFedora 7.x.
99
+
99
100
  ```ruby
100
101
  class UniquenessValidatable < ActiveFedora::Base
101
102
  include Hydra::Validations
@@ -21,7 +21,6 @@ Gem::Specification.new do |spec|
21
21
  spec.require_paths = ["lib", "app/validators"]
22
22
 
23
23
  spec.add_dependency "activemodel", "~> 4.0"
24
- spec.add_dependency "active-fedora", "~> 7.0"
25
24
  spec.add_development_dependency "bundler", "~> 1.6"
26
25
  spec.add_development_dependency "rake"
27
26
  spec.add_development_dependency "rspec"
@@ -3,7 +3,7 @@ require 'hydra/validations/enumerable_behavior'
3
3
  module Hydra
4
4
  module Validations
5
5
  #
6
- # InclusionValidation - Adds EnumerableBehavior to ActiveModel's InclusionValidator
6
+ # InclusionValidator - Adds EnumerableBehavior to ActiveModel's InclusionValidator
7
7
  #
8
8
  # See ActiveModel::Validations::InclusionValidator for usage and options
9
9
  #
@@ -1,5 +1,5 @@
1
1
  module Hydra
2
2
  module Validations
3
- VERSION = "0.3.0"
3
+ VERSION = "0.3.1"
4
4
  end
5
5
  end
@@ -1,5 +1,4 @@
1
1
  require 'spec_helper'
2
- require 'active_fedora'
3
2
  require 'support/shared_examples_for_validators'
4
3
 
5
4
  shared_examples "it validates the uniqueness of the attribute value" do
@@ -20,11 +19,23 @@ end
20
19
  describe Hydra::Validations::UniquenessValidator do
21
20
 
22
21
  before(:all) do
23
- class Validatable < ActiveFedora::Base
22
+ class Validatable
23
+ def self.exists?(*args)
24
+ end
25
+ def self.name
26
+ 'Validatable'
27
+ end
28
+ def persisted?
29
+ end
30
+ def initialize(attributes = {})
31
+ attributes.each do |k,v|
32
+ send("#{k}=", v)
33
+ end
34
+ end
35
+ include ActiveModel::Validations
24
36
  include Hydra::Validations
25
- has_metadata name: 'descMetadata', type: ActiveFedora::QualifiedDublinCoreDatastream
26
- has_attributes :title, datastream: 'descMetadata', multiple: false
27
- has_attributes :source, datastream: 'descMetadata', multiple: true
37
+ attr_accessor :pid, :title, :source
38
+ alias_method :id, :pid
28
39
  end
29
40
  end
30
41
 
@@ -88,7 +99,7 @@ describe Hydra::Validations::UniquenessValidator do
88
99
  it_behaves_like "it validates the uniqueness of the attribute value" do
89
100
  let(:conditions) { {"source_ssim" => subject.source.first, "-id" => subject.pid} }
90
101
  end
91
- end
102
+ end
92
103
  end
93
104
  end
94
105
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hydra-validations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - dchandekstark
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-19 00:00:00.000000000 Z
11
+ date: 2014-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '4.0'
27
- - !ruby/object:Gem::Dependency
28
- name: active-fedora
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '7.0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '7.0'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: bundler
43
29
  requirement: !ruby/object:Gem::Requirement