cucumber_analytics 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +8 -8
  2. data/.simplecov +5 -1
  3. data/History.rdoc +16 -5
  4. data/README.rdoc +5 -0
  5. data/Rakefile +6 -1
  6. data/features/modeling/background_modeling.feature +5 -1
  7. data/features/modeling/directory_modeling.feature +1 -1
  8. data/features/modeling/doc_string_modeling.feature +5 -1
  9. data/features/modeling/example_modeling.feature +5 -1
  10. data/features/modeling/feature_file_modeling.feature +1 -1
  11. data/features/modeling/feature_modeling.feature +15 -10
  12. data/features/modeling/outline_modeling.feature +6 -1
  13. data/features/modeling/row_modeling.feature +5 -1
  14. data/features/modeling/scenario_modeling.feature +6 -1
  15. data/features/modeling/step_modeling.feature +6 -1
  16. data/features/modeling/table_modeling.feature +5 -1
  17. data/features/modeling/tag_modeling.feature +51 -0
  18. data/features/step_definitions/background_steps.rb +12 -0
  19. data/features/step_definitions/doc_string_steps.rb +10 -0
  20. data/features/step_definitions/feature_steps.rb +14 -5
  21. data/features/step_definitions/outline_steps.rb +31 -15
  22. data/features/step_definitions/spec_steps.rb +1 -1
  23. data/features/step_definitions/step_steps.rb +10 -0
  24. data/features/step_definitions/table_steps.rb +11 -0
  25. data/features/step_definitions/tag_steps.rb +53 -0
  26. data/features/step_definitions/test_steps.rb +20 -8
  27. data/features/step_definitions/world_steps.rb +16 -12
  28. data/lib/cucumber_analytics/background.rb +10 -0
  29. data/lib/cucumber_analytics/doc_string.rb +12 -0
  30. data/lib/cucumber_analytics/example.rb +1 -0
  31. data/lib/cucumber_analytics/feature.rb +2 -1
  32. data/lib/cucumber_analytics/feature_element.rb +2 -0
  33. data/lib/cucumber_analytics/outline.rb +1 -0
  34. data/lib/cucumber_analytics/raw.rb +20 -0
  35. data/lib/cucumber_analytics/row.rb +3 -0
  36. data/lib/cucumber_analytics/scenario.rb +1 -0
  37. data/lib/cucumber_analytics/step.rb +3 -0
  38. data/lib/cucumber_analytics/table.rb +8 -0
  39. data/lib/cucumber_analytics/tag.rb +59 -0
  40. data/lib/cucumber_analytics/taggable.rb +15 -0
  41. data/lib/cucumber_analytics/version.rb +1 -1
  42. data/lib/cucumber_analytics/world.rb +5 -0
  43. data/lib/cucumber_analytics.rb +2 -0
  44. data/spec/integration/example_integration_spec.rb +4 -1
  45. data/spec/integration/feature_integration_spec.rb +11 -8
  46. data/spec/integration/outline_integration_spec.rb +4 -1
  47. data/spec/integration/scenario_integration_spec.rb +4 -1
  48. data/spec/spec_helper.rb +1 -0
  49. data/spec/unit/background_unit_spec.rb +1 -0
  50. data/spec/unit/doc_string_unit_spec.rb +1 -0
  51. data/spec/unit/example_unit_spec.rb +1 -0
  52. data/spec/unit/feature_unit_spec.rb +12 -0
  53. data/spec/unit/outline_unit_spec.rb +1 -0
  54. data/spec/unit/raw_element_unit_specs.rb +24 -0
  55. data/spec/unit/raw_unit_spec.rb +25 -0
  56. data/spec/unit/row_unit_spec.rb +1 -0
  57. data/spec/unit/scenario_unit_spec.rb +1 -0
  58. data/spec/unit/step_unit_spec.rb +1 -0
  59. data/spec/unit/table_unit_spec.rb +1 -0
  60. data/spec/unit/tag_unit_spec.rb +39 -0
  61. data/spec/unit/taggable_unit_spec.rb +22 -7
  62. data/spec/unit/tagged_element_unit_specs.rb +22 -7
  63. data/spec/unit/world_unit_spec.rb +3 -2
  64. metadata +14 -2
