module EcomDev::ChefSpec::Helpers::StringMatcher

Public Instance Methods

matcher(expected) click to toggle source
# File lib/ecomdev/chefspec/helpers/string_matcher.rb, line 5
def matcher(expected)
  RSpec::Matchers::BuiltIn::Match.new(expected)
end
regexp(match, before ='', after = '') click to toggle source
# File lib/ecomdev/chefspec/helpers/string_matcher.rb, line 9
def regexp(match, before ='', after = '')
  unless match.is_a?(::Regexp)
    match = ::Regexp.escape(match).tr_s('\\ ', '\\s')
  else
    match = match.source
  end

  ::Regexp.new(before + match + after, Regexp::MULTILINE)
end