Class: SuccessUnicorn::MessageGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/success_unicorn.rb

Class Method Summary collapse

Class Method Details

.generate(examples) ⇒ Object



5
6
7
8
9
10
# File 'lib/success_unicorn.rb', line 5

def generate(examples)
  unless examples.all? {|example| example.respond_to?(:exception)}
    return error("One or more passed in objects does not respond to exception.")
  end
  examples.none?(&:exception) ? success : failure
end

.generate_for_exit_status(exit_object) ⇒ Object



12
13
14
15
16
17
# File 'lib/success_unicorn.rb', line 12

def generate_for_exit_status(exit_object)
  unless exit_object.respond_to?(:exitstatus)
    return error("The passed in object does not respond to exitstatus.")
  end
  exit_object.exitstatus == 0 ? success : failure
end