さくっとマッチャー書いた。 数行なので、プルリクしたもんかどうか迷う...。 failure messageを少し頑張った。 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 match
![serverspecでMySQLの設定を検査する抹茶ー - Qiita](https://cdn-ak-scissors.b.st-hatena.com/image/square/fbd0584b5fb9fe6ad86d636342c98aca08ca9ba6/height=288;version=1;width=512/https%3A%2F%2Fqiita-user-contents.imgix.net%2Fhttps%253A%252F%252Fcdn.qiita.com%252Fassets%252Fpublic%252Farticle-ogp-background-9f5428127621718a910c8b63951390ad.png%3Fixlib%3Drb-4.0.0%26w%3D1200%26mark64%3DaHR0cHM6Ly9xaWl0YS11c2VyLWNvbnRlbnRzLmltZ2l4Lm5ldC9-dGV4dD9peGxpYj1yYi00LjAuMCZ3PTkxNiZoPTMzNiZ0eHQ9c2VydmVyc3BlYyVFMyU4MSVBN015U1FMJUUzJTgxJUFFJUU4JUE4JUFEJUU1JUFFJTlBJUUzJTgyJTkyJUU2JUE0JTlDJUU2JTlGJUJCJUUzJTgxJTk5JUUzJTgyJThCJUU2JThBJUI5JUU4JThDJUI2JUUzJTgzJUJDJnR4dC1jb2xvcj0lMjMyMTIxMjEmdHh0LWZvbnQ9SGlyYWdpbm8lMjBTYW5zJTIwVzYmdHh0LXNpemU9NTYmdHh0LWNsaXA9ZWxsaXBzaXMmdHh0LWFsaWduPWxlZnQlMkN0b3Amcz0xYTU1YjVmNzI4M2Y2MjNiOGQ0YWFhYjBmMzI3ODcxZQ%26mark-x%3D142%26mark-y%3D112%26blend64%3DaHR0cHM6Ly9xaWl0YS11c2VyLWNvbnRlbnRzLmltZ2l4Lm5ldC9-dGV4dD9peGxpYj1yYi00LjAuMCZ3PTYxNiZ0eHQ9JTQwdWR6dXJhJnR4dC1jb2xvcj0lMjMyMTIxMjEmdHh0LWZvbnQ9SGlyYWdpbm8lMjBTYW5zJTIwVzYmdHh0LXNpemU9MzYmdHh0LWFsaWduPWxlZnQlMkN0b3Amcz0wOThjNjVkMGRjOGY3YjQ4ZjVjZmExMjI2Nzk1MGExZQ%26blend-x%3D142%26blend-y%3D491%26blend-mode%3Dnormal%26s%3D7e1767c42ca5c73eb8df52ba21d531a2)