Exception: Wrapture::InvalidSpecKey

Inherits:
WraptureError show all
Defined in:
lib/wrapture/errors.rb

Overview

The spec has a key that is not valid.

Instance Method Summary collapse

Constructor Details

#initialize(message, valid_keys: []) ⇒ InvalidSpecKey

Creates an InvalidSpecKey with the given message. A list of valid values may optionally be passed to valid_keys which will be added to the end of the message.



39
40
41
42
43
44
45
46
47
48
49
# File 'lib/wrapture/errors.rb', line 39

def initialize(message, valid_keys: [])
  complete_message = message.dup

  unless valid_keys.empty?
    complete_message << ' (valid values are \''
    complete_message << valid_keys.join('\', \'')
    complete_message << '\')'
  end

  super(complete_message)
end