module Fabrication::Config

Attributes

logger[W]
sequence_start[W]

Public Instance Methods

configure() { |self| ... } click to toggle source
# File lib/fabrication/config.rb, line 7
def configure
  yield self
end
fabricator_dir() click to toggle source
# File lib/fabrication/config.rb, line 32
def fabricator_dir
  Support.log_deprecation('Fabrication::Config.fabricator_dir has been ' \
                          'replaced by Fabrication::Config.fabricator_path')
  fabricator_path
end
fabricator_dir=(folders) click to toggle source
# File lib/fabrication/config.rb, line 42
def fabricator_dir=(folders)
  Support.log_deprecation('Fabrication::Config.fabricator_dir has been ' \
                          'replaced by Fabrication::Config.fabricator_path')
  self.fabricator_path = folders
end
fabricator_path() click to toggle source
# File lib/fabrication/config.rb, line 27
def fabricator_path
  @fabricator_path ||= ['test/fabricators', 'spec/fabricators']
end
Also aliased as: fabricator_paths
fabricator_path=(folders) click to toggle source
# File lib/fabrication/config.rb, line 38
def fabricator_path=(folders)
  @fabricator_path = ([] << folders).flatten
end
fabricator_paths()
Alias for: fabricator_path
generator_for(default_generators, klass) click to toggle source
# File lib/fabrication/config.rb, line 65
def generator_for(default_generators, klass)
  (generators + default_generators).detect { |gen| gen.supports?(klass) }
end
generators() click to toggle source
# File lib/fabrication/config.rb, line 61
def generators
  @generators ||= []
end
logger() click to toggle source
# File lib/fabrication/config.rb, line 21
def logger
  @logger ||= Logger.new($stdout).tap do |logger|
    logger.level = Logger::WARN
  end
end
notifiers() click to toggle source
# File lib/fabrication/config.rb, line 90
def notifiers
  @notifiers ||= []
end
path_prefix() click to toggle source
# File lib/fabrication/config.rb, line 56
def path_prefix
  @path_prefix ||= [defined?(Rails) ? Rails.root : '.']
end
Also aliased as: path_prefixes
path_prefix=(folders) click to toggle source
# File lib/fabrication/config.rb, line 52
def path_prefix=(folders)
  @path_prefix = ([] << folders).flatten
end
path_prefixes()
Alias for: path_prefix
recursion_limit() click to toggle source
# File lib/fabrication/config.rb, line 69
def recursion_limit
  @recursion_limit ||= 20
end
recursion_limit=(limit) click to toggle source
# File lib/fabrication/config.rb, line 73
def recursion_limit=(limit)
  @recursion_limit = limit
end
register_notifier(&block) click to toggle source
# File lib/fabrication/config.rb, line 94
def register_notifier(&block)
  notifiers.push(block)
end
register_with_steps=(value) click to toggle source
# File lib/fabrication/config.rb, line 77
def register_with_steps=(value)
  Support.log_deprecation(
    'Fabrication::Config.register_with_steps has been deprecated. ' \
    'Please regenerate your cucumber steps with `rails g fabrication:cucumber_steps'
  )

  return unless value

  register_notifier do |name, object|
    Fabrication::Cucumber::Fabrications[name] = object
  end
end
reset_defaults() click to toggle source
# File lib/fabrication/config.rb, line 11
def reset_defaults
  @fabricator_path =
    @path_prefix =
      @sequence_start =
        @generators =
          nil
end
sequence_start() click to toggle source
# File lib/fabrication/config.rb, line 48
def sequence_start
  @sequence_start ||= 0
end