Merge pull request #775 from chef/dr/filter-resoruce

add resource to filter table blocks
This commit is contained in:
Dominik Richter 2016-05-30 23:39:50 +02:00
commit 818f0368f9
2 changed files with 8 additions and 1 deletions

View file

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

View file

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