@@ -54,3 +54,15 @@ When /^step "([^"]*)" of the background (?:of feature "([^"]*)" )?has the follow
54
54
 
55
55
  assert @parsed_files[file - 1].feature.background.steps[step - 1].block == block
56
56
  end
57
+
58
+
59
+ Then(/^the(?: feature "([^"]*)")? background correctly stores its underlying implementation$/) do |file|
60
+ file ||= 1
61
+
62
+ raw_element = @parsed_files[file - 1].feature.background.raw_element
63
+
64
+ expected = 'Background'
65
+ actual = raw_element['keyword']
66
+
67
+ assert(actual == expected, "Expected: #{expected}\n but was: #{actual}")
68
+ end
@@ -48,3 +48,13 @@ Then /^(?:the )?(?:feature "([^"]*)" )?(?:test(?: "([^"]*)")? )?(?:step(?: "([^"
48
48
 
49
49
  assert(actual == expected, "Expected: #{expected}\n but was: #{actual}")
50
50
  end
51
+
52
+ Then(/^(?:the )?(?:feature "([^"]*)" )?(?:test(?: "([^"]*)")? )?(?:step(?: "([^"]*)") )?doc string correctly stores its underlying implementation$/) do |file, test, step|
53
+ file ||= 1
54
+ test ||= 1
55
+ step ||= 1
56
+
57
+ raw_element = @parsed_files[file - 1].feature.tests[test - 1].steps[step - 1].block.raw_element
58
+
59
+ raw_element.has_key?('content_type').should be_true
60
+ end
@@ -17,11 +17,11 @@ Then /^the descriptive lines of feature "([^"]*)" are as follows:$/ do |file, li
17
17
  assert(actual == expected, "Expected: #{expected}\n but was: #{actual}")
18
18
  end
19
19
 
20
- Then /^feature "([^"]*)" is found to have the following tags:$/ do |file, tags|
21
- expected = tags.raw.flatten
22
- actual = @parsed_files[file - 1].feature.tags
20
+ Then /^feature "([^"]*)" is found to have the following tags:$/ do |file, expected_tags|
21
+ expected_tags = expected_tags.raw.flatten
23
22
 
24
- assert(actual == expected, "Expected: #{expected}\n but was: #{actual}")
23
+ @parsed_files[file - 1].feature.tags.should == expected_tags
24
+ @parsed_files[file - 1].feature.tag_elements.collect { |tag| tag.name }.should == expected_tags
25
25
  end
26
26
 
27
27
  Then /^feature "([^"]*)" has no descriptive lines$/ do |file|
@@ -30,6 +30,7 @@ end
30
30
 
31
31
  Then /^feature "([^"]*)" has no tags$/ do |file|
32
32
  assert @parsed_files[file - 1].feature.tags == []
33
+ assert @parsed_files[file - 1].feature.tag_elements.collect { |tag| tag.name } == []
33
34
  end
34
35
 
35
36
  When /^(?:the )?feature(?: "([^"]*)")? scenarios are as follows:$/ do |file, scenarios|
@@ -54,7 +55,7 @@ end
54
55
  When /^(?:the )?feature(?: "([^"]*)")? background is as follows:$/ do |file, background|
55
56
  file ||= 1
56
57
 
57
- @parsed_files[file - 1].feature.background.name.should == background.raw.flatten.first
58
+ @parsed_files[file - 1].feature.background.name.should == background.raw.flatten.first
58
59
  end
59
60
 
60
61
  When /^feature "([^"]*)" has no scenarios$/ do |file|
@@ -68,3 +69,11 @@ end
68
69
  When /^feature "([^"]*)" has no background/ do |file|
69
70
  assert @parsed_files[file - 1].feature.has_background? == false
70
71
  end
