Class: Uberspec::Notify::Base
- Inherits:
-
Object
- Object
- Uberspec::Notify::Base
- Defined in:
- lib/uberspec/notify.rb
Instance Attribute Summary collapse
-
#failure_image ⇒ Object
readonly
Returns the value of attribute failure_image.
-
#passing_image ⇒ Object
readonly
Returns the value of attribute passing_image.
-
#stats ⇒ Object
readonly
Returns the value of attribute stats.
Instance Method Summary collapse
- #body ⇒ Object
- #command ⇒ Object
- #image ⇒ Object
-
#initialize(pass_img, fail_img) ⇒ Base
constructor
A new instance of Base.
- #notify(stats = {}) ⇒ Object
- #title ⇒ Object
Constructor Details
#initialize(pass_img, fail_img) ⇒ Base
Returns a new instance of Base.
8 9 10 11 |
# File 'lib/uberspec/notify.rb', line 8 def initialize(pass_img,fail_img) @passing_image = pass_img @failure_image = fail_img end |
Instance Attribute Details
#failure_image ⇒ Object (readonly)
Returns the value of attribute failure_image.
5 6 7 |
# File 'lib/uberspec/notify.rb', line 5 def failure_image @failure_image end |
#passing_image ⇒ Object (readonly)
Returns the value of attribute passing_image.
6 7 8 |
# File 'lib/uberspec/notify.rb', line 6 def passing_image @passing_image end |
#stats ⇒ Object (readonly)
Returns the value of attribute stats.
4 5 6 |
# File 'lib/uberspec/notify.rb', line 4 def stats @stats end |
Instance Method Details
#body ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/uberspec/notify.rb', line 22 def body %Q{ #{stats[:examples]} Examples #{stats[:failed]} Failed #{stats[:pending]} Pending Tests took #{stats[:time]} seconds } end |
#command ⇒ Object
32 33 34 |
# File 'lib/uberspec/notify.rb', line 32 def command raise "'command' Must be defined by notification library" end |
#image ⇒ Object
36 37 38 |
# File 'lib/uberspec/notify.rb', line 36 def image failed ? failure_image : passing_image end |
#notify(stats = {}) ⇒ Object
13 14 15 16 |
# File 'lib/uberspec/notify.rb', line 13 def notify(stats = {}) @stats = stats system("#{command} #{title} #{body} #{image}") end |
#title ⇒ Object
18 19 20 |
# File 'lib/uberspec/notify.rb', line 18 def title failed ? "Tests Failed!" : "Tests Passed!" end |