Skip to content

lark: Add custom `:create` strategy for FactoryBot for Valkyrie

tamsin woo requested to merge lark-create-strategy into master

Local Checklist

  • Read our Contributing guide (for newcomers)
  • Tests written and passing locally?
  • Code style checked?
  • QA-ed locally?
  • Rebased with master branch?
  • Configuration updated (if needed)?
  • Documentation updated (if needed)?

What does this Merge Request do?

Because valkyrie doesn't use an on-object #save method, the default FactoryBot create strategy doesn't work for it. A custom strategy that uses the app-wide index adapter is added here to work around this.

We register this as :create to give transparent use with the existing FactoryBot.create(object) syntax.

Committed with @lsitu.

Why are we doing this? Any context of related work or Epic?

Ran into this while working on #71 (closed) with @lsitu

Where should a reviewer start?

See: https://github.com/thoughtbot/factory_bot/blob/master/GETTING_STARTED.md#custom-strategies and ValkyrieCreate in spec/support/build_strategies

Merge request reports