Module: CopDetective::ErrorMessages

Included in:
CopDetectiveValidator
Defined in:
lib/errors.rb

Class Method Summary collapse

Class Method Details

.formattingObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/errors.rb', line 16

def formatting
  <<-MESSAGE 
  The keys in the hash you pass to #set_keys must be as follows:
    password:
    confirmation:
    old_password:

  the values you pass should reflect keys in your params hash.
  a correctly configured hash would look similar to this:
  {
    password: :new_password,
    confirmation: :password_again,
    old_password: :original_password
  }
  MESSAGE
end

.invalid_passwordObject



8
9
10
# File 'lib/errors.rb', line 8

def invalid_password
  "You entered your original password incorrectly."
end

.non_matchingObject



33
34
35
# File 'lib/errors.rb', line 33

def non_matching
  "Your new passwords don't match."
end

.options_error(key) ⇒ Object



37
38
39
# File 'lib/errors.rb', line 37

def options_error(key)
  "Option passed to #{key} must be a symbol or string."
end

.unsaved_password(reason) ⇒ Object



4
5
6
# File 'lib/errors.rb', line 4

def unsaved_password(reason)
  "Your new password was not saved. #{reason}"
end

.wrong_datatypeObject



12
13
14
# File 'lib/errors.rb', line 12

def wrong_datatype
  'You must pass a hash to the set_keys method'
end