class FactoryGroup::Group

Attributes

factories[R]

Public Class Methods

new() click to toggle source
# File lib/factory_group/group.rb, line 7
def initialize
  @factories = OpenStruct.new({})
end

Public Instance Methods

method_missing(name, *args, &block) click to toggle source

Sets an instance variable with the name as the called method and assigns the args passed to it.

# File lib/factory_group/group.rb, line 15
def method_missing(name, *args, &block)
  # If the args is empty, it means a variable is reused inside the group itself
  evaluvated_result = args.empty? ? @factories.instance_eval(name.to_s) : args[0]

  @factories.send("#{name.to_s}=", evaluvated_result)
end