RSpec::Matchers.define :have_mysql_entry do |entry| match do |subject| if subject.class.name == 'Serverspec::Type::File' @content = subject.content if @value !! @content.lines.find {|line| line =~ /^\s*#{entry}\s*=\s*#{@value}\s*$/ } else !! @content.lines.find {|line| line =~ /^\s*#{entry}\s?=/ } end else raise "have_mysql_entry matcher should target to file resource" end end chain :with_value do
