I have a model similar to the following:
class Foo
attr_accessor :attribute_a
attr_accessor :attribute_b
def determine_attribute_b
self.attribute_b = some_biz_logic(attribute_a)
end
end
In FactoryGirl 1.3, I had a factory that looked like this:
Factory.define :foo do |foo|
foo.attribute_a = "some random value"
foo.attribute_b { |f| f.determine_attribute_b }
end
Everything went perfectly. attribute_bwas an attribute depending on the code block that would be passed to the real instance Foointo a variable f, complete with correctly set attribute_ato work.
I just upgraded to FactoryGirl 2.3.2 and this method no longer works. The variable ffrom the equivalent code to above is no longer an instance Foo, but instead of a FactoryGirl::Proxy::Create. This class, apparently, can read previously set attributes (for example, in the example of dependent attributes in documents ). However, it cannot call the actual methods from the built-in class.
FactoryGirl? , .