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.
@@ -6,6 +6,7 @@ end
6
6
  require 'remarkable/active_model'
7
7
  require 'remarkable/mongoid/associations'
8
8
  require 'remarkable/mongoid/validate_uniqueness_of'
9
+ require 'remarkable/mongoid/validate_association'
9
10
 
10
11
  if defined?(RSpec) # RSpec 2.x
11
12
  RSpec.configure do |config|
@@ -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: 19
4
+ hash: 15
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 3
8
+ - 4
9
9
  - 0
10
- version: 0.3.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-07-30 00:00:00 -04:00
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: -1848230024
74
+ hash: 7712042
75
75
  segments:
76
76
  - 3
77
77
  - 0
78
78
  - 0
79
- - beta4
80
- version: 3.0.0.beta4
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: -1967355489
91
+ hash: 62196477
92
92
  segments:
93
93
  - 2
94
94
  - 0
95
95
  - 0
96
- - beta11
97
- version: 2.0.0.beta11
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: 62196417
109
+ hash: 62196421
109
110
  segments:
110
111
  - 2
111
112
  - 0
112
113
  - 0
113
114
  - beta
114
- - 17
115
- version: 2.0.0.beta.17
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