Sha256: b6d357e955ba23443365d33dcc7d29e8fc2fe3470e53d51f7729e3a9d2d25aed

Contents?: true

Size: 1.31 KB

Versions: 7

Compression:

Stored size: 1.31 KB

Contents

require 'data_miner'

module Sniff
  extend self

  def root 
    File.join(File.dirname(__FILE__), '..')
  end

  def logger
    @logger ||= Logger.new nil
  end
  def logger=(val)
    @logger = val
  end

  # Prepares the environment for running tests against Earth data and emitter 
  # gems.
  #
  # local_root: Root directory of the emitter gem to be tested (path to the repo)
  #
  # options: 
  # * :earth is the list of domains Earth.init should load (default: none)
  # * :load_data determines whether fixture data is loaded (default: true)
  # * :logger is a Logger log device used by Sniff and ActiveRecord (default: nil)
  #           logger: nil = no log, string = file path, STDOUT for terminal
  # * :fixtures_path is the path to your gem's fixtures (default: local_root/lib/db/fixtures)
  def init(local_root, options = {})
    options[:earth] ||= :none

    logger = options.delete(:logger) || ENV['LOGGER']
    Sniff.logger = Logger.new logger
    DataMiner.logger = Sniff.logger

    Sniff::Database.init local_root, options

    if options[:cucumber]
      cukes = Dir.glob File.join(File.dirname(__FILE__), 'test_support', 'cucumber', '**', '*.rb')
      cukes.each { |support_file| require support_file }
    end
  end
end

require 'earth'

$:.unshift File.dirname(__FILE__)
require 'sniff/database'
require 'sniff/emitter'

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sniff-0.8.1 lib/sniff.rb
sniff-0.8.0 lib/sniff.rb
sniff-0.7.3 lib/sniff.rb
sniff-0.7.2 lib/sniff.rb
sniff-0.7.1 lib/sniff.rb
sniff-0.7.0 lib/sniff.rb
sniff-0.6.8 lib/sniff.rb