Module: Ghaki::CannedInput::TransformsDataInto

Defined in:
lib/ghaki/canned_input/transforms_data_into.rb

Instance Method Summary collapse

Instance Method Details

#it_should_transform_data_into(cfg_data, cfg_name, &block) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/ghaki/canned_input/transforms_data_into.rb', line 6

def it_should_transform_data_into cfg_data, cfg_name, &block
  name = cfg_name.to_s
  data = cfg_data[name]
  case data
  when nil then
    raise ArgumentError, 'Missing Acceptance Test Data For: ' + name
  when Array then
    _should_transform_data_from_table data, &block
  when Hash then
    _should_transform_data_from_hash  data, &block
  else
    raise ArgumentError, 'Invalid Acceptance Test Data For: ' + name
  end
end