thoughtbot--shoulda-matchers/.rubocop.yml

16 lines
351 B
YAML
Raw Normal View History

inherit_from: .hound/ruby.yml
2018-01-24 06:51:35 +00:00
AllCops:
TargetRubyVersion: 2.4
Layout/AlignParameters:
EnforcedStyle: with_fixed_indentation
Style/CollectionMethods:
Rewrite tests for validate_uniqueness_of * The main problem I had with the old tests is that information that the reader didn't need to care about was not properly abstracted away. For instance, a helper method used by almost all tests will always create a model called Example, and will always use an attribute called "attr" (on which the validation is present). However, in some tests the class or attribute is referred to directly. The reader shouldn't have to care about either of these things, since they are constant -- the tests should be readable enough so that this information is not necessary to understand the case being tested against. * Speaking of this helper method, some of the tests used it and some didn't. Some defined their own helper methods to represent a particular case (`case_sensitive: true`, `allow_nil`, etc.). This is now fixed so that all but two tests use the same helper method to define a model. This model is completely customizable -- one can specify the type of the attribute being validated, the names and types of scoped attributes, etc. * The tests around scoped attributes and different types are all basically the same, so they are now compressed into a shared context. * Related to this, we no longer have to worry about setting a proper value for a scope attribute. One had to know which type that attribute had and come up with a reasonable default for that type. Now there is a helper method that worries about this automatically. * Finally, we remove tests around case_insensitive against an integer attribute (these don't make any sense, and don't work).
2015-02-08 19:10:23 +00:00
PreferredMethods:
find: detect
reduce: inject
collect: map
find_all: select
Style/FrozenStringLiteralComment:
Enabled: false
Style/StringLiterals:
EnforcedStyle: single_quotes