Sha256: cdd7b28823a51b956699caa43af4375fe16623f30e85fae609344d164273d057

Contents?: true

Size: 992 Bytes

Versions: 1

Compression:

Stored size: 992 Bytes

Contents

Bundler.require

module Mockumentary
  def self.introspect dir = "#{Rails.root}/app/models", namespace = ''
     Dir.chdir(dir) do 
      Dir['*.rb'].each do |file|
        require "#{dir}/#{file}"
        ar_class = (namespace + file.gsub(/\.rb$/, '').classify).constantize
        Mockery.generate(ar_class)
      end

      Dir['*'].each do |file|
        path = "#{dir}/#{file}"
        if File.directory?(path)
          namespace << "::" unless namespace.empty?
          namespace << "#{file.classify}::"
          introspect(path, namespace)
        end
      end
    end 
  end

  def self.dump dir = "#{Rails.root}/config"
    Mockery.dump
  end

  def self.load(dir=nil)
    Mocksimile.load(dir)
  end

  def self.load_and_release(dir=nil)
    load(dir)
    Mocksimile.release
  end
end

require 'mockumentary/data'
require 'mockumentary/collection'
require 'mockumentary/model'
require 'mockumentary/mockery'
require 'mockumentary/active_record'
require 'mockumentary/mocksimile'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mockumentary-0.2.0 lib/mockumentary.rb