remarkable_mongoid 0.3.0 → 0.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.
- data/lib/remarkable/mongoid.rb +1 -0
- data/lib/remarkable/mongoid/validate_association.rb +31 -0
- metadata +15 -13
data/lib/remarkable/mongoid.rb
CHANGED
@@ -0,0 +1,31 @@
|
|
1
|
+
module Remarkable::Mongoid
|
2
|
+
module Matchers
|
3
|
+
def validate_association(attr)
|
4
|
+
ValidateAssociationMatcher.new(attr)
|
5
|
+
end
|
6
|
+
|
7
|
+
class ValidateAssociationMatcher
|
8
|
+
attr_accessor :attr
|
9
|
+
|
10
|
+
def initialize(attr)
|
11
|
+
self.attr = attr.to_sym
|
12
|
+
end
|
13
|
+
|
14
|
+
def matches?(subject)
|
15
|
+
@subject = subject
|
16
|
+
validations = @subject._validators[attr]
|
17
|
+
validations.detect { |k| k.class == ::Mongoid::Validations::AssociatedValidator }
|
18
|
+
end
|
19
|
+
|
20
|
+
def description
|
21
|
+
"validates the :#{attr} association"
|
22
|
+
end
|
23
|
+
|
24
|
+
def failure_message_for_should
|
25
|
+
"\nAssociation validation failure\nExpected: #{@subject.class} to validate the '#{attr}' association"
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: remarkable_mongoid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 4
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.4.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Brian Cardarella
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-08-01 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -71,13 +71,13 @@ dependencies:
|
|
71
71
|
requirements:
|
72
72
|
- - "="
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
hash:
|
74
|
+
hash: 7712042
|
75
75
|
segments:
|
76
76
|
- 3
|
77
77
|
- 0
|
78
78
|
- 0
|
79
|
-
-
|
80
|
-
version: 3.0.0.
|
79
|
+
- rc
|
80
|
+
version: 3.0.0.rc
|
81
81
|
type: :development
|
82
82
|
version_requirements: *id004
|
83
83
|
- !ruby/object:Gem::Dependency
|
@@ -88,13 +88,14 @@ dependencies:
|
|
88
88
|
requirements:
|
89
89
|
- - "="
|
90
90
|
- !ruby/object:Gem::Version
|
91
|
-
hash:
|
91
|
+
hash: 62196477
|
92
92
|
segments:
|
93
93
|
- 2
|
94
94
|
- 0
|
95
95
|
- 0
|
96
|
-
-
|
97
|
-
|
96
|
+
- beta
|
97
|
+
- 15
|
98
|
+
version: 2.0.0.beta.15
|
98
99
|
type: :development
|
99
100
|
version_requirements: *id005
|
100
101
|
- !ruby/object:Gem::Dependency
|
@@ -105,14 +106,14 @@ dependencies:
|
|
105
106
|
requirements:
|
106
107
|
- - "="
|
107
108
|
- !ruby/object:Gem::Version
|
108
|
-
hash:
|
109
|
+
hash: 62196421
|
109
110
|
segments:
|
110
111
|
- 2
|
111
112
|
- 0
|
112
113
|
- 0
|
113
114
|
- beta
|
114
|
-
-
|
115
|
-
version: 2.0.0.beta.
|
115
|
+
- 19
|
116
|
+
version: 2.0.0.beta.19
|
116
117
|
type: :development
|
117
118
|
version_requirements: *id006
|
118
119
|
- !ruby/object:Gem::Dependency
|
@@ -144,6 +145,7 @@ files:
|
|
144
145
|
- README.markdown
|
145
146
|
- lib/remarkable/mongoid.rb
|
146
147
|
- lib/remarkable/mongoid/associations.rb
|
148
|
+
- lib/remarkable/mongoid/validate_association.rb
|
147
149
|
- lib/remarkable/mongoid/validate_uniqueness_of.rb
|
148
150
|
has_rdoc: true
|
149
151
|
homepage: http://github.com/bcardarella/remarkable_mongoid
|