Sha256: 8510a5c31d843adb9b3e52a3d6a0f176d66fdda04ba487e8342ec7656264f766
Contents?: true
Size: 659 Bytes
Versions: 59
Compression:
Stored size: 659 Bytes
Contents
RSpec::Matchers.define :contain do |pattern| match do |resource| if resource.is_a?(String) resource.match(Regexp.new([@from, pattern, @to].compact.join.gsub('/', '.*'), Regexp::MULTILINE)) else resource.contain(pattern, @from, @to) end end # for contain(pattern).from(/A/).to(/B/) chain :from do |from| @from = Regexp.new(from).inspect end chain :to do |to| @to = Regexp.new(to).inspect end # for contain(pattern).after(/A/) chain :after do |after| @from = Regexp.new(after).inspect end # for contain(pattern).before(/B/) chain :before do |before| @to = Regexp.new(before).inspect end end
Version data entries
59 entries across 59 versions & 3 rubygems