This modifies the output of failed test when using the `cmp` matcher by
calling `.inspect` on the actual value passed.
This makes it easier to diagnose failed matches due to characters such
as `\n` not being visible.
Current behavior:
```
inspec> describe command('echo demo') do
inspec> its('stdout') { should cmp 'demo' }
inspec> end
Profile: inspec-shell
Version: (not specified)
Command: `echo demo`
× stdout should cmp == "demo"
expected: "demo"
got: demo
(compared using `cmp` matcher)
Test Summary: 0 successful, 1 failure, 0 skipped
```
New behavior:
```
inspec> describe command('echo demo') do
inspec> its('stdout') { should cmp 'demo' }
inspec> end
Profile: inspec-shell
Version: (not specified)
Command: `echo demo`
× stdout should cmp == "demo"
expected: "demo"
got: "demo\n"
(compared using `cmp` matcher)
Test Summary: 0 successful, 1 failure, 0 skipped
```
Many thanks to @jazaval for discovering this!
Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
* Bump Rubocop to 0.49.1
This change bumps Rubocop to 0.49.1. There have been a lot of changes
since 0.39.0 and this PR is hopefully a nice compromise of turning off
certain cops and updating our codebase to take advantage of new Ruby
2.3 methods and operators.
Signed-off-by: Adam Leff <adam@leff.co>
* Set end-of-line format to line-feed only, avoid Windows-related CRLF issues
Signed-off-by: Adam Leff <adam@leff.co>
* Enhance cmp matcher to work with symbols
The `cmp` matcher will now stringify symbol actual values if the
expected value was passed in as a string. This will help with the file
resource `type` method where Train returns the file type as a symbol.
Signed-off-by: Adam Leff <adam@leff.co>
* Fix documentation for file type character_device
Signed-off-by: Adam Leff <adam@leff.co>
* Fix docs for block_device
Signed-off-by: Adam Leff <adam@leff.co>
* Fix file mtime docs
Signed-off-by: Adam Leff <adam@leff.co>
* New matcher 'be_in'
Fixes#2018
Signed-off-by: Rony Xavier <rx294@nyu.edu>
* small fixes to wording.
Signed-off-by: Aaron Lippold <lippold@gmail.com>
* Added code to use be_in for with the following use case:
describe nginx do
its(module_list) { should be_in AUTHORIZED_MODULE_LIST }
end
Fixes#2018
Signed-off-by: Rony Xavier <rx294@nyu.edu>
* Updates to the matcher
Fixes#2018
Signed-off-by: Rony Xavier <rx294@nyu.edu>
* Added tests for the be_in matcher
Signed-off-by: Rony Xavier <rx294@nyu.edu>
* Requested updates completed
Signed-off-by: Rony Xavier <rx294@nyu.edu>
* Remove any "All Rights Reserved" references
InSpec is licensed and released under the Apache 2.0 license. This
change removes all reference to legacy code files that still had
any Copyright or License lines referring to "All Rights Reserved".
Signed-off-by: Adam Leff <adam@leff.co>
* fix functional tests
Signed-off-by: Christoph Hartmann <chris@lollyrock.com>