notahat / machinist

Fixtures aren't fun. Machinist is.
MIT License
1.12k stars 134 forks source link

Feature request: post processing after object is initialized #94

Open sjain opened 13 years ago

sjain commented 13 years ago

I am not sure if this feature exists already.

I need ability to do some post processing on a object after all blueprint attribute initialization is done before it is returned to a test in question.

For example, I am using acl9 gem for authorization. In order to create a user with specific role, I need something like this:

User.blueprint do name { Faker::Name.first_name } end

User.blueprint(:student) do postprocess { object.has_role!(:student)

any other post processing on "object"

} end

Is this doable?

sjain commented 13 years ago

I am using machinist 1.0.6 on rails2 project with bundler BTW.