inspec/test/unit/profiles
Jerry Aldrich III 71057675de Allow skipping/failing resources in FilterTable (#2349)
* Allow skipping/failing resources in FilterTable

`FilterTable` is commonly used in the class body of a resource and is
evaluated during an `instance_eval`. This means that if you raise an
exception (e.g. SkipResource) it will halt `inspec exec` and
`inspec check`.

This adds an `ExceptionCatcher` class that will postpone evaluation
until test execution.

This allows `inspec check` and `inspec exec` to perform as intended when
skipping/failing a resource in `FilterTable`

Huge thanks to @adamleff for providing the starting code/ideas!

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

* Comment why `ExceptionCatcher` doesn't raise

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

* Remove `accessor` from `ExceptionCatcher`

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

* Return the existing ExceptionCatcher object rather than creating new

Signed-off-by: Adam Leff <adam@leff.co>
2017-11-29 07:32:40 -05: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 Issue warning during check if profile name contains slash (#2231) 2017-11-09 12:32:54 +01:00
profile_context_test.rb Eliminate deprecation warnings on resource skipped messages (#2296) 2017-11-09 12:25:11 +01:00
profile_resource_exceptions_test.rb Allow skipping/failing resources in FilterTable (#2349) 2017-11-29 07:32:40 -05:00
profile_test.rb Issue warning during check if profile name contains slash (#2231) 2017-11-09 12:32:54 +01:00