Module: Ghaki::CannedInput::RaisesOnData

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

Instance Method Summary collapse

Instance Method Details

#it_should_raise_on_data(cfg_data, cfg_name, err, msg, &block) ⇒ Object



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

def it_should_raise_on_data cfg_data, cfg_name, err, msg, &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_raise_on_data_array data, err, msg, &block
  when Hash then
    _should_raise_on_data_hash  data, err, msg, &block
  else
    raise ArgumentError, 'Invalid Acceptance Test Data For: ' + name
  end
end