Skip to content

Add a FactoryGirl-like system with traits to the scenarios

Scenarios are used to interact with the application state, through whatever interface you may implement. Scenarios may also depends on other scenarios to bootstrap the application state to a certain point (i.e. create a project, create a group, create a merge request, etc...)

I think that adding a flexible way of changing the behavior of a scenario will be needed, as you may want to create a project with a repository, or maybe you want an issue with a certain type of notes.

If scenarios depends on each other, there is a need to be able to configure the interactions of a scenario.

Right now I use the scenario object, but this will lead to very big and branched scenarios definition that my be hard to grasp.

class CreateStuff < Scenario::Template
  attr_writer :with_extra

  def perform
    create_stuff
    create_extra if @with_extra
  end
end

And calls it like

CreateStuff.perform do |stuff|
  stuff.with_extra = true
end

It seems like there might be something in line with FactoryGirl's trait system that could also work here.

/cc @rymai @grzesiek

Edited by Martin Wortschack