72
+
73
+ Then /^(?:the )?feature(?: "([^"]*)")? correctly stores its underlying implementation$/ do |file|
74
+ file ||= 1
75
+
76
+ raw_element = @parsed_files[file - 1].feature.raw_element
77
+
78
+ raw_element.has_key?('elements').should be_true
79
+ end
@@ -46,29 +46,26 @@ Then /^(?:the )?(?:feature "([^"]*)" )?test(?: "([^"]*)")? example block(?: "([^
46
46
  assert @parsed_files[file - 1].feature.tests[test - 1].examples[example - 1].description == lines
47
47
  end
48
48
 
49
- Then /^(?:the )?(?:feature "([^"]*)" )?test(?: "([^"]*)")? example block(?: "([^"]*)")? is found to have the following tags:$/ do |file, test, example, tags|
49
+ Then /^(?:the )?(?:feature "([^"]*)" )?test(?: "([^"]*)")? example block(?: "([^"]*)")? is found to have the following tags:$/ do |file, test, example, expected_tags|
50
50
  file ||= 1
51
51
  test ||= 1
52
52
  example ||= 1
53
53
 
54
+ expected_tags = expected_tags.raw.flatten
54
55
 
55
- expected = tags.raw.flatten
56
- actual = @parsed_files[file - 1].feature.tests[test - 1].examples[example - 1].tags
57
-
58
- assert(actual == expected, "Expected: #{expected}\n but was: #{actual}")
56
+ @parsed_files[file - 1].feature.tests[test - 1].examples[example - 1].tags.should == expected_tags
57
+ @parsed_files[file - 1].feature.tests[test - 1].examples[example - 1].tag_elements.collect { |tag| tag.name }.should == expected_tags
59
58
  end
60
59
 
61
- Then /^(?:the )?(?:feature "([^"]*)" )?test(?: "([^"]*)")? example block(?: "([^"]*)")? is found to have the following applied tags:$/ do |file, test, example, tags|
60
+ Then /^(?:the )?(?:feature "([^"]*)" )?test(?: "([^"]*)")? example block(?: "([^"]*)")? is found to have the following applied tags:$/ do |file, test, example, expected_tags|
62
61
  file ||= 1
63
62
  test ||= 1
64
63
  example ||= 1
65
64
 
66
- tags = tags.raw.flatten
67
-
68
- expected = tags.sort
69
- actual = @parsed_files[file - 1].feature.tests[test - 1].examples[example - 1].applied_tags.sort
65
+ expected_tags = expected_tags.raw.flatten.sort
70
66
 
71
- assert(actual == expected, "Expected: #{expected}\n but was: #{actual}")
67
+ @parsed_files[file - 1].feature.tests[test - 1].examples[example - 1].applied_tags.sort.should == expected_tags
68
+ @parsed_files[file - 1].feature.tests[test - 1].examples[example - 1].applied_tag_elements.collect { |tag| tag.name }.sort.should == expected_tags
72
69
  end
73
70
 
74
71
  Then /^(?:the )?(?:feature "([^"]*)" )?test(?: "([^"]*)")? example block(?: "([^"]*)")? has no tags$/ do |file, test, example|
