Skip to content

Commit

Permalink
deprecate arrray matcher
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-rock committed May 11, 2016
1 parent 1f47097 commit f3b41cc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/matchers/matchers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,15 @@
# matcher to check /etc/passwd, /etc/shadow and /etc/group
RSpec::Matchers.define :contain_legacy_plus do
match do |file|
warn '[DEPRECATION] `contain_legacy_plus` is deprecated and will be removed for InSpec 1.0. Please use `describe file(\'/etc/passwd\') do its(\'content\') { should_not match /^\+:/ } end`'
file.content =~ /^\+:/
end
end

# verifies that no entry in an array contains a value
RSpec::Matchers.define :contain_match do |regex|
match do |arr|
warn '[DEPRECATION] `contain_match` is deprecated and will be removed for InSpec 1.0. See https://github.com/chef/inspec/issues/738 for more details'
arr.inject { |result, i|
result = i.match(regex)
result || i.match(/$/)
Expand All @@ -86,6 +88,7 @@

RSpec::Matchers.define :contain_duplicates do
match do |arr|
warn '[DEPRECATION] `contain_duplicates` is deprecated and will be removed for InSpec 1.0. See https://github.com/chef/inspec/issues/738 for more details'
dup = arr.select { |element| arr.count(element) > 1 }
!dup.uniq.empty?
end
Expand Down

0 comments on commit f3b41cc

Please sign in to comment.