inspec/test
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
..
cookbooks/os_prepare Add wildcard support to Utils::FindFiles (#2159) 2017-09-23 09:17:34 +02:00
functional Allow skipping/failing resources in FilterTable (#2349) 2017-11-29 07:32:40 -05:00
integration wmi resource: properly escape quotes in WMI query (#2342) 2017-11-29 12:01:44 +01:00
unit Allow skipping/failing resources in FilterTable (#2349) 2017-11-29 07:32:40 -05:00
docker_run.rb travis experiment: lower docker concurrency 2016-08-10 12:52:21 +01:00
docker_test.rb Load all dependent libraries, even if include_context isn't called 2016-09-04 20:55:20 +02:00
helper.rb http resource: properly support HEAD request with remote worker (#2340) 2017-11-27 18:17:39 +01:00