inspec/docs/resources/vbscript.md.erb

70 lines
1.2 KiB
Text
Raw Normal View History

2016-09-22 12:43:57 +00:00
---
title: About the vbscript Resource
---
# vbscript
Use the `vbscript` InSpec audit resource to test a VBScript on the Windows platform.
## Syntax
2016-09-22 12:43:57 +00:00
A `vbscript` resource block tests the output of a VBScript on the Windows platform:
describe vbscript('script contents') do
2016-09-22 12:43:57 +00:00
its('stdout') { should eq 'output' }
end
where
* `'script_name'` is the name of the VBScript to test
* `('output')` is the expected output of the VBScript
## Matchers
2016-09-22 12:43:57 +00:00
This InSpec audit resource has the following matchers:
### be
2016-09-22 12:43:57 +00:00
<%= partial "/shared/matcher_be" %>
### cmp
2016-09-22 12:43:57 +00:00
<%= partial "/shared/matcher_cmp" %>
### eq
2016-09-22 12:43:57 +00:00
<%= partial "/shared/matcher_eq" %>
### include
2016-09-22 12:43:57 +00:00
<%= partial "/shared/matcher_include" %>
### match
2016-09-22 12:43:57 +00:00
<%= partial "/shared/matcher_match" %>
## Examples
2016-09-22 12:43:57 +00:00
The following examples show how to use this InSpec audit resource.
### Test a VBScript
2016-09-22 12:43:57 +00:00
A VBScript file similar to:
script = <<-EOH
2016-09-22 12:43:57 +00:00
WScript.Echo "hello"
EOH
may be tested for multiple lines:
describe vbscript(script) do
2016-09-22 12:43:57 +00:00
its('stdout') { should eq "hello\r\n" }
end
and tested for whitespace removal from standard output:
describe vbscript(script) do
2016-09-22 12:43:57 +00:00
its('strip') { should eq "hello" }
end