inspec/test/unit/profiles
Jerry Aldrich III 62dc14a09c Fix only_if behavior when used outside controls (#2216)
* Fix `only_if` behavior when used outside controls

This renames `@skip_profile` to `@skip_file` and modifies the scope of
`only_if` (used outside of a control) to only apply to the control file
that contains it instead of the entire profile.

This does this by exposing `@skip_file` from the control context so that
it can be set back to `false` between loading control files in the
profile context.

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>

* Modify `get_checks` to accept a rule index

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>

* Modify `only_if` to work regardless of location

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>

* Disable Cyclomatic/Perceived Complexity in Rubocop

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>

* Add comment for `skip_file` in `load_control_file`

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2017-10-17 14:47:30 +02:00
..
control_eval_context_test.rb control and lib eval unit tests 2017-01-04 11:33:14 -05:00
library_eval_context_test.rb control and lib eval unit tests 2017-01-04 11:33:14 -05:00
metadata_test.rb throw an error during inspec check if the version is not correct 2017-05-18 09:13:37 -04:00
profile_context_test.rb Fix only_if behavior when used outside controls (#2216) 2017-10-17 14:47:30 +02:00
profile_test.rb Source reader should not hand back files with nil contents (#2003) 2017-07-11 21:33:55 +02:00