Sha256: 2c265651654c220cdf9cbd2fd48758ab452660f9ad84eca01ecbe02f779cbc8c

Contents?: true

Size: 812 Bytes

Versions: 3

Compression:

Stored size: 812 Bytes

Contents

module FactoryGirl
  module Syntax
    module Default
      include Methods

      def define(&block)
        DSL.run(block)
      end

      class DSL
        def self.run(block)
          new.instance_eval(&block)
        end

        def factory(name, options = {}, &block)
          factory = Factory.new(name, options)
          proxy = FactoryGirl::DefinitionProxy.new(factory)
          proxy.instance_eval(&block)
          if parent = options.delete(:parent)
            factory.inherit_from(FactoryGirl.factory_by_name(parent))
          end
          FactoryGirl.register_factory(factory)
        end

        def sequence(name, start_value = 1, &block)
          FactoryGirl.register_sequence(Sequence.new(name, start_value, &block))
        end
      end
    end
  end

  extend Syntax::Default
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
factory_girl-2.0.0.beta3 lib/factory_girl/syntax/default.rb
factory_girl_kibiz0r-2.0.0.beta3 lib/factory_girl/syntax/default.rb
factory_girl_kibiz0r-2.0.0.beta2 lib/factory_girl/syntax/default.rb