Module: Itest5ch::AssertMethods

Included in:
Thread
Defined in:
lib/itest5ch/assert_methods.rb

Instance Method Summary collapse

Instance Method Details

#assert_required!(name, value) ⇒ Object

Parameters:

  • name (Symbol)
  • value (Object)

Raises:

  • (ArgumentError)


17
18
19
# File 'lib/itest5ch/assert_methods.rb', line 17

def assert_required!(name, value)
  raise ArgumentError, "#{name} is required" unless value
end

#assert_required_keys!(hash, *keys) ⇒ Object

Parameters:

  • hash (Hash)
  • keys (Array<Symbol>)

Raises:

  • (ArgumentError)


7
8
9
10
11
# File 'lib/itest5ch/assert_methods.rb', line 7

def assert_required_keys!(hash, *keys)
  keys.each do |key|
    assert_required!(key, hash[key])
  end
end