specstar-models 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/specstar/models.rb +4 -3
- metadata +2 -2
data/lib/specstar/models.rb
CHANGED
@@ -71,10 +71,11 @@ module Specstar
|
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
|
-
RSpec::Matchers.define :validate_uniqueness_of do |attr|
|
74
|
+
RSpec::Matchers.define :validate_uniqueness_of do |attr, options|
|
75
75
|
match do |model|
|
76
|
-
(has_attribute?(model, attr) || has_association?(model, attr)) &&
|
77
|
-
|
76
|
+
(has_attribute?(model, attr) || has_association?(model, attr)) && model._validators[attr].select { |validator|
|
77
|
+
validator.instance_of?(ActiveRecord::Validations::UniquenessValidator) && (options.nil? || (options.to_a - validator.options.to_a).empty?)
|
78
|
+
}.size > 0
|
78
79
|
end
|
79
80
|
|
80
81
|
failure_message_for_should do |model|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: specstar-models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-03-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec-core
|