Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

remove verification steps; they will be handled by a separate gem and…

… not live inside data_miner blocks. if you need inline verification, use process steps.
  • Loading branch information...
commit c288154e07a78064e53ee3f47ad545cc3af6e5df 1 parent 5e467a9
@seamusabshere authored
View
1  lib/data_miner.rb
@@ -25,7 +25,6 @@ class Skip < StandardError; end
autoload :Tap, 'data_miner/tap'
autoload :Process, 'data_miner/process'
autoload :Run, 'data_miner/run'
- autoload :Verify, 'data_miner/verify'
class << self
delegate :logger, :to => :instance
View
5 lib/data_miner/config.rb
@@ -42,11 +42,6 @@ def import(*args, &blk)
steps.push step
end
- def verify(description = '(no description)', &blk)
- step = Verify.new self, description, &blk
- steps.push step
- end
-
# Mine data for this class.
def run(options = {})
options = options.dup
View
28 lib/data_miner/verify.rb
@@ -1,28 +0,0 @@
-class DataMiner
- class Verify
- attr_reader :config
- attr_reader :description
- attr_reader :blk
-
- def initialize(config, description, &blk)
- @config = config
- @description = description
- @blk = blk
- end
-
- def resource
- config.resource
- end
-
- def inspect
- %{#<DataMiner::Verify(#{resource}) #{description}>}
- end
-
- def run
- unless blk.call
- raise "FAILED VERIFICATION: #{inspect}"
- end
- nil
- end
- end
-end
View
2  lib/data_miner/version.rb
@@ -1,3 +1,3 @@
class DataMiner
- VERSION = '1.2.5'
+ VERSION = '1.3.0'
end
View
4 test/support/aircraft.rb
@@ -96,10 +96,6 @@ def is_a_crj_900?(row)
key 'bts_aircraft_type_code', :field_name => 'bts_aircraft_type'
store 'brighter_planet_aircraft_class_code', :nullify => true
end
-
- verify 'all aircraft have a manufcaturer name specified' do
- assert Aircraft.scoped.where(:manufacturer_name => nil).empty?
- end
end
end
end
View
21 test/test_data_miner_verify.rb
@@ -1,21 +0,0 @@
-require File.expand_path('helper', File.dirname(__FILE__))
-
-class TestDataMinerVerify < Test::Unit::TestCase
- context '#run' do
- should 'raise an exception if the verification block fails through exception' do
- raising_check = lambda { raise "boom" }
- verify = DataMiner::Verify.new Aircraft.data_miner_config, 'verification of engine type', &raising_check
- assert_raise(::RuntimeError) { verify.run }
- end
- should 'raise an exception if the result of the verification block is false' do
- failing_check = lambda { false }
- verify = DataMiner::Verify.new Aircraft.data_miner_config, 'verification of engine type', &failing_check
- assert_raise(::RuntimeError) { verify.run }
- end
- should 'return true if the verification block succeeds' do
- passing_check = lambda { true }
- verify = DataMiner::Verify.new Aircraft.data_miner_config, 'verification of engine type', &passing_check
- assert_nil verify.run
- end
- end
-end
View
12 test/test_old_syntax.rb
@@ -900,16 +900,4 @@ class TestOldSyntax < Test::Unit::TestCase
assert ResidentialEnergyConsumptionSurveyResponse.find(6).residence_class.start_with?('Single-family detached house')
end
end
- should "mark the run as skipped if verification fails" do
- AutomobileFuelType.data_miner_config.instance_eval do
- verify "failure" do
- false
- end
- end
-
- DataMiner::Run.delete_all
- assert_raise do
- AutomobileFuelType.run_data_miner! :from_scratch => true
- end
- end
end
Please sign in to comment.
Something went wrong with that request. Please try again.