Sha256: d1c5d16588676150b3a57600ecbf3ac2208c02f9cbf9a171f97356dc1821edd7
Contents?: true
Size: 690 Bytes
Versions: 6
Compression:
Stored size: 690 Bytes
Contents
module RSpec::RubyContentMatchers class InheritFrom attr_reader :klass def initialize klass @klass = klass.to_s.camelize end def matches?(content) match_res =~ /class\s+(.*?)<\s+#{klass}(.*)end/ if block_given? && match_res ruby_content = $2.strip.extend(RSpec::RubyContent::Helpers) yield ruby_content else match_res end end def failure_message "Expected the class to inherit from #{klass}" end def negative_failure_message "Did not expect the class to inherit from #{klass}" end end def inherit_from(klass) InheritFrom.new(klass) end end
Version data entries
6 entries across 6 versions & 1 rubygems