@@ -76,10 +73,8 @@ Then /^(?:the )?(?:feature "([^"]*)" )?test(?: "([^"]*)")? example block(?: "([^
76
73
  test ||= 1
77
74
  example ||= 1
78
75
 
79
- expected = []
80
- actual = @parsed_files[file - 1].feature.tests[test - 1].examples[example - 1].tags
81
-
82
- assert(actual == expected, "Expected: #{expected}\n but was: #{actual}")
76
+ @parsed_files[file - 1].feature.tests[test - 1].examples[example - 1].tags.should == []
77
+ @parsed_files[file - 1].feature.tests[test - 1].examples[example - 1].tag_elements.collect { |tag| tag.name }.should == []
83
78
  end
84
79
 
85
80
  Then /^(?:the )?(?:feature "([^"]*)" )?test(?: "([^"]*)")? example block(?: "([^"]*)")? rows are as follows:$/ do |file, test, example, rows|
@@ -173,3 +168,24 @@ Then /^(?:the )?(?:feature "([^"]*)" )?test(?: "([^"]*)")? example block(?: "([^
173
168
 
174
169
  assert(actual == expected, "Expected: #{expected}\n but was: #{actual}")
175
170
  end
171
+
172
+ Then /^(?:the )?(?:feature "([^"]*)" )?test(?: "([^"]*)")? example block(?: "([^"]*)")? row(?: "([^"]*)")? correctly stores its underlying implementation$/ do |file, test, example, row|
173
+ file ||= 1
174
+ test ||= 1
175
+ example ||= 1
176
+ row ||= 1
177
+
178
+ raw_element = @parsed_files[file - 1].feature.tests[test - 1].examples[example - 1].row_elements[row - 1].raw_element
179
+
180
+ raw_element.has_key?('cells').should be_true
181
+ end
182
+
183
+ Then /^(?:the )?(?:feature "([^"]*)" )?test(?: "([^"]*)")? example block(?: "([^"]*)")? correctly stores its underlying implementation$/ do |file, test, example|
184
+ file ||= 1
185
+ test ||= 1
186
+ example ||= 1
187
+
188
+ raw_element = @parsed_files[file - 1].feature.tests[test - 1].examples[example - 1].raw_element
189
+
190
+ raw_element.has_key?('rows').should be_true
191
+ end
@@ -7,7 +7,7 @@ Given /^that there are "([^"]*)" detailing models$/ do |spec_file|
7
7
  @spec_file = spec_file
8
8
  end
9
9
 
10
- When /^the corresponding unit tests are run$/ do
10
+ When /^the corresponding specifications are run$/ do
11
11
  command = "rspec #{@spec_file}"
12
12
 
13
13
  @specs_passed = system(command)
@@ -100,3 +100,13 @@ Then /^(?:the )?(?:feature "([^"]*)" )?(?:test(?: "([^"]*)")? )?step(?: "([^"]*)
100
100
 
101
101
  actual.should == expected
102
102
  end
