module RSpec::SleepingKingStudios::Deferred::Examples::ClassMethods
Class methods for deferred examples.
Attributes
@return [RSpec::SleepingKingStudios::Deferred::Examples] the deferred
example group where this example group was included, if any.
@return [Array<String, Integer>] the Ruby source filename and line
number where the deferred example group was defined.
Public Instance Methods
Source
# File lib/rspec/sleeping_king_studios/deferred/examples.rb, line 40 def deferred_examples? true end
@return [Boolean] flag indicating that the included module has deferred
examples, rather than including another deferred examples module.
Source
# File lib/rspec/sleeping_king_studios/deferred/examples.rb, line 23 def description return @description if @description return @description = '(anonymous examples)' if name.nil? @description = format_description end
@return [String] the description for the deferred examples. By default,
formats the last segment of the module name in lowercase words, excepting any trailing "Context" or "Examples".
Source
# File lib/rspec/sleeping_king_studios/deferred/examples.rb, line 32 def description=(value) tools.assertions.validate_name(value, as: 'description') @description = value.to_s.tr('_', ' ') end
@param value [String] the description for the deferred examples.
Private Instance Methods
Source
# File lib/rspec/sleeping_king_studios/deferred/examples.rb, line 46 def format_description name .split('::') .last .gsub(/(Context|Examples?)\z/, '') .then { |str| tools.string_tools.underscore(str) } .tr('_', ' ') end
Source
# File lib/rspec/sleeping_king_studios/deferred/examples.rb, line 55 def tools SleepingKingStudios::Tools::Toolbelt.instance end