Module: AngryPickle

Included in:
Cucumber::Formatter::Pretty
Defined in:
lib/angry-pickle.rb

Constant Summary collapse

FAILED_IMG =
"/images/failed.png"
PENDING_IMG =
"/images/pending.png"
PASSED_IMG =
"/images/passed.png"
DIR =
Gem.loaded_specs['angry-pickle'].full_gem_path

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/angry-pickle.rb', line 10

def self.included(base)
  base.class_eval do

    alias print_stats_original print_stats

    def print_stats(features, profiles = [])

      print_stats_original(features, profiles)

      failed  = step_mother.scenarios(:failed).count
      passed  = step_mother.scenarios(:passed).count
      pending = step_mother.scenarios(:pending).count
      message = %{#{passed} passed\n#{failed} failed\n#{pending} pending}

      img = failed > 0 ? FAILED_IMG : pending > 0 ? PENDING_IMG : PASSED_IMG

      system "growlnotify -t 'Cucumber Scenarios' --image '#{DIR}#{img}' -m '#{message}'"

    end

  end
end