Module: Sniff
- Extended by:
- Sniff
- Included in:
- Sniff
- Defined in:
- lib/sniff.rb,
lib/sniff/fixture.rb,
lib/sniff/version.rb,
lib/sniff/database.rb,
lib/sniff/rake_tasks.rb
Defined Under Namespace
Modules: Fixture Classes: Database, RakeTasks
Constant Summary collapse
- VERSION =
"0.11.12"
Instance Method Summary collapse
-
#init(local_root, options = {}) ⇒ Object
Prepares the environment for running tests against Earth data and emitter gems.
- #logger ⇒ Object
- #logger=(val) ⇒ Object
-
#path(*rest) ⇒ Object
Get a path relative to sniff’s root.
-
#root ⇒ Object
Sniff’s root directory (the gem’s location on the filesystem).
Instance Method Details
#init(local_root, options = {}) ⇒ Object
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)
37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/sniff.rb', line 37 def init(local_root, = {}) [:earth] ||= :none logger = .delete(:logger) || ENV['LOGGER'] Sniff.logger = Logger.new logger DataMiner.logger = Sniff.logger Sniff::Database.init local_root, if [:cucumber] cukes = Dir.glob File.join(File.dirname(__FILE__), 'test_support', 'cucumber', '**', '*.rb') cukes.each { |support_file| require support_file } end end |
#logger ⇒ Object
19 20 21 |
# File 'lib/sniff.rb', line 19 def logger @logger ||= Logger.new nil end |
#logger=(val) ⇒ Object
22 23 24 |
# File 'lib/sniff.rb', line 22 def logger=(val) @logger = val end |
#path(*rest) ⇒ Object
Get a path relative to sniff’s root
15 16 17 |
# File 'lib/sniff.rb', line 15 def path(*rest) File.join(root, *rest) end |
#root ⇒ Object
Sniff’s root directory (the gem’s location on the filesystem)
10 11 12 |
# File 'lib/sniff.rb', line 10 def root File.join(File.dirname(__FILE__), '..') end |