sniff 0.6.7 → 0.6.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/sniff.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'data_miner'
2
+
1
3
  module Sniff
2
4
  extend self
3
5
 
@@ -5,6 +7,13 @@ module Sniff
5
7
  File.join(File.dirname(__FILE__), '..')
6
8
  end
7
9
 
10
+ def logger
11
+ @logger ||= Logger.new nil
12
+ end
13
+ def logger=(val)
14
+ @logger = val
15
+ end
16
+
8
17
  # Prepares the environment for running tests against Earth data and emitter
9
18
  # gems.
10
19
  #
@@ -13,12 +22,16 @@ module Sniff
13
22
  # options:
14
23
  # * :earth is the list of domains Earth.init should load (default: none)
15
24
  # * :load_data determines whether fixture data is loaded (default: true)
16
- # * :sqllogdev is a Logger log device used by ActiveRecord (default: nil)
25
+ # * :logger is a Logger log device used by Sniff and ActiveRecord (default: nil)
26
+ # logger: nil = no log, string = file path, STDOUT for terminal
17
27
  # * :fixtures_path is the path to your gem's fixtures (default: local_root/lib/db/fixtures)
18
- # * :logdev is a Logger log device used for general logging (default: nil)
19
28
  def init(local_root, options = {})
20
29
  options[:earth] ||= :none
21
30
 
31
+ logger = options.delete(:logger) || ENV['LOGGER']
32
+ Sniff.logger = Logger.new logger
33
+ DataMiner.logger = Sniff.logger
34
+
22
35
  Sniff::Database.init local_root, options
23
36
 
24
37
  if options[:cucumber]
@@ -12,9 +12,7 @@ module Sniff
12
12
  # options:
13
13
  # * :earth is the list of domains Earth.init should load (default: none)
14
14
  # * :load_data determines whether fixture data is loaded (default: true)
15
- # * :sqllogdev is a Logger log device used by ActiveRecord (default: nil)
16
15
  # * :fixtures_path is the path to your gem's fixtures (default: local_root/lib/db/fixtures)
17
- # * :logdev is a Logger log device used for general logging (default: nil)
18
16
  def init(local_root, options = {})
19
17
  db_init options
20
18
  earth_init(options[:earth])
@@ -40,7 +38,7 @@ module Sniff
40
38
  def db_init(options)
41
39
  options[:db_adapter] ||= 'sqlite3'
42
40
  options[:db_name] ||= ':memory:'
43
- ActiveRecord::Base.logger = Logger.new options[:sqllogdev]
41
+ ActiveRecord::Base.logger = Sniff.logger
44
42
  ActiveRecord::Base.establish_connection :adapter => options[:db_adapter],
45
43
  :database => options[:db_name]
46
44
  end
@@ -65,7 +63,7 @@ module Sniff
65
63
  self.lib_path = File.join(root, 'lib', 'test_support')
66
64
  self.load_data = options[:load_data]
67
65
  self.fixtures_path = options[:fixtures_path]
68
- self.logger = Logger.new options[:logdev]
66
+ self.logger = Sniff.logger
69
67
  end
70
68
 
71
69
  def log(str)
data/lib/sniff/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Sniff
2
- VERSION = "0.6.7"
2
+ VERSION = "0.6.8"
3
3
  end
@@ -53,7 +53,7 @@ end
53
53
 
54
54
  Then /^the emission value should be within "([\d\.]+)" kgs of "([\d\.]+)"$/ do |cusion, emissions|
55
55
  @emission.should_not be_nil
56
- @emission.should be_close(emissions.to_f, cusion.to_f)
56
+ @emission.should be_within(cusion.to_f).of(emissions.to_f)
57
57
  end
58
58
 
59
59
  Then /^the calculation should have used committees "(.*)"$/ do |committee_list|
@@ -64,7 +64,7 @@ Then /^the calculation should have used committees "(.*)"$/ do |committee_list|
64
64
  end
65
65
 
66
66
  Then /^the (.+) committee should be close to "([^,]+)", \+\/-"(.+)"$/ do |committee, value, cusion|
67
- @characteristics[committee.to_sym].to_f.should be_close(value.to_f, cusion.to_f)
67
+ @characteristics[committee.to_sym].to_f.should be_within(cusion.to_f).of(value.to_f)
68
68
  end
69
69
 
70
70
  Then /^the (.+) committee should be exactly "(.*)"$/ do |committee, value|
@@ -41,7 +41,7 @@ module CucumberValueParser
41
41
  a.should == b
42
42
  elsif b =~ /\d+\.\d+/
43
43
  b = b.to_f
44
- a.to_f.should be_close(b, 0.00001)
44
+ a.to_f.should be_within(0.00001).of(b)
45
45
  elsif b =~ /^0/
46
46
  a.to_s.should == b
47
47
  elsif b =~ /^\d+$/
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 6
8
- - 7
9
- version: 0.6.7
8
+ - 8
9
+ version: 0.6.8
10
10
  platform: ruby
11
11
  authors:
12
12
  - Derek Kastner
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-05-16 00:00:00 -04:00
17
+ date: 2011-05-19 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -290,7 +290,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
290
290
  requirements:
291
291
  - - ">="
292
292
  - !ruby/object:Gem::Version
293
- hash: 4292578396046065138
293
+ hash: -3586275988234089794
294
294
  segments:
295
295
  - 0
296
296
  version: "0"