Revert "Profile to test the FilterTable::ExceptionCatcher issue"

This reverts commit 33e096f0854c0f156130fe610ab3ab8f8b65cad4.
This commit is contained in:
Vasu1105 2021-03-24 12:21:57 +05:30
parent 805cf46848
commit 45e9288e90
4 changed files with 0 additions and 74 deletions

View file

@ -1,3 +0,0 @@
# Example InSpec Profile
This example shows the implementation of an InSpec profile.

View file

@ -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

View file

@ -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

View file

@ -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