Class: DataMiner::Step::Test

Inherits:
DataMiner::Step show all
Includes:
RSpec::Expectations, RSpec::Matchers
Defined in:
lib/data_miner/step/test.rb

Overview

A step that runs tests and stops the data miner on failures.

Create these by calling test inside a data_miner block.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from DataMiner::Step

#pos, #register

Instance Attribute Details

#afterNumeric (readonly)

After how many rows of the previous step to run the tests.

Returns:

  • (Numeric)

25
26
27
# File 'lib/data_miner/step/test.rb', line 25

def after
  @after
end

#blkProc (readonly)

The block of arbitrary code to be run.

Returns:

  • (Proc)

21
22
23
# File 'lib/data_miner/step/test.rb', line 21

def blk
  @blk
end

#descriptionString (readonly) Also known as: block_description

A description of what the block does. Doesn't exist when a single class method is specified using a Symbol.

Returns:

  • (String)

17
18
19
# File 'lib/data_miner/step/test.rb', line 17

def description
  @description
end

#everyNumeric (readonly)

Every how many rows to run tests

Returns:

  • (Numeric)

29
30
31
# File 'lib/data_miner/step/test.rb', line 29

def every
  @every
end

Instance Method Details

#notify(step, count) ⇒ Object


56
57
58
59
60
61
62
63
# File 'lib/data_miner/step/test.rb', line 56

def notify(step, count)
  if count % (after || every) == 0
    eval_catching_errors
    !after # if it's an after, return false, so that we stop getting informed
  else
    true
  end
end

#target?(step) ⇒ Boolean

Returns:

  • (Boolean)

52
53
54
# File 'lib/data_miner/step/test.rb', line 52

def target?(step)
  !inline? and (step.pos == pos - 1)
end