Class: RSpec::Core::SharedExampleGroupModule
- Inherits:
-
Module
- Object
- Module
- RSpec::Core::SharedExampleGroupModule
- Defined in:
- 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.
Instance Method Summary collapse
-
#included(klass) ⇒ void
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 ⇒ void
(also: #to_s)
Provides a human-readable representation of this module.
Constructor Details
#initialize(description, definition, metadata) ⇒ SharedExampleGroupModule
Returns a new instance of SharedExampleGroupModule.
13 14 15 16 17 |
# File 'lib/rspec/core/shared_example_group.rb', line 13 def initialize(description, definition, ) @description = description @definition = definition @metadata = end |
Instance Method Details
#included(klass) ⇒ void
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/rspec/core/shared_example_group.rb', line 28 def included(klass) inclusion_line = klass.[:location] include_in klass, inclusion_line, [], nil end |
#inspect ⇒ void Also known as: to_s
Provides a human-readable representation of this module.
20 21 22 |
# File 'lib/rspec/core/shared_example_group.rb', line 20 def inspect "#<#{self.class.name} #{@description.inspect}>" end |