inspec/test/unit
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
..
bundles Switch to tomlrb for TOML parsing (#2295) 2017-11-08 11:41:00 +01:00
dependencies Properly compare profile version strings as SemVer (#2280) 2017-11-09 12:29:41 +01:00
dsl Include ref when writing out inspec control objects (#2259) 2017-10-24 17:50:23 -04:00
fetchers Don't send HTTP headers that have nil values (#1948) 2017-06-21 19:09:13 -05:00
mock Allow skipping/failing resources in FilterTable (#2349) 2017-11-29 07:32:40 -05:00
objects forgiving default attributes (#2177) 2017-09-22 08:57:51 -04:00
plugins Remove some warnings during the test run 2016-09-09 14:14:36 +01:00
profiles Allow skipping/failing resources in FilterTable (#2349) 2017-11-29 07:32:40 -05:00
resources http resource: properly support HEAD request with remote worker (#2340) 2017-11-27 18:17:39 +01:00
source_readers Source reader should not hand back files with nil contents (#2003) 2017-07-11 21:33:55 +02:00
utils nginx resource: support quoted identifiers (#2292) 2017-11-08 12:42:37 -05:00
file_provider_test.rb Remove meaningless stdout message (#2313) 2017-11-17 15:56:36 -05:00
runner_test.rb Add attributes file readability error handling (#2127) 2017-09-08 08:43:33 -04:00
shell_detector_test.rb Corrected some unit test warnings (#2242) 2017-10-17 14:49:26 +02:00