Sha256: ce7b9aae1efcb174ca94c9b55431b8f97d90988d2c60306859a33ed46fd0a2ec

Contents?: true

Size: 1.02 KB

Versions: 14

Compression:

Stored size: 1.02 KB

Contents

module ActiveMocker

  class << self

    # Method will be deprecated in v2
    def self.mock(model_name, options=nil)
      require File.join(Config.mock_dir,
                        "#{model_name.tableize.singularize}_mock.rb")
      "#{model_name}Mock".constantize
    end

    # Override default Configurations
    #
    #  ActiveMocker.configure do |config|
    #    config.schema_file = File.join(Rails.root, 'db/schema.rb')
    #    config.model_dir   = File.join(Rails.root, 'app/models')
    #    config.mock_dir    = File.join(Rails.root, 'spec/mocks')
    #
    #    # If a model has a base class that still behaves like ActiveRecord but doesn't directly inherit from it add it
    #    # to the model_base_classes array
    #    config.model_base_classes = %w[ ActiveRecord::Base ]
    #
    #    config.logger      = Rails.logger
    #  end
    #
    def configure(&block)
      Config.set(&block)
    end

    alias_method :config, :configure

    # Generates Mocks file
    def create_mocks
      Generate.new
    end

  end

end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
active_mocker-1.8.4 lib/active_mocker/public_methods.rb
active_mocker-1.8.3 lib/active_mocker/public_methods.rb
active_mocker-1.8.2 lib/active_mocker/public_methods.rb
active_mocker-1.8.1 lib/active_mocker/public_methods.rb
active_mocker-1.8 lib/active_mocker/public_methods.rb
active_mocker-1.7.3 lib/active_mocker/public_methods.rb
active_mocker-1.7.2 lib/active_mocker/public_methods.rb
active_mocker-1.7.1 lib/active_mocker/public_methods.rb
active_mocker-1.7.1rc lib/active_mocker/public_methods.rb
active_mocker-1.7 lib/active_mocker/public_methods.rb
active_mocker-1.7rc2 lib/active_mocker/public_methods.rb
active_mocker-1.7.beta3 lib/active_mocker/public_methods.rb
active_mocker-1.7.beta2 lib/active_mocker/public_methods.rb
active_mocker-1.7.beta1 lib/active_mocker/public_methods.rb