specjour 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.dev ADDED
@@ -0,0 +1,3 @@
1
+ export RUBYLIB=`pwd`/lib
2
+ export RUBYOPT=rubygems
3
+ export PATH=`pwd`/bin:$PATH
data/History.markdown CHANGED
@@ -1,6 +1,12 @@
1
1
  History
2
2
  =======
3
3
 
4
+ 0.2.2
5
+ -----
6
+ *2010-04-22*
7
+
8
+ * [added] Backtrace for cucumber failures
9
+
4
10
  0.2.1
5
11
  -----
6
12
  *2010-04-21*
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.2.2
@@ -10,6 +10,7 @@ module Specjour::Cucumber
10
10
  @io = io
11
11
  @options = options
12
12
  @failing_scenarios = []
13
+ @step_summary = []
13
14
  end
14
15
 
15
16
  def after_features(features)
@@ -31,8 +32,36 @@ module Specjour::Cucumber
31
32
  end
32
33
  end
33
34
 
35
+ def prepare_elements(elements, status, kind)
36
+ output = ''
37
+ if elements.any?
38
+ output += format_string("\n(::) #{status} #{kind} (::)\n", status)
39
+ output += "\n"
40
+ end
41
+
42
+ elements.each_with_index do |element, i|
43
+ if status == :failed
44
+ output += print_exception(element.exception, status, 0)
45
+ else
46
+ output += format_string(element.backtrace_line, status)
47
+ output += "\n"
48
+ end
49
+ @step_summary << output unless output.blank?
50
+ end
51
+ end
52
+
53
+ def prepare_steps(type)
54
+ prepare_elements(step_mother.scenarios(type), type, 'steps')
55
+ end
56
+
57
+ def print_exception(e, status, indent)
58
+ format_string("#{e.message} (#{e.class})\n#{e.backtrace.join("\n")}".indent(indent), status)
59
+ end
60
+
34
61
  def print_summary
35
62
  prepare_failures
63
+ prepare_steps(:failed)
64
+ prepare_steps(:undefined)
36
65
 
37
66
  @io.send_message(:worker_summary=, to_hash)
38
67
  end
@@ -47,7 +76,7 @@ module Specjour::Cucumber
47
76
  hash[type][outcome] = step_mother.send(type, outcome).size
48
77
  end
49
78
  end
50
- hash.merge!(:failing_scenarios => @failing_scenarios)
79
+ hash.merge!(:failing_scenarios => @failing_scenarios, :step_summary => @step_summary)
51
80
  hash
52
81
  end
53
82
 
@@ -1,10 +1,11 @@
1
1
  module Specjour
2
2
  module Cucumber
3
3
  class Summarizer
4
- attr_reader :duration, :failing_scenarios
4
+ attr_reader :duration, :failing_scenarios, :step_summary
5
5
  def initialize
6
6
  @duration = 0.0
7
7
  @failing_scenarios = []
8
+ @step_summary = []
8
9
  @scenarios = Hash.new(0)
9
10
  @steps = Hash.new(0)
10
11
  end
@@ -18,6 +19,8 @@ module Specjour
18
19
  stats.each do |category, hash|
19
20
  if category == :failing_scenarios
20
21
  @failing_scenarios += hash
22
+ elsif category == :step_summary
23
+ @step_summary += hash
21
24
  elsif category == :duration
22
25
  @duration = hash.to_f if duration < hash.to_f
23
26
  else
@@ -54,8 +57,9 @@ module Specjour
54
57
 
55
58
  def summarize
56
59
  if @summarizer.failing_scenarios.any?
57
- puts
58
- puts
60
+ puts "\n\n"
61
+ @summarizer.step_summary.each {|f| puts f }
62
+ puts "\n\n"
59
63
  puts format_string("Failing Scenarios:", :failed)
60
64
  @summarizer.failing_scenarios.each {|f| puts f }
61
65
  end
data/lib/specjour.rb CHANGED
@@ -23,7 +23,7 @@ module Specjour
23
23
  autoload :Cucumber, 'specjour/cucumber'
24
24
  autoload :Rspec, 'specjour/rspec'
25
25
 
26
- VERSION = "0.2.1".freeze
26
+ VERSION = "0.2.2".freeze
27
27
 
28
28
  class Error < StandardError; end
29
29
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 1
9
- version: 0.2.1
8
+ - 2
9
+ version: 0.2.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Sandro Turriate
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-21 00:00:00 -04:00
17
+ date: 2010-04-22 00:00:00 -04:00
18
18
  default_executable: specjour
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -80,6 +80,7 @@ extensions: []
80
80
  extra_rdoc_files:
81
81
  - README.markdown
82
82
  files:
83
+ - .dev
83
84
  - .document
84
85
  - .gitignore
85
86
  - History.markdown