Skip to content

#stub to return self

Created by: zdennis

It would be nice if this would work:

  let(:city) { Factory.build(:city) }
  let(:product){ Factory.build(:product).stub(:city => city) }

The use-case for this came up when we wanted to rely on FactoryGirl to provide the basic attributes of an object, but when we wanted to stub a particular method that was not a simple attribute.

If #stub returned self this should work (haven't check this).

Thoughts?

Merge request reports