This fixes weird issues where methods invoked within sequences
(like `sprintf`) fail because these methods are being evaluated within
the context of the DefinitionProxy. With this change, invoking `#next`
on a sequence happens from the evaluator so if the scope is provided (it
usually will be), it'll run in the proper context. This means a couple
of oddities are fixed:
1. Developers can now refer to methods on the object instance, just like
in dynamic attributes:
class User
def company
# company lookup
end
end
FactoryGirl.define do
factory :user do
sequence(:job_title) {|n| "{title} #{n} at #{company.name}" }
end
end
2. Invoke methods typically available because the method is available on
Object (e.g. Kernel methods):
FactoryGirl.define do
factory :user do
sequence(:last_4_ssn) {|n| sprintf '%04d', n }
end
end
[#466]