Skip to content

Resettable default does not appear to be true #598

@mattwd7

Description

@mattwd7

Describe the bug
I have added the split gem to my Rails project and created an experiment in a YAML file that is loaded in an initializer split.rb. After a user converts and the #ab_finished helper is called, the conversion is recorded and visible from the Split dashboard. However, future participations/conversions are not recorded for the same user as expected.

To Reproduce
Steps to reproduce the behavior:

  1. Create an experiment in your split initializer without setting resettable: true
join_button_color:
  alternatives:
    - name: 'control'
      percent: 50
    - name: 'blue'
      percent: 50
  1. Consult the experiment in a view partial to determine how to class your button
button_class = (ab_test('join_button_color') == 'blue') ?
    'btn-outline-primary' :
    'btn-outline-success'
  1. Call ab_finished at the controller action where the button links to. Afterward, the dashboard should show 1 participant and 1 completed for the alternative selected.
    ab_finished(:join_button_color)

  2. After converting the user, return to a page with the button partial. Consulting the dashboard shows that the user's experiment was not reset and the participant count is unchanged.

Additional context
After a bit of digging, I wonder if the culprit is Split::Expeirment#set_alternatives_and_options called within #initialize. In this method, self.resettable = options[:resettable] is assigning nil or "", which evaluates to false in the setter. (Or I'm just doing something wrong – help!!)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions