Class: AppMap::RSpec::ScopeExampleGroup

Inherits:
Struct
  • Object
show all
Includes:
FeatureAnnotations
Defined in:
lib/appmap/rspec.rb

Overview

As you can see here, the way that RSpec stores the example description and represents the example group hierarchy is pretty weird.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from FeatureAnnotations

#annotations, #feature, #feature_group, #labels

Instance Attribute Details

#example_groupObject Also known as: example_obj

Returns the value of attribute example_group

Returns:

  • (Object)

    the current value of example_group



151
152
153
# File 'lib/appmap/rspec.rb', line 151

def example_group
  @example_group
end

Instance Method Details

#descriptionObject



169
170
171
# File 'lib/appmap/rspec.rb', line 169

def description
  description? ? description_args.join(' ') : nil
end

#description?Boolean

Returns:

  • (Boolean)


161
162
163
164
165
166
167
# File 'lib/appmap/rspec.rb', line 161

def description?
  return true if example_group.respond_to?(:described_class) && example_group.described_class

  return true if example_group.respond_to?(:description) && !description_args.empty?

  false
end

#description_argsObject



156
157
158
159
# File 'lib/appmap/rspec.rb', line 156

def description_args
  # Don't stringify any hashes that RSpec considers part of the example group description.
  example_group.[:description_args].reject { |arg| arg.is_a?(Hash) }
end

#parentObject



173
174
175
176
# File 'lib/appmap/rspec.rb', line 173

def parent
  # An example group always has a parent; but it might be 'self'...
  example_group.parent != example_group ? ScopeExampleGroup.new(example_group.parent) : nil
end