{"record":{"id":"058163b799b12511","repo":"thoughtbot/shoulda-matchers","slug":"your-model-name-model-has-a-uniqueness-validati","errorCode":null,"errorMessage":"Your #{model.name} model has a uniqueness validation on :#{attribute} which is\ndeclared to be case-sensitive, but the value the uniqueness matcher used,\n#{value.inspect}, doesn't contain any alpha characters, so using it to\ntest the case-sensitivity part of the validation is ineffective. There are\ntwo possible solutions for this depending on what you're trying to do here:\n\na) If you meant for the validation to be case-sensitive, then you need to give\n   the uniqueness matcher a saved instance of #{model.name} with a value for\n   :#{attribute} that contains alpha characters.\n\nb) If you meant for the validation to be case-insensitive, then you need to\n   add `case_sensitive: false` to the validation and add `case_insensitive` to\n   the matcher.\n\nFor more information, please see:\n\nhttps://matchers.shoulda.io/docs/v#{Shoulda::Matchers::VERSION}/file.NonCaseSwappableValueError.html","messagePattern":"Your #\\{model\\.name\\} model has a uniqueness validation on :#\\{attribute\\} which is\ndeclared to be case-sensitive, but the value the uniqueness matcher used,\n#\\{value\\.inspect\\}, doesn't contain any alpha characters, so using it to\ntest the case-sensitivity part of the validation is ineffective\\. There are\ntwo possible solutions for this depending on what you're trying to do here:\n\na\\) If you meant for the validation to be case-sensitive, then you need to give\n   the uniqueness matcher a saved instance of #\\{model\\.name\\} with a value for\n   :#\\{attribute\\} that contains alpha characters\\.\n\nb\\) If you meant for the validation to be case-insensitive, then you need to\n   add `case_sensitive: false` to the validation and add `case_insensitive` to\n   the matcher\\.\n\nFor more information, please see:\n\nhttps://matchers\\.shoulda\\.io/docs/v#\\{Shoulda::Matchers::VERSION\\}/file\\.NonCaseSwappableValueError\\.html","errorType":"exception","errorClass":"NonCaseSwappableValueError","httpStatus":null,"severity":"error","filePath":"lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb","lineNumber":750,"sourceCode":"\n        def does_not_match_uniqueness_without_scopes?\n          @failure_reason = nil\n\n          if existing_value_read.blank?\n            update_existing_record!(arbitrary_non_blank_value)\n          end\n\n          allows_value_of(existing_value_read, @expected_message)\n        end\n\n        def matches_uniqueness_with_case_sensitivity_strategy?\n          if should_test_case_sensitivity?\n            value = existing_value_read\n            swapcased_value = value.swapcase\n\n            if case_sensitivity_strategy == :sensitive\n              if value == swapcased_value\n                raise NonCaseSwappableValueError.create(\n                  model:,\n                  attribute: @attribute,\n                  value:,\n                )\n              end\n\n              allows_value_of(swapcased_value, @expected_message)\n            else\n              disallows_value_of(swapcased_value, @expected_message)\n            end\n          else\n            true\n          end\n        end\n\n        def does_not_match_uniqueness_with_case_sensitivity_strategy?\n          if should_test_case_sensitivity?\n            @failure_reason = nil","sourceCodeStart":732,"sourceCodeEnd":768,"githubUrl":"https://github.com/thoughtbot/shoulda-matchers/blob/79cdfbc326e97c9b43991b644434ca53c1f62c4c/lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb#L732-L768","documentation":"Error \"Your #{model.name} model has a uniqueness validation on :#{attribute} which is\ndeclared to be case-sensitive, but the value the uniqueness matcher used,\n#{value.inspect}, doesn't contain any alpha characters, so using it to\ntest the case-sensitivity part of the validation is ineffective. There are\ntwo possible solutions for this depending on what you're trying to do here:\n\na) If you meant for the validation to be case-sensitive, then you need to give\n   the uniqueness matcher a saved instance of #{model.name} with a value for\n   :#{attribute} that contains alpha characters.\n\nb) If you meant for the validation to be case-insensitive, then you need to\n   add `case_sensitive: false` to the validation and add `case_insensitive` to\n   the matcher.\n\nFor more information, please see:\n\nhttps://matchers.shoulda.io/docs/v#{Shoulda::Matchers::VERSION}/file.NonCaseSwappableValueError.html\" thrown in thoughtbot/shoulda-matchers.","triggerScenarios":"Thrown at lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb:750 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"79cdfbc326e97c9b43991b644434ca53c1f62c4c","analyzedAt":"2026-08-23T09:43:24.200Z","schemaVersion":2},"datasetVersion":"2026-08-23T13:39:53.451Z"}