specstar-models 0.0.7 → 0.0.8

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.
Files changed (2) hide show
  1. data/lib/specstar/models.rb +4 -3
  2. metadata +2 -2
@@ -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
- model._validators[attr].select { |validator| validator.instance_of? ActiveRecord::Validations::UniquenessValidator }.size > 0
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.7
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-02-16 00:00:00.000000000 Z
12
+ date: 2013-03-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec-core