mirror of
https://github.com/inspec/inspec
synced 2024-11-23 21:23:29 +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
|
end
|
||||||
|
|
||||||
class Table
|
class Table
|
||||||
attr_reader :params
|
attr_reader :params, :resource
|
||||||
def initialize(resource, params, filters)
|
def initialize(resource, params, filters)
|
||||||
@resource = resource
|
@resource = resource
|
||||||
@params = params
|
@params = params
|
||||||
|
|
|
@ -28,6 +28,13 @@ describe FilterTable do
|
||||||
factory.must_be_kind_of FilterTable::Factory
|
factory.must_be_kind_of FilterTable::Factory
|
||||||
end
|
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
|
describe 'when calling add_accessor' do
|
||||||
it 'is chainable' do
|
it 'is chainable' do
|
||||||
factory.add_accessor(:sth).must_equal factory
|
factory.add_accessor(:sth).must_equal factory
|
||||||
|
|
Loading…
Reference in a new issue