Sha256: e7e0cb5bc968ab08351f3a153bfe9b6882fe4fd96628b561883a07c9b3b39272
Contents?: true
Size: 666 Bytes
Versions: 11
Compression:
Stored size: 666 Bytes
Contents
module RSpec::RubyContentMatchers class HaveComment < RSpec::RubyContentMatcher attr_accessor :comment def initialize comment @comment = comment end def matches?(content) @content = content (content =~ /#{main_expr}/) end def failure_message super "Expected there to be the comment '# #{comment}'" end def negative_failure_message super "Did not expect there to be the comment '# #{comment}'" end protected def main_expr '\s*#\s*' + "#{comment}" end end def have_comment comment HaveComment.new comment end end
Version data entries
11 entries across 11 versions & 1 rubygems