103
+
104
+ Then /^(?:the )?(?:feature "([^"]*)" )?test(?: "([^"]*)")? step(?: "([^"]*)")? correctly stores its underlying implementation$/ do |file, test, step|
105
+ file ||= 1
106
+ test ||= 1
107
+ step ||= 1
108
+
109
+ raw_element = @parsed_files[file - 1].feature.tests[test - 1].steps[step - 1].raw_element
110
+
111
+ raw_element.has_key?('keyword').should be_true
112
+ end
@@ -8,3 +8,14 @@ Then /^(?:the )?(?:feature "([^"]*)" )?(?:test(?: "([^"]*)")? )?(?:step(?: "([^"
8
8
 
9
9
  assert(actual == expected, "Expected: #{expected}\n but was: #{actual}")
10
10
  end
11
+
12
+ Then /^(?:the )?(?:feature "([^"]*)" )?(?:test(?: "([^"]*)")? )?(?:step(?: "([^"]*)") )?table correctly stores its underlying implementation$/ do |file, test, step|
13
+ file ||= 1
14
+ test ||= 1
15
+ step ||= 1
16
+
17
+ raw_element = @parsed_files[file - 1].feature.tests[test - 1].steps[step - 1].block.raw_element
18
+
19
+ raw_element.is_a?(Array).should be_true
20
+ raw_element.each { |row| row.has_key?('cells').should be_true }
21
+ end
@@ -0,0 +1,53 @@
1
+ Then /^the feature tag correctly stores its underlying implementation$/ do
2
+ raw_element = @parsed_files.first.feature.tag_elements.first.raw_element
3
+
4
+ raw_element.has_key?('name').should be_true
5
+ end
6
+
7
+ When(/^the test tag correctly stores its underlying implementation$/) do
8
+ raw_element = @parsed_files.first.feature.tests.first.tag_elements.first.raw_element
9
+
10
+ raw_element.has_key?('name').should be_true
11
+ end
12
+
13
+ When(/^the example tag correctly stores its underlying implementation$/) do
14
+ raw_element = @parsed_files.first.feature.tests.first.examples.first.tag_elements.first.raw_element
15
+
16
+ raw_element.has_key?('name').should be_true
17
+ end
18
+
19
+ Then(/^the feature tag name is "([^"]*)"$/) do |tag_name|
20
+ tag = @parsed_files.first.feature.tag_elements.first
21
+
22
+ tag.name.should == tag_name
23
+ end
24
+
25
+ When(/^the test tag name is "([^"]*)"$/) do |tag_name|
26
+ tag = @parsed_files.first.feature.tests.first.tag_elements.first
27
+
28
+ tag.name.should == tag_name
29
+ end
30
+
31
+ When(/^the example tag name is "([^"]*)"$/) do |tag_name|
32
+ tag = @parsed_files.first.feature.tests.first.examples.first.tag_elements.first
33
+
34
+ tag.name.should == tag_name
35
+ end
36
+
37
+ Then(/^the feature tag source line "([^"]*)"$/) do |line|
38
+ tag = @parsed_files.first.feature.tag_elements.first
39
+
40
+ tag.source_line.should == line
41
+ end
42
+
43
+ When(/^the test tag source line "([^"]*)"$/) do |line|
44
+ tag = @parsed_files.first.feature.tests.first.tag_elements.first
45
+
46
+ tag.source_line.should == line
47
+ end
48
+
49
+ When(/^the example tag source line "([^"]*)"$/) do |line|
50
+ tag = @parsed_files.first.feature.tests.first.examples.first.tag_elements.first
51
+
52
+ tag.source_line.should == line
53
+ end
@@ -38,24 +38,24 @@ Then /^(?:the )?(?:feature "([^"]*)" )?test(?: "([^"]*)")? steps are as follows:
38
38
  assert actual_steps.flatten == steps
39
39
  end
40
40
 
41
- Then /^(?:the )?(?:feature "([^"]*)" )?test(?: "([^"]*)")? is found to have the following tags:$/ do |file, test, tags|
41
+ Then /^(?:the )?(?:feature "([^"]*)" )?test(?: "([^"]*)")? is found to have the following tags:$/ do |file, test, expected_tags|
42
42
  file ||= 1
43
43
  test ||= 1
44
44
 
45
- expected = tags.raw.flatten
46
- actual = @parsed_files[file - 1].feature.tests[test - 1].tags
45
+ expected_tags = expected_tags.raw.flatten
47
46
 
48
- assert(actual == expected, "Expected: #{expected}\n but was: #{actual}")
47
+ @parsed_files[file - 1].feature.tests[test - 1].tags.should == expected_tags
48
+ @parsed_files[file - 1].feature.tests[test - 1].tag_elements.collect { |tag| tag.name }.should == expected_tags
49
49
  end
50
50
 
51
- Then /^(?:the )?(?:feature "([^"]*)" )?test(?: "([^"]*)")? is found to have the following applied tags:$/ do |file, test, tags|
51
+ Then /^(?:the )?(?:feature "([^"]*)" )?test(?: "([^"]*)")? is found to have the following applied tags:$/ do |file, test, expected_tags|
52
52
  file ||= 1
53
53
  test ||= 1
54
54
 
55
- expected = tags.raw.flatten
56
- actual = @parsed_files[file - 1].feature.tests[test - 1].applied_tags
55
+ expected_tags = expected_tags.raw.flatten
57
56
 
58
- assert(actual == expected, "Expected: #{expected}\n but was: #{actual}")
57
+ @parsed_files[file - 1].feature.tests[test - 1].applied_tags.should == expected_tags
58
+ @parsed_files[file - 1].feature.tests[test - 1].applied_tag_elements.collect { |tag| tag.name }.should == expected_tags
59
59
  end
60
60
 
61
61
  Then /^(?:the )?(?:feature "([^"]*)" )?test(?: "([^"]*)")? step "([^"]*)" has the following block:$/ do |file, test, step, block|
