summaryrefslogtreecommitdiff
path: root/spec/unit/property
Commit message (Collapse)AuthorAgeFilesLines
* Force requiring propertiesLamont Granquist2020-04-171-1/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All required properties are now required for all actions by default even if the action does not reference the property. In order to only make the property required for a subset of the actions, specify them as an array of symbols to the required options on the property. ``` property :whatever, String, required: %i{start stop} action :start do end action :stop do end action :enable do end action :disable do end ``` That property will be required for start+stop but not for enable+disable. There's an unaddressed edge case here where if you reference the property in an action which was not specified that it will also fail validation. That is correct behavior. We should probably dig into how to warn the user that they must either remove the reference to the property from that action or else to add the action to the list of required actions on the property. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Change name_property to be identity and not desired_state by defaultLamont Granquist2020-04-021-7/+12
| | | | | | | | If no other property is an identity property then the name_property is the default identity property. The name_property is also marked as not being desired state by default (the 'name' should never change). Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Style/SymbolProcLamont Granquist2019-07-052-2/+2
| | | | | | enforce pretzels. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* tweak Lint/BlockAlignmentLamont Granquist2019-07-021-22/+22
| | | | | | | | | | | | | | | Lint/BlockAlignment: Enabled: true EnforcedStyleAlignWith: start_of_block this works better with Layout/MultilineMethodCallIndentation to force indentation of multiline method calls that wind up with multiline blocks. i'd probably pull back the end to match with the start of the expression but this gets the indentation level inside the block correct. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Style/SymbolArrayLamont Granquist2019-07-021-12/+12
| | | | | | start enforcing using %i{} instead of arrays of symbols Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* fix Layout/EmptyLineAfterGuardClauseLamont Granquist2019-07-022-0/+2
| | | | | | | i like this one, gives visual priority to returns or raises that are buried in the middle of things. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* fix Layout/AlignArgumentslcg/new-chefstyleLamont Granquist2019-07-021-2/+2
| | | | | | | | | | | | | | this is using: Layout/AlignArguments: Enabled: true EnforcedStyle: with_fixed_indentation the default style can use really excessive whitespace. on starting lines which are already long, it fully indents across to where the arguments start and then begins the line there. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Setting nil to properties with implicit nil sets default valueLamont Granquist2018-03-221-4/+51
| | | | | | | | | | | | | | | | | | | | | | - This makes converting core resources to properties safer - This makes it easier to apply wrapping properties to subresources property :foo, String, default: "foo" This is where the change lies, and writing a nil here will now actually write a "foo" to the variable. property :foo, [ String, nil ], default: "foo" This is unchanged. Writing nil writes nil. property :foo, String Technically this is changed, since it writes the default value, but since nil.equal?(nil) in a very deep way no behavior changes. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Implement RFC 101: Custom Validation MessagesThom May2018-02-121-0/+9
| | | | | | Adds validation_message as a property option Signed-off-by: Thom May <thom@chef.io>
* Chef-13: Nillable propertiesLamont Granquist2017-03-151-69/+51
| | | | | | | remove deprecations and now properties are nillable and passing a nil is now always a set, not a get. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* add nillable apt_repository and nillable propertiesLamont Granquist2016-04-141-7/+23
| | | | | | in Chef-13 nillable will become 'true' by default and we'll have to deprecate and remove all nillable properties, but for now this lets us opt-in, which was can't currently do in Chef-12.
* deal with 0.37.2 renamed copsLamont Granquist2016-02-181-9/+9
| | | | | | | | | | | | | | | 252 Style/TrailingCommaInLiteral 84 Style/TrailingCommaInArguments 15 Style/SpaceAroundKeyword -- 351 Total We already dealt with SpaceAroundKeyword under its old name SpaceBeforeModifierKeyword, it looks like it got stricter about spaces after keywords. TrailingComma also got split, and it looks like the TrailingCommaInArguments behavior is new?
* autofixing auto-inserted delimiterslcg/chefstyle-batchLamont Granquist2016-02-091-4/+4
|
* auto fixing some rubocopsLamont Granquist2016-02-091-4/+4
| | | | | | | | | Style/NegatedWhile Style/ParenthesesAroundCondition Style/WhileUntilDo Style/WordArray Performance/ReverseEach Style/ColonMethodCall
* autofixing whitespace copsLamont Granquist2016-02-052-14/+20
| | | | | | | | | | | | | | | | | | | | | | 4174 Style/SpaceInsideHashLiteralBraces 1860 Style/SpaceAroundOperators 1336 Style/SpaceInsideBlockBraces 1292 Style/AlignHash 997 Style/SpaceAfterComma 860 Style/SpaceAroundEqualsInParameterDefault 310 Style/EmptyLines 294 Style/IndentationConsistency 267 Style/TrailingWhitespace 238 Style/ExtraSpacing 212 Style/SpaceBeforeBlockBraces 166 Style/MultilineOperationIndentation 144 Style/TrailingBlankLines 120 Style/EmptyLineBetweenDefs 101 Style/IndentationWidth 82 Style/SpaceAroundBlockParameters 40 Style/EmptyLinesAroundMethodBody 29 Style/EmptyLinesAroundAccessModifier 1 Style/RescueEnsureAlignment
* Fix nil with properties:John Keiser2016-01-271-90/+125
| | | | | | 1. Warn when default values are invalid. 2. Never validate nil (on set or get) if there is no default. 3. Emit "will be invalid in Chef 13" warning when setting an invalid nil value.
* Use double quotes by defaultThom May2016-01-142-162/+162
| | | | | | | This is an entirely mechanically generated (chefstyle -a) change, to go along with chef/chefstyle#5 . We should pick something and use it consistently, and my opinion is that double quotes are the appropriate thing.
* autocorrecting Style/TrailingCommalcg/trailing_commaLamont Granquist2016-01-132-6/+6
| | | | chefstyle -a fixed 1044 occurrances
* Don't warn when setting a property to nil unless its value wouldjk/updates2John Keiser2015-12-141-12/+14
| | | | | actually change. Gets rid of cases where we are initializing a resource with values from another resource.
* Flatten regex validation array so nested arrays workJohn Keiser2015-07-291-0/+5
|
* Fix issue where DSL is not emitted if state_properties happens before propertyjk/state_attrsJohn Keiser2015-07-151-0/+15
| | | | | | | | | If you call state_properties :x, and there is no property :x yet, it assumes you are working with a custom getter/setter like "def x". This is fine, but when you say "property :x", it won't override that (and will treat the property as if the getter/setter were already defined instead of creating a new one).
* Move property type derivation from "property_type" to "property"John Keiser2015-07-031-1/+4
| | | | to keep property_type simple
* Add Property.create and Resource.property_type for type system overridingJohn Keiser2015-07-031-1/+1
|
* Make required name attributes workJohn Keiser2015-07-032-352/+355
|
* Make required name attributes workjk/required_name_attributeJohn Keiser2015-07-021-4/+4
|
* Fix set_or_return order: default->coerce->validateJohn Keiser2015-06-231-23/+31
|
* Add property_is_set?John Keiser2015-06-231-31/+25
|
* Ensure validators don't run against initial valuesJohn Keiser2015-06-231-0/+3
|
* Don't validate `nil` when setting the value to nilJohn Keiser2015-06-231-19/+33
|
* Allow values to be set to nil (override defaults) if user allows itJohn Keiser2015-06-231-26/+121
|
* Make "is" fail if you pass nil and don't validate itJohn Keiser2015-06-231-59/+87
|
* Add name_propertyJohn Keiser2015-06-231-1/+1
|
* Add property Type as an alias to isJohn Keiser2015-06-232-39/+82
|
* Add "is" to propertyJohn Keiser2015-06-231-55/+55
|
* Create property on resource, alias attribute to itJohn Keiser2015-06-232-0/+958