mirror of
https://github.com/inspec/inspec
synced 2024-11-27 15:10:44 +00:00
Merge pull request #775 from chef/dr/filter-resoruce
add resource to filter table blocks
This commit is contained in:
commit
818f0368f9
2 changed files with 8 additions and 1 deletions
|
@ -40,7 +40,7 @@ module FilterTable
|
|||
end
|
||||
|
||||
class Table
|
||||
attr_reader :params
|
||||
attr_reader :params, :resource
|
||||
def initialize(resource, params, filters)
|
||||
@resource = resource
|
||||
@params = params
|
||||
|
|
|
@ -28,6 +28,13 @@ describe FilterTable do
|
|||
factory.must_be_kind_of FilterTable::Factory
|
||||
end
|
||||
|
||||
it 'retrieves the resource from all entries' do
|
||||
factory.add_accessor(:where)
|
||||
.add(:baz?) { |x| x.resource }
|
||||
.connect(resource, :data)
|
||||
instance.baz?.must_equal instance
|
||||
end
|
||||
|
||||
describe 'when calling add_accessor' do
|
||||
it 'is chainable' do
|
||||
factory.add_accessor(:sth).must_equal factory
|
||||
|
|
Loading…
Reference in a new issue