mirror of
https://github.com/inspec/inspec
synced 2024-12-18 17:14:33 +00:00
43b71ff132
* Add non-halting exception support to resources This adds two `Inspec::Exceptions` that can be used within resources to either skip or fail a test without halting execution. Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
31 lines
898 B
Ruby
31 lines
898 B
Ruby
# encoding: utf-8
|
|
|
|
describe exception_resource_test('should raise ResourceSkipped', :skip_me) do
|
|
its('value') { should eq 'does not matter' }
|
|
end
|
|
|
|
describe exception_resource_test('should raise ResourceFailed', :fail_me) do
|
|
its('value') { should eq 'does not matter' }
|
|
end
|
|
|
|
describe exception_resource_test('should pass') do
|
|
its('value') { should eq 'should pass' }
|
|
end
|
|
|
|
describe exception_resource_test('fail inside matcher') do
|
|
its('inside_matcher') { should eq 'does not matter' }
|
|
end
|
|
|
|
describe exception_resource_test('skip inside matcher') do
|
|
its('inside_matcher') { should eq 'does not matter' }
|
|
end
|
|
|
|
control 'should-work-within-control' do
|
|
describe exception_resource_test('should skip', :skip_me) do
|
|
its('value') { should eq 'does not matter' }
|
|
end
|
|
|
|
describe exception_resource_test('should fail', :fail_me) do
|
|
its('value') { should eq 'does not matter' }
|
|
end
|
|
end
|