@@ -89,3 +89,15 @@ Then /^(?:the )?(?:feature "([^"]*)" )?test(?: "([^"]*)")? is not equal to test
89
89
 
90
90
  assert @parsed_files[file - 1].feature.tests[first_test - 1] != @parsed_files[file - 1].feature.tests[second_test - 1]
91
91
  end
92
+
93
+ Then /^(?:the )?(?:feature "([^"]*)" )?test(?: "([^"]*)")? correctly stores its underlying implementation$/ do |file, test|
94
+ file ||= 1
95
+ test ||= 1
96
+
97
+ raw_element = @parsed_files[file - 1].feature.tests[test - 1].raw_element
98
+
99
+ expected = ['Scenario', 'Scenario Outline']
100
+ actual = raw_element['keyword']
101
+
102
+ expected.include?(actual).should be_true
103
+ end
@@ -1,28 +1,32 @@
1
- Then /^the tags collected from (?:feature "([^"]*)" )?test "([^"]*)" are as follows:$/ do |file, test, tags|
1
+ Then /^the tags collected from (?:feature "([^"]*)" )?test "([^"]*)" are as follows:$/ do |file, test, expected_tags|
2
2
  file ||= 1
3
- tags = tags.raw.flatten
3
+ expected_tags = expected_tags.raw.flatten
4
4
 
5
- assert CucumberAnalytics::World.tags_in(@parsed_files[file - 1].feature.tests[test - 1]).sort == tags.sort
5
+ CucumberAnalytics::World.tags_in(@parsed_files[file - 1].feature.tests[test - 1]).sort.should == expected_tags.sort
6
+ CucumberAnalytics::World.tag_elements_in(@parsed_files[file - 1].feature.tests[test - 1]).collect { |tag| tag.name }.sort.should == expected_tags.sort
6
7
  end
7
8
 
8
- Then /^the tags collected from feature "([^"]*)" are as follows:$/ do |file, tags|
9
+ Then /^the tags collected from feature "([^"]*)" are as follows:$/ do |file, expected_tags|
9
10
  file ||= 1
10
- tags = tags.raw.flatten
11
+ expected_tags = expected_tags.raw.flatten
11
12
 
12
- assert CucumberAnalytics::World.tags_in(@parsed_files[file - 1].feature).sort == tags.sort
13
+ CucumberAnalytics::World.tags_in(@parsed_files[file - 1].feature).sort == expected_tags.sort.should
14
+ CucumberAnalytics::World.tag_elements_in(@parsed_files[file - 1].feature).collect { |tag| tag.name }.sort.should == expected_tags.sort
13
15
  end
14
16
 
15
- Then /^the tags collected from file "([^"]*)" are as follows:$/ do |file, tags|
17
+ Then /^the tags collected from file "([^"]*)" are as follows:$/ do |file, expected_tags|
16
18
  file ||= 1
17
- tags = tags.raw.flatten
19
+ expected_tags = expected_tags.raw.flatten
18
20
 
19
- assert CucumberAnalytics::World.tags_in(@parsed_files[file - 1]).sort == tags.sort
21
+ CucumberAnalytics::World.tags_in(@parsed_files[file - 1]).sort.should == expected_tags.sort
22
+ CucumberAnalytics::World.tag_elements_in(@parsed_files[file - 1]).collect { |tag| tag.name }.sort.should == expected_tags.sort
20
23
  end
21
24
 
22
- Then /^the tags collected from directory are as follows:$/ do |tags|
23
- tags = tags.raw.flatten
25
+ Then /^the tags collected from directory are as follows:$/ do |expected_tags|
26
+ expected_tags = expected_tags.raw.flatten
24
27
 
25
- assert CucumberAnalytics::World.tags_in(@parsed_directories.last).sort == tags.sort
28
+ CucumberAnalytics::World.tags_in(@parsed_directories.last).sort.should == expected_tags.sort
29
+ CucumberAnalytics::World.tag_elements_in(@parsed_directories.last).collect { |tag| tag.name }.sort.should == expected_tags.sort
26
30
  end
