Class: RSpec::Core::SharedExampleGroupModule
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/shared_example_group.rb
Overview
Represents some functionality that is shared with multiple example groups. The functionality is defined by the provided block, which is lazily eval’d when the ‘SharedExampleGroupModule` instance is included in an example group.
Constant Summary
Constants inherited from Module
Module::DELEGATION_RESERVED_KEYWORDS, Module::DELEGATION_RESERVED_METHOD_NAMES, Module::RUBY_RESERVED_KEYWORDS
Instance Attribute Summary collapse
- #definition ⇒ Object readonly
Instance Method Summary collapse
- #include_in(klass, inclusion_line, args, customization_block) ⇒ Object
-
#included(klass) ⇒ Object
Ruby callback for when a module is included in another module is class.
-
#initialize(description, definition, metadata) ⇒ SharedExampleGroupModule
constructor
A new instance of SharedExampleGroupModule.
-
#inspect ⇒ Object
(also: #to_s)
Provides a human-readable representation of this module.
Methods inherited from Module
#alias_attribute, #anonymous?, #append_features, #as_json, #attr_internal_accessor, #attr_internal_reader, #attr_internal_writer, #blankslate_original_append_features, #delegate, #delegate_missing_to, #deprecate, #infect_an_assertion, #mattr_accessor, #mattr_reader, #mattr_writer, #method_visibility, #module_parent, #module_parent_name, #module_parents, #rake_extension, #redefine_method, #redefine_singleton_method, #remove_possible_method, #remove_possible_singleton_method, #silence_redefinition_of_method, #thread_mattr_accessor, #thread_mattr_reader, #thread_mattr_writer
Methods included from Module::Concerning
Constructor Details
#initialize(description, definition, metadata) ⇒ SharedExampleGroupModule
Returns a new instance of SharedExampleGroupModule.
13 14 15 16 17 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/shared_example_group.rb', line 13 def initialize(description, definition, ) @description = description @definition = definition @metadata = end |
Instance Attribute Details
#definition ⇒ Object (readonly)
11 12 13 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/shared_example_group.rb', line 11 def definition @definition end |
Instance Method Details
#include_in(klass, inclusion_line, args, customization_block) ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/shared_example_group.rb', line 34 def include_in(klass, inclusion_line, args, customization_block) klass.(@metadata) unless @metadata.empty? SharedExampleGroupInclusionStackFrame.with_frame(@description, inclusion_line) do RSpec::Support::WithKeywordsWhenNeeded.class_exec(klass, *args, &@definition) klass.class_exec(&customization_block) if customization_block end end |
#included(klass) ⇒ Object
Ruby callback for when a module is included in another module is class. Our definition evaluates the shared group block in the context of the including example group.
28 29 30 31 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/shared_example_group.rb', line 28 def included(klass) inclusion_line = klass.[:location] include_in klass, inclusion_line, [], nil end |
#inspect ⇒ Object Also known as: to_s
Provides a human-readable representation of this module.
20 21 22 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/shared_example_group.rb', line 20 def inspect "#<#{self.class.name} #{@description.inspect}>" end |