Class: RSpec::Distrib::ExampleGroup Private
- Inherits:
-
Object
- Object
- RSpec::Distrib::ExampleGroup
- Extended by:
- DelegateToMetadata
- Defined in:
- lib/rspec/distrib/example_group.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Objects that mimic an RSpec::Core::ExampleGroup on the Reporters.
This is necessary because the RSpec::Core::ExampleGroup is quite large and not Marshalable.
So we send this object to the Leader instead of the real ExampleGroup.
Instance Attribute Summary collapse
- #children ⇒ Object readonly private
- #class_name ⇒ Object readonly private
- #description ⇒ Object readonly private
- #examples ⇒ Object readonly private
- #metadata ⇒ Object readonly private
- #parent_example_group ⇒ Object readonly private
Instance Method Summary collapse
- #descendant_filtered_examples ⇒ Object private
-
#initialize(example_group, parent_example_group = nil) ⇒ ExampleGroup
constructor
private
A new instance of ExampleGroup.
- #parent_groups ⇒ Object private
- #superclass_metadata ⇒ Object private
- #top_level? ⇒ Boolean private
- #top_level_description ⇒ Object private
Methods included from DelegateToMetadata
Constructor Details
#initialize(example_group, parent_example_group = nil) ⇒ ExampleGroup
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of ExampleGroup.
30 31 32 33 34 35 36 37 |
# File 'lib/rspec/distrib/example_group.rb', line 30 def initialize(example_group, parent_example_group = nil) (example_group.) @class_name = example_group.name @parent_example_group = parent_example_group @children = example_group.children.map { |eg| ExampleGroup.new(eg, self) } @examples = example_group.filtered_examples.map { |e| ExampleResult.new(e, self) } @description = example_group.description end |
Instance Attribute Details
#children ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
24 25 26 |
# File 'lib/rspec/distrib/example_group.rb', line 24 def children @children end |
#class_name ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
24 25 26 |
# File 'lib/rspec/distrib/example_group.rb', line 24 def class_name @class_name end |
#description ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
24 25 26 |
# File 'lib/rspec/distrib/example_group.rb', line 24 def description @description end |
#examples ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
24 25 26 |
# File 'lib/rspec/distrib/example_group.rb', line 24 def examples @examples end |
#metadata ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
24 25 26 |
# File 'lib/rspec/distrib/example_group.rb', line 24 def @metadata end |
#parent_example_group ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
24 25 26 |
# File 'lib/rspec/distrib/example_group.rb', line 24 def parent_example_group @parent_example_group end |
Instance Method Details
#descendant_filtered_examples ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
43 44 45 |
# File 'lib/rspec/distrib/example_group.rb', line 43 def descendant_filtered_examples @descendant_filtered_examples ||= [examples, children.map(&:descendant_filtered_examples)].flatten end |
#parent_groups ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
55 56 57 58 59 60 61 62 63 64 |
# File 'lib/rspec/distrib/example_group.rb', line 55 def parent_groups groups = [self] current_group = self while (current_group = current_group.parent_example_group) groups << current_group end groups end |
#superclass_metadata ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
39 40 41 |
# File 'lib/rspec/distrib/example_group.rb', line 39 def parent_example_group&. end |
#top_level? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
47 48 49 |
# File 'lib/rspec/distrib/example_group.rb', line 47 def top_level? !parent_example_group end |
#top_level_description ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
51 52 53 |
# File 'lib/rspec/distrib/example_group.rb', line 51 def top_level_description parent_groups.last.description end |