27
31
 
28
32
  Then /^the(?: "([^"]*)")? steps collected from feature "([^"]*)" background are as follows:$/ do |defined, file, steps|
@@ -10,6 +10,16 @@ module CucumberAnalytics
10
10
  parsed_background = process_source(source)
11
11
 
12
12
  super(parsed_background)
13
+
14
+ build_background(parsed_background) if parsed_background
15
+ end
16
+
17
+
18
+ private
19
+
20
+
21
+ def build_background(parsed_background)
22
+ # Just a stub in case something specific needs to be done
13
23
  end
14
24
 
15
25
  end
@@ -4,6 +4,9 @@ module CucumberAnalytics
4
4
 
5
5
  class DocString
6
6
 
7
+ include Raw
8
+
9
+
7
10
  # The parent object that contains *self*
8
11
  attr_accessor :parent_element
9
12
 
@@ -47,7 +50,16 @@ module CucumberAnalytics
47
50
  end
48
51
 
49
52
  def build_doc_string(doc_string)
53
+ populate_content_type(doc_string)
54
+ populate_contents(doc_string)
55
+ populate_raw_element(doc_string)
56
+ end
57
+
58
+ def populate_content_type(doc_string)
50
59
  @content_type = doc_string['content_type'] == "" ? nil : doc_string['content_type']
60
+ end
61
+
62
+ def populate_contents(doc_string)
51
63
  @contents = doc_string['value'].split($/)
52
64
  end
53
65
 
@@ -29,6 +29,7 @@ module CucumberAnalytics
29
29
  super(parsed_example)
30
30
 
31
31
  @tags = []
32
+ @tag_elements = []
32
33
  @rows = []
33
34
  @parameters = []
34
35
  @row_elements = []
@@ -23,6 +23,7 @@ module CucumberAnalytics
23
23
  super(parsed_feature)
24
24
 
25
25
  @tags = []
26
+ @tag_elements = []
26
27
  @tests = []
27
28
 
28
29
  build_feature(parsed_feature) if parsed_feature
@@ -70,7 +71,7 @@ module CucumberAnalytics
70
71
  # Returns the immediate child elements of the feature (i.e. its Background,
71
72
  # Scenario, and Outline objects.
72
73
  def contains
73
- [@background] + @tests
74
+ @background ? [@background] + @tests : @tests
74
75
  end
75
76
 
76
77
 
@@ -5,6 +5,7 @@ module CucumberAnalytics
5
5
  class FeatureElement
6
6
 
7
7
  include Sourceable
8
+ include Raw
8
9
 
9
10
 
10
11
  # The name of the FeatureElement
@@ -34,6 +35,7 @@ module CucumberAnalytics
34
35
  populate_feature_element_name(parsed_element)
35
36
  populate_feature_element_description(parsed_element)
36
37
  populate_element_source_line(parsed_element)
38
+ populate_raw_element(parsed_element)
37
39
  end
38
40
 
39
41
  def populate_feature_element_name(parsed_element)
@@ -19,6 +19,7 @@ module CucumberAnalytics
19
19
  super(parsed_outline)
20
20
 
21
21
  @tags = []
22
+ @tag_elements = []
22
23
  @examples = []
23
24
 
24
25
  build_outline(parsed_outline) if parsed_outline
@@ -0,0 +1,20 @@
1
+ module CucumberAnalytics
2
+
3
+ # A mix-in module containing methods used by elements that store their
4
+ # underlying implementation
5
+
6
+ module Raw
7
+
8
+ # The raw representation of the element (i.e. the output of the gherkin gem)
9
+ attr_accessor :raw_element
10
+
11
+
12
+ private
13
+
14
+
15
+ def populate_raw_element(parsed_element)
16
+ @raw_element = parsed_element
17
+ end
18
+
19
+ end
20
+ end