module RSpec::Core::MemoizedHelpers
def self.get_constant_or_yield(example_group, name)
- Api: - private
def self.get_constant_or_yield(example_group, name) if example_group.const_defined?(name) example_group.const_get(name) else yield end end
def self.get_constant_or_yield(example_group, name)
- Api: - private
def self.get_constant_or_yield(example_group, name) if example_group.const_defined?(name, (check_ancestors = false)) example_group.const_get(name, check_ancestors) else yield end end
def self.included(mod)
def self.included(mod) mod.extend(ClassMethods) # This logic defines an implicit subject mod.subject do described = described_class || self.class.description Class === described ? described.new : described end end
def self.module_for(example_group)
- Api: - private
def self.module_for(example_group) get_constant_or_yield(example_group, :LetDefinitions) do # Expose `define_method` as a public method, so we can # easily use it below. mod = Module.new { public_class_method :define_method } example_group.__send__(:include, mod) example_group.const_set(:LetDefinitions, mod) mod end end
def __memoized
- Private: -
def __memoized @__memoized ||= {} end
def should(matcher=nil, message=nil)
- See: #subject -
def should(matcher=nil, message=nil) RSpec::Expectations::PositiveExpectationHandler.handle_matcher(subject, matcher, message) end
def should_not(matcher=nil, message=nil)
- See: #subject -
def should_not(matcher=nil, message=nil) RSpec::Expectations::NegativeExpectationHandler.handle_matcher(subject, matcher, message) end
def subject
- See: #should -
Other tags:
- Note: - `subject` was contributed by Joe Ferris to support the one-liner
def subject raise NotImplementedError, 'This definition is here for documentation purposes only' ' - it is overriden anyway below when this module gets included.' end