Sha256: aebbeee43952f7bbcacf96367cd9981094a7c11e4e22b4fb085a53702aab1a3a
Contents?: true
Size: 683 Bytes
Versions: 6
Compression:
Stored size: 683 Bytes
Contents
module RSpecHtmlMatchers module SyntaxHighlighting %i[tag_presents? text_right? count_right?].each do |method_name| define_method method_name do with_sytnax_highlighting { super() } end end def with_sytnax_highlighting doc = @document tag = @tag @document = hightlight_syntax @document @tag = hightlight_syntax @tag, :css yield ensure @document = doc @tag = tag end def hightlight_syntax text, syntax = :html text = Nokogiri::XML(text, &:noblanks).root.to_s if syntax == :html CodeRay.scan(text, syntax).term end end class HaveTag prepend SyntaxHighlighting end end
Version data entries
6 entries across 6 versions & 1 rubygems