Class: Gitlab::Experiment::TrackedExperiments
- Inherits:
-
Object
- Object
- Gitlab::Experiment::TrackedExperiments
- Defined in:
- lib/gitlab/experiment/rspec.rb
Overview
Records experiment tracking calls captured via Configuration.tracking_behavior, so the ‘have_tracked_experiment` matcher can assert on the ordered sequence of emitted events. Only GLEX-native data is captured (the action plus the experiment’s signature), so it works for any consumer regardless of how the host application wires up tracking.
Instance Attribute Summary collapse
-
#events ⇒ Object
readonly
Returns the value of attribute events.
Instance Method Summary collapse
-
#initialize(max_segmentations = 1) ⇒ TrackedExperiments
constructor
A new instance of TrackedExperiments.
- #record(action, signature) ⇒ Object
Constructor Details
#initialize(max_segmentations = 1) ⇒ TrackedExperiments
Returns a new instance of TrackedExperiments.
134 135 136 137 |
# File 'lib/gitlab/experiment/rspec.rb', line 134 def initialize(max_segmentations = 1) @events = [] @max_segmentations = max_segmentations end |
Instance Attribute Details
#events ⇒ Object (readonly)
Returns the value of attribute events.
132 133 134 |
# File 'lib/gitlab/experiment/rspec.rb', line 132 def events @events end |
Instance Method Details
#record(action, signature) ⇒ Object
139 140 141 142 143 |
# File 'lib/gitlab/experiment/rspec.rb', line 139 def record(action, signature) event = { action: }.merge(signature) verify_single_assignment(event) @events << event end |