{"push_id":572145999,"size":1,"distinct_size":1,"ref":"refs/heads/ew-rewrite-tests-for-uniqueness","head":"a43b8e44dd7714fa3e2696ec22ff47145408dfa2","before":"948fdafd04919fcd3d40916f41d86d478ed185fc","commits":[{"sha":"a43b8e44dd7714fa3e2696ec22ff47145408dfa2","author":{"email":"4978aa66a7291e979a38f3b30da82a328129666c@gmail.com","name":"Elliot Winkler"},"message":"Rewrite tests for validate_uniqueness_of\n\n* The main problem I had with the old tests is that information that\n  the reader didn't need to care about was not properly abstracted away.\n  For instance, a helper method used by almost all tests will always\n  create a model called Example, and will always use an attribute called\n  \"attr\" (on which the validation is present). However, in some tests\n  the class or attribute is referred to directly. The reader shouldn't\n  have to care about either of these things, since they are constant --\n  the tests should be readable enough so that this information is not\n  necessary to understand the case being tested against.\n\n* Speaking of this helper method, some of the tests used it and some\n  didn't. Some defined their own helper methods to represent a\n  particular case (`case_sensitive: true`, `allow_nil`, etc.). This is\n  now fixed so that all but two tests use the same helper method to\n  define a model. This model is completely customizable -- one can\n  specify the type of the attribute being validated, the names and types\n  of scoped attributes, etc.\n\n* The tests around scoped attributes and different types are all\n  basically the same, so they are now compressed into a shared context.\n\n* Related to this, we no longer have to worry about setting a proper\n  value for a scope attribute. One had to know which type that attribute\n  had and come up with a reasonable default for that type. Now there is\n  a helper method that worries about this automatically.\n\n* Finally, we remove tests around case_insensitive against an integer\n  attribute (these don't make any sense, and don't work).","distinct":true,"url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/commits/a43b8e44dd7714fa3e2696ec22ff47145408dfa2"}]}