File tree Expand file tree Collapse file tree
spec/octocatalog-diff/tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -120,5 +120,12 @@ def override(key, value)
120120 @facts [ 'values' ] [ key ] = value
121121 end
122122 end
123+
124+ # Find all facts matching a particular pattern
125+ # @param regex [Regexp] Regular expression to match
126+ # @return [Array<String>] Facts that match the regexp
127+ def matching ( regex )
128+ @facts [ 'values' ] . keys . select { |fact | regex . match ( fact ) }
129+ end
123130 end
124131end
Original file line number Diff line number Diff line change 133133 expect ( result_arr [ 3 ] . strip ) . to eq ( 'apt_update_last_success: 1458162123' )
134134 end
135135 end
136+
137+ describe '#matching' do
138+ it 'should return facts that match the regexp' do
139+ expect ( @obj . matching ( /(last|stamp)/ ) ) . to eq ( %w[ apt_update_last_success timestamp ] )
140+ end
141+ end
136142 end
137143end
You can’t perform that action at this time.
0 commit comments