Factory.create first initializes the the class then assigns each attribute individually. For example...
Suppose you have this:
class Foo < ActiveRecord::Base
end
Factory.define :foo do |f|
f.bar 'baz'
end
If you then ran:
Factory.create(:foo)
It would be the equivalent of running:
f = Foo.new
f.bar = 'baz'
f
Since your initialize method requires and argument, it's breaking on:
f = Foo.new
You could solve it by changing your initialize method to have a default value for args:
class Foo
def initialize(args={})
self.use_args = args[:used]
end
end
In theory, at least. I don't know what your code is like, so that may not work.
By the way, working this way a good thing for factory girl, as it gets around attr_accessible and attr_protected in ActiveRecord. Otherwise you could never assign protected attributes using factory girl, which would suck.
Nate