cuporter 0.3.12 → 0.3.13

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -65,7 +65,7 @@ namespace :cuporter do
65
65
 
66
66
  spec = Gem::Specification.new do |s|
67
67
  s.name = 'cuporter'
68
- s.version = '0.3.12'
68
+ s.version = '0.3.13'
69
69
  s.rubyforge_project = s.name
70
70
 
71
71
  s.platform = Gem::Platform::RUBY
@@ -53,6 +53,11 @@ module Cuporter
53
53
  end
54
54
  end
55
55
 
56
+ def handle_eof
57
+ # EOF is the final way that we know we are finished with a "Scenario Outline"
58
+ close_scenario_outline
59
+ end
60
+
56
61
  def initialize(file, doc, filter)
57
62
  super(file)
58
63
  @filter = filter
@@ -1,4 +1,4 @@
1
- # Copyright 2010 ThoughtWorks, Inc. Licensed under the MIT License
1
+ # Copyright 2011 ThoughtWorks, Inc. Licensed under the MIT License
2
2
 
3
3
  module Cuporter
4
4
  module FeatureParser
@@ -24,7 +24,8 @@ module Cuporter
24
24
  begin
25
25
  handle_lines
26
26
  rescue Exception => ex
27
- Cuporter.log_error(ex, "Error parsing file", "at line #{@line_no}:", @file,
27
+ raise if ENV['CUPORTER_MODE'] =~ /^test$/i
28
+ Cuporter.log_error(ex, "Error parsing file", "at line #{@line_no}:", @file,
28
29
  %Q{\n\tIf this file can be run by Cucumber with no Gherkin lexing or parsing errors,
29
30
  please submit a bug ticket @ github including: 1) this feature file or its contents, and 2) this stack trace.
30
31
  })
@@ -71,9 +72,9 @@ module Cuporter
71
72
  new_example_line(clean_cuke_line($1))
72
73
  end
73
74
  end
74
-
75
+
75
76
  # EOF is the final way that we know we are finished with a "Scenario Outline"
76
- close_scenario_outline
77
+ handle_eof
77
78
  end
78
79
 
79
80
  def clean_cuke_line(sub_expression)
@@ -43,6 +43,22 @@ module Cuporter
43
43
  end
44
44
  end
45
45
 
46
+
47
+ def handle_eof
48
+ # EOF is the final way that we know we are finished with a "Scenario Outline"
49
+ close_scenario_outline
50
+ handle_tagless_feature if @filter.empty?
51
+ end
52
+
53
+ def handle_tagless_feature
54
+ if @feature && !@report.feature_node(@feature)
55
+ unless ( t = @report.tag_node(@report.class::TAGLESS))
56
+ t = @report.add_child(Node.new_node(:tag, @doc, 'cuke_name' => @report.class::TAGLESS))
57
+ end
58
+ t.add_child(Node.new_node(:Feature, @doc, @feature))
59
+ end
60
+ end
61
+
46
62
  def close_scenario_outline
47
63
  if @scenario_outline
48
64
  if @example_set
@@ -22,7 +22,7 @@ module Cuporter
22
22
  end
23
23
 
24
24
  def error_log_file
25
- File.open(File.join(output_home, 'cuporter_errors.log'), 'a')
25
+ File.open(File.join(output_home || '.', 'cuporter_errors.log'), 'a')
26
26
  end
27
27
 
28
28
  extend(Cuporter::Logging)
@@ -3,7 +3,16 @@ module Cuporter
3
3
  module Node
4
4
  NodeBase = Nokogiri::XML::Node
5
5
  module Types
6
+
7
+ module FeatureNodeFinder
8
+ def feature_node(feature)
9
+ at("feature[cuke_name='#{feature[:cuke_name]}'][file_path='#{feature[:file_path]}']")
10
+ end
11
+ end
12
+
6
13
  class Report < NodeBase
14
+ include FeatureNodeFinder
15
+
7
16
  def tag_node(tag)
8
17
  at("tag[cuke_name='#{tag}']")
9
18
  end
@@ -21,6 +30,13 @@ module Cuporter
21
30
  def remove_tags!
22
31
  search("*[@tags]").each {|e| e.delete('tags') }
23
32
  end
33
+
34
+ TAGLESS = "Untagged Features"
35
+
36
+ def move_tagless_node_to_bottom
37
+ tagless = at("tag[cuke_name='#{TAGLESS}']")
38
+ add_child(tagless.remove) if tagless
39
+ end
24
40
  end
25
41
 
26
42
  class FilterSummary < NodeBase
@@ -70,9 +86,7 @@ module Cuporter
70
86
  end
71
87
 
72
88
  class Tag < NodeBase
73
- def feature_node(feature)
74
- at("feature[cuke_name='#{feature[:cuke_name]}'][file_path='#{feature[:file_path]}']")
75
- end
89
+ include FeatureNodeFinder
76
90
  end
77
91
 
78
92
  class ScenarioOutline < NodeBase
@@ -26,6 +26,7 @@ module Cuporter
26
26
  report.sort_all_descendants! if sort?
27
27
  report.search(:tag).each {|f| f.number_all_descendants } if number?
28
28
  report.total if total?
29
+ report.move_tagless_node_to_bottom
29
30
  report.defoliate! if no_leaves?
30
31
  report.remove_files! unless show_files?
31
32
  report.remove_tags! unless show_tags?
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cuporter
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 12
10
- version: 0.3.12
9
+ - 13
10
+ version: 0.3.13
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tim Camper
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-07-04 00:00:00 Z
18
+ date: 2011-07-05 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: nokogiri