Sha256: e38224a0f0a46265b34506ad5eebfa0cce1203338b38e9bca23e594ea6d482b4
Contents?: true
Size: 1.06 KB
Versions: 4
Compression:
Stored size: 1.06 KB
Contents
module RSpec::RubyContentMatchers class HaveModule < RSpec::RubyContentMatcher attr_reader :name, :type, :postfix def initialize(name, postfix=nil) @name = name.to_s.camelize super @name @postfix = postfix.to_s.camelize if postfix @type = :module end def failure_message super display "Expected there to be the #{type} #{name}" end def negative_failure_message super display "Did not expected there to be the #{type} #{name}" end protected def main_expr "#{type}" + SPACES + "#{name}#{postfix}" + SPACES + ANY_GROUP end def alt_end type end end class HaveClass < HaveModule def initialize(name, postfix) super name, postfix @type = :class end end def have_module(module_name, postfix=nil) HaveModule.new(module_name, postfix) end alias_method :be_module, :have_module def have_class(klass, postfix = nil) HaveClass.new(klass, postfix) end alias_method :be_class, :have_class end
Version data entries
4 entries across 4 versions & 1 rubygems