mirror of
https://github.com/inspec/inspec
synced 2024-11-10 15:14:23 +00:00
Revert "Profile to test the FilterTable::ExceptionCatcher issue"
This reverts commit 33e096f0854c0f156130fe610ab3ab8f8b65cad4.
This commit is contained in:
parent
805cf46848
commit
45e9288e90
4 changed files with 0 additions and 74 deletions
|
@ -1,3 +0,0 @@
|
|||
# Example InSpec Profile
|
||||
|
||||
This example shows the implementation of an InSpec profile.
|
|
@ -1,11 +0,0 @@
|
|||
describe dummy([{'name' => 'foo'}]).valid? do
|
||||
it { should eq '' }
|
||||
end
|
||||
|
||||
describe dummy([{'name' => 'foo'}]) do
|
||||
its('valid?') { should eq '' }
|
||||
end
|
||||
|
||||
describe dummy([{'name' => 'foo'}]) do
|
||||
it { should be_valid }
|
||||
end
|
|
@ -1,10 +0,0 @@
|
|||
name: filter-table-test
|
||||
title: InSpec Profile
|
||||
maintainer: The Authors
|
||||
copyright: The Authors
|
||||
copyright_email: you@example.com
|
||||
license: Apache-2.0
|
||||
summary: An InSpec Compliance Profile
|
||||
version: 0.1.0
|
||||
supports:
|
||||
platform: os
|
|
@ -1,50 +0,0 @@
|
|||
module Dummy
|
||||
class Test
|
||||
attr_reader :filter_data
|
||||
|
||||
def initialize(data)
|
||||
@filter_data = data
|
||||
end
|
||||
|
||||
filter = FilterTable.create
|
||||
filter.register_column(:names, field: 'name')
|
||||
filter.register_column(
|
||||
:tags,
|
||||
field: :tags,
|
||||
# ref: https://github.com/inspec/inspec/blob/master/docs/dev/filtertable-usage.md#lazy-loading
|
||||
lazy: lambda do |row, _criterion, _table|
|
||||
tags = row['tags']
|
||||
if tags.nil?
|
||||
raise(Inspec::Exceptions::ResourceSkipped, '`tags` for resource is missing')
|
||||
end
|
||||
|
||||
row[:tags] = tags
|
||||
end
|
||||
)
|
||||
filter.install_filter_methods_on_resource(self, :filter_data)
|
||||
end
|
||||
end
|
||||
|
||||
class DummyTest < Inspec.resource(1)
|
||||
name 'dummy'
|
||||
|
||||
attr_reader :data
|
||||
|
||||
def initialize(data)
|
||||
@data = data
|
||||
end
|
||||
|
||||
def valid?
|
||||
tags
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def tags
|
||||
r_data.tags[0]
|
||||
end
|
||||
|
||||
def r_data
|
||||
Dummy::Test.new(data)
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue