Exception: Shoulda::Matchers::ActiveRecord::ValidateUniquenessOfMatcher::NonCaseSwappableValueError
- Inherits:
-
Error
- Object
- StandardError
- Error
- Shoulda::Matchers::ActiveRecord::ValidateUniquenessOfMatcher::NonCaseSwappableValueError
- Defined in:
- lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb
Instance Attribute Summary collapse
-
#attribute ⇒ Object
Returns the value of attribute attribute.
-
#model ⇒ Object
Returns the value of attribute model.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
Methods inherited from Error
Constructor Details
This class inherits a constructor from Shoulda::Matchers::Error
Instance Attribute Details
#attribute ⇒ Object
Returns the value of attribute attribute.
1158 1159 1160 |
# File 'lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb', line 1158 def attribute @attribute end |
#model ⇒ Object
Returns the value of attribute model.
1158 1159 1160 |
# File 'lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb', line 1158 def model @model end |
#value ⇒ Object
Returns the value of attribute value.
1158 1159 1160 |
# File 'lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb', line 1158 def value @value end |
Instance Method Details
#message ⇒ Object
1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 |
# File 'lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb', line 1160 def Shoulda::Matchers.word_wrap <<-MESSAGE Your #{model.name} model has a uniqueness validation on :#{attribute} which is declared to be case-sensitive, but the value the uniqueness matcher used, #{value.inspect}, doesn't contain any alpha characters, so using it to test the case-sensitivity part of the validation is ineffective. There are two possible solutions for this depending on what you're trying to do here: a) If you meant for the validation to be case-sensitive, then you need to give the uniqueness matcher a saved instance of #{model.name} with a value for :#{attribute} that contains alpha characters. b) If you meant for the validation to be case-insensitive, then you need to add `case_sensitive: false` to the validation and add `case_insensitive` to the matcher. For more information, please see: https://matchers.shoulda.io/docs/v#{Shoulda::Matchers::VERSION}/file.NonCaseSwappableValueError.html MESSAGE end |