Sha256: f3368611e99311017c0ab033c2c78f4e717b8c231192b486a5eae51726dcda2e
Contents?: true
Size: 1.01 KB
Versions: 4
Compression:
Stored size: 1.01 KB
Contents
module RSpec::RubyContentMatchers class HaveSubclass < RSpec::RubyContentMatcher attr_reader :klass, :superclass, :type, :full_class def initialize(klass, superclass, type=nil) @klass = klass.to_s.camelize super @klass @superclass = superclass.to_s.camelize @type = type.to_s.camelize if type @full_class = "#{@klass}#{@type}" end def failure_message super display "Expected there to be the subclass #{full_class} of #{superclass}" end def negative_failure_message super display "Did no expected there to be the subclass #{full_class} of #{superclass}" end protected def main_expr 'class' + SPACES + "#{klass}#{type}" + OPT_SPACES + '<' + OPT_SPACES + "#{superclass}" + ANY_GROUP end def alt_end 'class' end end def have_subclass(klass, superclass, type=nil) HaveSubclass.new(klass, superclass, type) end alias_method :be_subclass, :have_subclass end
Version data entries
4 entries across 4 versions & 1 rubygems