1

I am trying to streamline our cukes trying to leverage the wonderful factories built into our system for unit tests.

I am setting up a @bread ||= FactoryGirl.create(:bread) in a background step.

Throughout that feature, I want to add a trait which would be called @bread ||= FactoryGirl.create(:bread, :organic) if the background step did not exist.

Since @bread already exists, is there a way for me to 'update' it with the trait?

Daniel Widdis
  • 8,424
  • 13
  • 41
  • 63
Vinchbr
  • 49
  • 4

1 Answers1

1

Try something like this (I haven't tested this)

@bread.update(FactoryGirl.attributes_for(:bread, :organic)
r3b00t
  • 6,953
  • 6
  • 27
  • 37