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.
1099 1100 1101 |
# File 'lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb', line 1099 def attribute @attribute end |
#model ⇒ Object
Returns the value of attribute model.
1099 1100 1101 |
# File 'lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb', line 1099 def model @model end |
#value ⇒ Object
Returns the value of attribute value.
1099 1100 1101 |
# File 'lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb', line 1099 def value @value end |
Instance Method Details
#message ⇒ Object
1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 |
# File 'lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb', line 1101 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 |