Sha256: 8abdd429a103070f80ba4b4dc945ef3284374447eab19c9a43b06b904931e669

Contents?: true

Size: 830 Bytes

Versions: 1

Compression:

Stored size: 830 Bytes

Contents

require 'fabricators/callbacks'
require 'fabricators/definitions'
require 'fabricators/fabricator'
require 'fabricators/generator'
require 'fabricators/reader'
require 'fabricators/proxy'
require 'fabricators/methods'
require 'fabricators/railtie'

module Fabricators
  extend Methods
  class << self

    def define(&block)
      definitions.instance_eval &block
    end

    def definitions
      @definitions ||= Definitions.new
    end
 
    def generate(name)
      definitions.find(name, :generator).generate
    end

    def paths
      @paths ||= %w(test/fabricators spec/fabricators).map { |path| Rails.root.join(path) }
    end

    def path
      @path ||= paths.find { |path| Dir.exists? path }
    end

    def populate
      Dir[path.join('**', '*.rb')].each do |file|
        load file
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fabricators-0.0.1 lib/fabricators.rb