cucumber_analytics 0.0.9 → 1.0.0

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.
Files changed (94) hide show
  1. checksums.yaml +15 -0
  2. data/History.rdoc +16 -0
  3. data/README.rdoc +5 -3
  4. data/Rakefile +7 -2
  5. data/cucumber_analytics.gemspec +7 -5
  6. data/features/analysis/step_collection.feature +44 -45
  7. data/features/modeling/background_modeling.feature +14 -144
  8. data/features/modeling/directory_modeling.feature +3 -2
  9. data/features/modeling/doc_string_modeling.feature +46 -0
  10. data/features/modeling/example_modeling.feature +13 -34
  11. data/features/modeling/feature_file_modeling.feature +3 -2
  12. data/features/modeling/feature_modeling.feature +18 -80
  13. data/features/modeling/outline_modeling.feature +25 -164
  14. data/features/modeling/scenario_modeling.feature +17 -144
  15. data/features/modeling/step_modeling.feature +68 -0
  16. data/features/modeling/table_modeling.feature +41 -0
  17. data/features/step_definitions/background_steps.rb +12 -11
  18. data/features/step_definitions/directory_steps.rb +6 -3
  19. data/features/step_definitions/doc_string_steps.rb +50 -0
  20. data/features/step_definitions/{file_steps.rb → feature_file_steps.rb} +8 -2
  21. data/features/step_definitions/feature_steps.rb +8 -4
  22. data/features/step_definitions/outline_steps.rb +12 -6
  23. data/features/step_definitions/setup_steps.rb +2 -2
  24. data/features/step_definitions/spec_steps.rb +6 -3
  25. data/features/step_definitions/step_steps.rb +91 -0
  26. data/features/step_definitions/table_steps.rb +10 -0
  27. data/features/step_definitions/test_steps.rb +6 -10
  28. data/features/step_definitions/world_steps.rb +28 -19
  29. data/features/support/env.rb +0 -2
  30. data/lib/cucumber_analytics/background.rb +16 -0
  31. data/lib/cucumber_analytics/containing.rb +18 -0
  32. data/lib/cucumber_analytics/directory.rb +83 -0
  33. data/lib/cucumber_analytics/doc_string.rb +55 -0
  34. data/lib/cucumber_analytics/example.rb +100 -0
  35. data/lib/cucumber_analytics/feature.rb +120 -0
  36. data/lib/cucumber_analytics/feature_element.rb +22 -40
  37. data/lib/cucumber_analytics/feature_file.rb +74 -0
  38. data/lib/cucumber_analytics/outline.rb +49 -0
  39. data/lib/cucumber_analytics/parsing.rb +30 -0
  40. data/lib/cucumber_analytics/scenario.rb +31 -0
  41. data/lib/cucumber_analytics/step.rb +142 -32
  42. data/lib/cucumber_analytics/table.rb +51 -0
  43. data/lib/cucumber_analytics/taggable.rb +35 -0
  44. data/lib/cucumber_analytics/test_element.rb +36 -91
  45. data/lib/cucumber_analytics/version.rb +1 -1
  46. data/lib/cucumber_analytics/world.rb +109 -153
  47. data/lib/cucumber_analytics.rb +12 -8
  48. data/spec/integration/background_integration_spec.rb +18 -0
  49. data/spec/integration/directory_integration_spec.rb +24 -0
  50. data/spec/{feature_spec.rb → integration/feature_file_integration_spec.rb} +5 -5
  51. data/spec/integration/feature_integration_spec.rb +86 -0
  52. data/spec/integration/outline_integration_spec.rb +22 -0
  53. data/spec/integration/scenario_integration_spec.rb +18 -0
  54. data/spec/integration/step_integration_spec.rb +116 -0
  55. data/spec/integration/world_integration_spec.rb +40 -0
  56. data/spec/spec_helper.rb +7 -3
  57. data/spec/unit/background_unit_spec.rb +22 -0
  58. data/spec/unit/bare_bones_unit_specs.rb +13 -0
  59. data/spec/unit/containing_element_unit_specs.rb +17 -0
  60. data/spec/unit/directory_unit_spec.rb +91 -0
  61. data/spec/unit/doc_string_unit_spec.rb +65 -0
  62. data/spec/unit/example_unit_spec.rb +171 -0
  63. data/spec/unit/feature_element_unit_spec.rb +19 -0
  64. data/spec/unit/feature_element_unit_specs.rb +39 -0
  65. data/spec/unit/feature_file_unit_spec.rb +82 -0
  66. data/spec/unit/feature_unit_spec.rb +81 -0
  67. data/spec/unit/nested_element_unit_specs.rb +24 -0
  68. data/spec/unit/outline_unit_spec.rb +56 -0
  69. data/spec/unit/parsing_unit_spec.rb +21 -0
  70. data/spec/unit/prepopulated_unit_specs.rb +13 -0
  71. data/spec/unit/scenario_unit_spec.rb +36 -0
  72. data/spec/unit/step_unit_spec.rb +231 -0
  73. data/spec/unit/table_unit_spec.rb +52 -0
  74. data/spec/unit/taggable_unit_spec.rb +63 -0
  75. data/spec/unit/tagged_element_unit_specs.rb +48 -0
  76. data/spec/unit/test_element_unit_spec.rb +40 -0
  77. data/spec/unit/test_element_unit_specs.rb +31 -0
  78. data/spec/unit/world_unit_spec.rb +167 -0
  79. metadata +106 -41
  80. data/lib/cucumber_analytics/logging.rb +0 -28
  81. data/lib/cucumber_analytics/outline_example.rb +0 -110
  82. data/lib/cucumber_analytics/parsed_background.rb +0 -45
  83. data/lib/cucumber_analytics/parsed_directory.rb +0 -78
  84. data/lib/cucumber_analytics/parsed_feature.rb +0 -97
  85. data/lib/cucumber_analytics/parsed_file.rb +0 -199
  86. data/lib/cucumber_analytics/parsed_scenario.rb +0 -67
  87. data/lib/cucumber_analytics/parsed_scenario_outline.rb +0 -122
  88. data/spec/background_spec.rb +0 -23
  89. data/spec/directory_spec.rb +0 -18
  90. data/spec/example_spec.rb +0 -37
  91. data/spec/file_spec.rb +0 -20
  92. data/spec/outline_spec.rb +0 -32
  93. data/spec/scenario_spec.rb +0 -33
  94. data/spec/step_spec.rb +0 -24
@@ -0,0 +1,167 @@
1
+ require 'spec_helper'
2
+
3
+ SimpleCov.command_name('World') unless RUBY_VERSION.to_s < '1.9.0'
4
+
5
+ describe 'World, Unit' do
6
+
7
+ before(:each) do
8
+ @world = CucumberAnalytics::World
9
+ @world.loaded_step_patterns.clear
10
+ @world.delimiter = nil
11
+ end
12
+
13
+ it 'has left and right delimiters used for step argument parsing - #left_delimiter, #right_delimiter' do
14
+ @world.should respond_to(:left_delimiter)
15
+ @world.should respond_to(:right_delimiter)
16
+ end
17
+
18
+ it 'can get and set the delimiters used for step argument parsing' do
19
+ @world.left_delimiter = '"'
20
+ @world.right_delimiter = '"'
21
+ @world.left_delimiter.should == '"'
22
+ @world.right_delimiter.should == '"'
23
+
24
+ @world.left_delimiter = '!'
25
+ @world.right_delimiter = '!'
26
+ @world.left_delimiter.should == '!'
27
+ @world.right_delimiter.should == '!'
28
+ end
29
+
30
+ it 'can have different left and right delimiters' do
31
+ @world.left_delimiter = '"'
32
+ @world.right_delimiter = '*'
33
+
34
+ (@world.left_delimiter != @world.right_delimiter).should be_true
35
+ end
36
+
37
+ it 'can set both of its delimiters at once - #delimiter=' do
38
+ @world.delimiter = '*'
39
+
40
+ @world.left_delimiter.should == '*'
41
+ @world.right_delimiter.should == '*'
42
+ end
43
+
44
+ it 'starts with no delimiters' do
45
+ @world.left_delimiter.should == nil
46
+ @world.right_delimiter.should == nil
47
+ end
48
+
49
+ context 'step patterns' do
50
+
51
+ it 'can load step patterns - #load_step_pattern' do
52
+ @world.should respond_to(:load_step_pattern)
53
+ end
54
+
55
+ it 'starts with no patterns loaded' do
56
+ @world.loaded_step_patterns.should == []
57
+ end
58
+
59
+ it 'keeps track of loaded step patterns - #loaded_step_patterns' do
60
+ patterns = [/a pattern/, /another pattern/]
61
+
62
+ patterns.each do |pattern|
63
+ @world.load_step_pattern(pattern)
64
+ end
65
+
66
+ @world.loaded_step_patterns.should =~ patterns
67
+ end
68
+
69
+ it 'can load step definition files - #load_step_file' do
70
+ file_path = "#{DEFAULT_FILE_DIRECTORY}/step_file.rb"
71
+ patterns = [/a pattern/, /another pattern/]
72
+
73
+ File.open(file_path, 'w') { |file|
74
+ patterns.each do |pattern|
75
+ file.puts "Given #{pattern.inspect} do end"
76
+ end
77
+ }
78
+ @world.load_step_file(file_path)
79
+
80
+ @world.loaded_step_patterns.should =~ patterns
81
+ end
82
+
83
+ it 'can handle different step keywords - #load_step_file' do
84
+ file_path = "#{DEFAULT_FILE_DIRECTORY}/step_file.rb"
85
+ patterns = [/given pattern/, /when pattern/, /then pattern/, /and pattern/, /but pattern/]
86
+
87
+ File.open(file_path, 'w') { |file|
88
+ file.puts "Given #{patterns[0].inspect} do end"
89
+ file.puts "When #{patterns[1].inspect} do end"
90
+ file.puts "Then #{patterns[2].inspect} do end"
91
+ file.puts "And #{patterns[3].inspect} do end"
92
+ file.puts "But #{patterns[4].inspect} do end"
93
+ }
94
+
95
+ @world.load_step_file(file_path)
96
+
97
+ @world.loaded_step_patterns.should =~ patterns
98
+ end
99
+
100
+ it 'can handle a variety of declaration structures - #load_step_file' do
101
+ file_path = "#{DEFAULT_FILE_DIRECTORY}/step_file.rb"
102
+ patterns = [/parentheses pattern/, /no parentheses pattern/, /excess whitespace pattern/]
103
+
104
+ File.open(file_path, 'w') { |file|
105
+ file.puts "Given(#{patterns[0].inspect}) do end"
106
+ file.puts "Given #{patterns[1].inspect} do end"
107
+ file.puts "Given #{patterns[2].inspect} do end"
108
+ }
109
+
110
+ @world.load_step_file(file_path)
111
+
112
+ @world.loaded_step_patterns.should =~ patterns
113
+ end
114
+ end
115
+
116
+ context 'collecting stuff' do
117
+
118
+ before(:each) do
119
+ @set_1 = [:thing_1, :thing_2]
120
+ @set_2 = [:thing_3]
121
+ end
122
+
123
+ it 'can collect tags from containers' do
124
+ nested_container = double(:tags => @set_2)
125
+ container = double(:tags => @set_1, :contains => [nested_container])
126
+
127
+ @world.tags_in(container).should =~ (@set_1 + @set_2)
128
+ end
129
+
130
+ it 'can collect directories from containers' do
131
+ nested_container = double(:directories => @set_2)
132
+ container = double(:directories => @set_1, :contains => [nested_container])
133
+
134
+ @world.directories_in(container).should =~ (@set_1 + @set_2)
135
+ end
136
+
137
+ it 'can collect feature files from containers' do
138
+ nested_container = double(:feature_files => @set_2)
139
+ container = double(:feature_files => @set_1, :contains => [nested_container])
140
+
141
+ @world.feature_files_in(container).should =~ (@set_1 + @set_2)
142
+ end
143
+
144
+ it 'can collect features from containers' do
145
+ nested_container = double(:features => @set_2)
146
+ container = double(:features => @set_1, :contains => [nested_container])
147
+
148
+ @world.features_in(container).should =~ (@set_1 + @set_2)
149
+ end
150
+
151
+ it 'can collect tests from containers' do
152
+ nested_container = double(:tests => @set_2)
153
+ container = double(:tests => @set_1, :contains => [nested_container])
154
+
155
+ @world.tests_in(container).should =~ (@set_1 + @set_2)
156
+ end
157
+
158
+ it 'can collect steps from containers' do
159
+ nested_container = double(:steps => @set_2)
160
+ container = double(:steps => @set_1, :contains => [nested_container])
161
+
162
+ @world.steps_in(container).should =~ (@set_1 + @set_2)
163
+ end
164
+
165
+ end
166
+
167
+ end
metadata CHANGED
@@ -1,20 +1,32 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber_analytics
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
5
- prerelease:
4
+ version: 1.0.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Eric Kessler
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-26 00:00:00.000000000 Z
11
+ date: 2013-07-01 00:00:00.000000000 Z
13
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: gherkin
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
14
27
  - !ruby/object:Gem::Dependency
15
28
  name: rake
16
29
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
30
  requirements:
19
31
  - - ! '>='
20
32
  - !ruby/object:Gem::Version
@@ -22,7 +34,6 @@ dependencies:
22
34
  type: :development
23
35
  prerelease: false
24
36
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
37
  requirements:
27
38
  - - ! '>='
28
39
  - !ruby/object:Gem::Version
@@ -30,7 +41,6 @@ dependencies:
30
41
  - !ruby/object:Gem::Dependency
31
42
  name: cucumber
32
43
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
44
  requirements:
35
45
  - - ! '>='
36
46
  - !ruby/object:Gem::Version
@@ -38,7 +48,6 @@ dependencies:
38
48
  type: :development
39
49
  prerelease: false
40
50
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
51
  requirements:
43
52
  - - ! '>='
44
53
  - !ruby/object:Gem::Version
@@ -46,7 +55,6 @@ dependencies:
46
55
  - !ruby/object:Gem::Dependency
47
56
  name: rspec
48
57
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
58
  requirements:
51
59
  - - ! '>='
52
60
  - !ruby/object:Gem::Version
@@ -54,7 +62,6 @@ dependencies:
54
62
  type: :development
55
63
  prerelease: false
56
64
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
65
  requirements:
59
66
  - - ! '>='
60
67
  - !ruby/object:Gem::Version
@@ -62,7 +69,6 @@ dependencies:
62
69
  - !ruby/object:Gem::Dependency
63
70
  name: simplecov
64
71
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
72
  requirements:
67
73
  - - ! '>='
68
74
  - !ruby/object:Gem::Version
@@ -70,7 +76,6 @@ dependencies:
70
76
  type: :development
71
77
  prerelease: false
72
78
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
79
  requirements:
75
80
  - - ! '>='
76
81
  - !ruby/object:Gem::Version
@@ -100,68 +105,99 @@ files:
100
105
  - features/analysis/test_manipulation.feature
101
106
  - features/modeling/background_modeling.feature
102
107
  - features/modeling/directory_modeling.feature
108
+ - features/modeling/doc_string_modeling.feature
103
109
  - features/modeling/example_modeling.feature
104
110
  - features/modeling/feature_file_modeling.feature
105
111
  - features/modeling/feature_modeling.feature
106
112
  - features/modeling/outline_modeling.feature
107
113
  - features/modeling/scenario_modeling.feature
114
+ - features/modeling/step_modeling.feature
115
+ - features/modeling/table_modeling.feature
108
116
  - features/step_definitions/background_steps.rb
109
117
  - features/step_definitions/directory_steps.rb
118
+ - features/step_definitions/doc_string_steps.rb
119
+ - features/step_definitions/feature_file_steps.rb
110
120
  - features/step_definitions/feature_steps.rb
111
- - features/step_definitions/file_steps.rb
112
121
  - features/step_definitions/outline_steps.rb
113
122
  - features/step_definitions/setup_steps.rb
114
123
  - features/step_definitions/spec_steps.rb
124
+ - features/step_definitions/step_steps.rb
125
+ - features/step_definitions/table_steps.rb
115
126
  - features/step_definitions/test_steps.rb
116
127
  - features/step_definitions/world_steps.rb
117
128
  - features/support/env.rb
118
129
  - features/support/transforms.rb
119
130
  - lib/cucumber_analytics.rb
131
+ - lib/cucumber_analytics/background.rb
132
+ - lib/cucumber_analytics/containing.rb
133
+ - lib/cucumber_analytics/directory.rb
134
+ - lib/cucumber_analytics/doc_string.rb
135
+ - lib/cucumber_analytics/example.rb
136
+ - lib/cucumber_analytics/feature.rb
120
137
  - lib/cucumber_analytics/feature_element.rb
121
- - lib/cucumber_analytics/logging.rb
122
- - lib/cucumber_analytics/outline_example.rb
123
- - lib/cucumber_analytics/parsed_background.rb
124
- - lib/cucumber_analytics/parsed_directory.rb
125
- - lib/cucumber_analytics/parsed_feature.rb
126
- - lib/cucumber_analytics/parsed_file.rb
127
- - lib/cucumber_analytics/parsed_scenario.rb
128
- - lib/cucumber_analytics/parsed_scenario_outline.rb
138
+ - lib/cucumber_analytics/feature_file.rb
139
+ - lib/cucumber_analytics/outline.rb
140
+ - lib/cucumber_analytics/parsing.rb
141
+ - lib/cucumber_analytics/scenario.rb
129
142
  - lib/cucumber_analytics/step.rb
143
+ - lib/cucumber_analytics/table.rb
144
+ - lib/cucumber_analytics/taggable.rb
130
145
  - lib/cucumber_analytics/test_element.rb
131
146
  - lib/cucumber_analytics/version.rb
132
147
  - lib/cucumber_analytics/world.rb
133
- - spec/background_spec.rb
134
- - spec/directory_spec.rb
135
- - spec/example_spec.rb
136
- - spec/feature_spec.rb
137
- - spec/file_spec.rb
138
- - spec/outline_spec.rb
139
- - spec/scenario_spec.rb
148
+ - spec/integration/background_integration_spec.rb
149
+ - spec/integration/directory_integration_spec.rb
150
+ - spec/integration/feature_file_integration_spec.rb
151
+ - spec/integration/feature_integration_spec.rb
152
+ - spec/integration/outline_integration_spec.rb
153
+ - spec/integration/scenario_integration_spec.rb
154
+ - spec/integration/step_integration_spec.rb
155
+ - spec/integration/world_integration_spec.rb
140
156
  - spec/spec_helper.rb
141
- - spec/step_spec.rb
157
+ - spec/unit/background_unit_spec.rb
158
+ - spec/unit/bare_bones_unit_specs.rb
159
+ - spec/unit/containing_element_unit_specs.rb
160
+ - spec/unit/directory_unit_spec.rb
161
+ - spec/unit/doc_string_unit_spec.rb
162
+ - spec/unit/example_unit_spec.rb
163
+ - spec/unit/feature_element_unit_spec.rb
164
+ - spec/unit/feature_element_unit_specs.rb
165
+ - spec/unit/feature_file_unit_spec.rb
166
+ - spec/unit/feature_unit_spec.rb
167
+ - spec/unit/nested_element_unit_specs.rb
168
+ - spec/unit/outline_unit_spec.rb
169
+ - spec/unit/parsing_unit_spec.rb
170
+ - spec/unit/prepopulated_unit_specs.rb
171
+ - spec/unit/scenario_unit_spec.rb
172
+ - spec/unit/step_unit_spec.rb
173
+ - spec/unit/table_unit_spec.rb
174
+ - spec/unit/taggable_unit_spec.rb
175
+ - spec/unit/tagged_element_unit_specs.rb
176
+ - spec/unit/test_element_unit_spec.rb
177
+ - spec/unit/test_element_unit_specs.rb
178
+ - spec/unit/world_unit_spec.rb
142
179
  homepage: https://github.com/enkessler/cucumber_analytics
143
180
  licenses: []
181
+ metadata: {}
144
182
  post_install_message:
145
183
  rdoc_options: []
146
184
  require_paths:
147
185
  - lib
148
186
  required_ruby_version: !ruby/object:Gem::Requirement
149
- none: false
150
187
  requirements:
151
188
  - - ! '>='
152
189
  - !ruby/object:Gem::Version
153
190
  version: '0'
154
191
  required_rubygems_version: !ruby/object:Gem::Requirement
155
- none: false
156
192
  requirements:
157
193
  - - ! '>='
158
194
  - !ruby/object:Gem::Version
159
195
  version: '0'
160
196
  requirements: []
161
197
  rubyforge_project:
162
- rubygems_version: 1.8.25
198
+ rubygems_version: 2.0.3
163
199
  signing_key:
164
- specification_version: 3
200
+ specification_version: 4
165
201
  summary: This gem provides an API to programmatically break down Cucumber feature
166
202
  files so that they can be inspected and analyzed in a straightforward manner.
167
203
  test_files:
@@ -175,28 +211,57 @@ test_files:
175
211
  - features/analysis/test_manipulation.feature
176
212
  - features/modeling/background_modeling.feature
177
213
  - features/modeling/directory_modeling.feature
214
+ - features/modeling/doc_string_modeling.feature
178
215
  - features/modeling/example_modeling.feature
179
216
  - features/modeling/feature_file_modeling.feature
180
217
  - features/modeling/feature_modeling.feature
181
218
  - features/modeling/outline_modeling.feature
182
219
  - features/modeling/scenario_modeling.feature
220
+ - features/modeling/step_modeling.feature
221
+ - features/modeling/table_modeling.feature
183
222
  - features/step_definitions/background_steps.rb
184
223
  - features/step_definitions/directory_steps.rb
224
+ - features/step_definitions/doc_string_steps.rb
225
+ - features/step_definitions/feature_file_steps.rb
185
226
  - features/step_definitions/feature_steps.rb
186
- - features/step_definitions/file_steps.rb
187
227
  - features/step_definitions/outline_steps.rb
188
228
  - features/step_definitions/setup_steps.rb
189
229
  - features/step_definitions/spec_steps.rb
230
+ - features/step_definitions/step_steps.rb
231
+ - features/step_definitions/table_steps.rb
190
232
  - features/step_definitions/test_steps.rb
191
233
  - features/step_definitions/world_steps.rb
192
234
  - features/support/env.rb
193
235
  - features/support/transforms.rb
194
- - spec/background_spec.rb
195
- - spec/directory_spec.rb
196
- - spec/example_spec.rb
197
- - spec/feature_spec.rb
198
- - spec/file_spec.rb
199
- - spec/outline_spec.rb
200
- - spec/scenario_spec.rb
236
+ - spec/integration/background_integration_spec.rb
237
+ - spec/integration/directory_integration_spec.rb
238
+ - spec/integration/feature_file_integration_spec.rb
239
+ - spec/integration/feature_integration_spec.rb
240
+ - spec/integration/outline_integration_spec.rb
241
+ - spec/integration/scenario_integration_spec.rb
242
+ - spec/integration/step_integration_spec.rb
243
+ - spec/integration/world_integration_spec.rb
201
244
  - spec/spec_helper.rb
202
- - spec/step_spec.rb
245
+ - spec/unit/background_unit_spec.rb
246
+ - spec/unit/bare_bones_unit_specs.rb
247
+ - spec/unit/containing_element_unit_specs.rb
248
+ - spec/unit/directory_unit_spec.rb
249
+ - spec/unit/doc_string_unit_spec.rb
250
+ - spec/unit/example_unit_spec.rb
251
+ - spec/unit/feature_element_unit_spec.rb
252
+ - spec/unit/feature_element_unit_specs.rb
253
+ - spec/unit/feature_file_unit_spec.rb
254
+ - spec/unit/feature_unit_spec.rb
255
+ - spec/unit/nested_element_unit_specs.rb
256
+ - spec/unit/outline_unit_spec.rb
257
+ - spec/unit/parsing_unit_spec.rb
258
+ - spec/unit/prepopulated_unit_specs.rb
259
+ - spec/unit/scenario_unit_spec.rb
260
+ - spec/unit/step_unit_spec.rb
261
+ - spec/unit/table_unit_spec.rb
262
+ - spec/unit/taggable_unit_spec.rb
263
+ - spec/unit/tagged_element_unit_specs.rb
264
+ - spec/unit/test_element_unit_spec.rb
265
+ - spec/unit/test_element_unit_specs.rb
266
+ - spec/unit/world_unit_spec.rb
267
+ has_rdoc:
@@ -1,28 +0,0 @@
1
- require 'logger'
2
-
3
- module CucumberAnalytics
4
- module Logging
5
-
6
- class << self
7
-
8
- def set_log_level(log_level)
9
- logger.level = log_level
10
- end
11
-
12
- def logger
13
- unless @logger
14
- @logger = Logger.new('logfile.log')
15
- set_log_level(Logger::FATAL)
16
- end
17
-
18
- @logger
19
- end
20
-
21
- def logger=(new_logger)
22
- @logger = new_logger
23
- end
24
-
25
- end
26
-
27
- end
28
- end
@@ -1,110 +0,0 @@
1
- module CucumberAnalytics
2
- class OutlineExample < FeatureElement
3
-
4
-
5
- attr_accessor :tags
6
- attr_accessor :rows
7
- attr_accessor :parameters
8
-
9
-
10
- # Creates a new OutlineExample object and, if *source_lines* is provided,
11
- # populates the object.
12
- def initialize(source_lines = nil)
13
- CucumberAnalytics::Logging.logger.info('OutlineExample#initialize')
14
- CucumberAnalytics::Logging.logger.debug('source lines')
15
- source_lines.each { |line| CucumberAnalytics::Logging.logger.debug(line.chomp) } if source_lines
16
-
17
- super
18
-
19
- @tags = []
20
- @rows = []
21
- @parameters = []
22
-
23
- parse_example(source_lines) if source_lines
24
- end
25
-
26
- # Adds a row to the example block. The row can be given as a Hash of column
27
- # headers and their corresponding values or as an Array of values which
28
- # will be assigned in order.
29
- def add_row(row)
30
- if row.is_a?(Array)
31
- @rows << Hash[@parameters.zip(row.collect { |value| value.strip })]
32
- else
33
- @rows << row
34
- end
35
- end
36
-
37
- # Removes a row from the example block. The row can be given as a Hash of
38
- # column headers and their corresponding values or as an Array of values
39
- # which will be assigned in order.
40
- def remove_row(row)
41
- if row.is_a?(Array)
42
- location = @rows.index { |row_hash| row_hash.values_at(*@parameters) == row }
43
- else
44
- location = @rows.index { |row_hash| row_hash == row }
45
- end
46
- @rows.delete_at(location) if location
47
- end
48
-
49
- # Returns tags which have been inherited from the outline level.
50
- def applied_tags
51
- additional_tags = @parent_element.tags
52
- additional_tags.concat(@parent_element.applied_tags) if @parent_element.respond_to?(:applied_tags)
53
-
54
- additional_tags
55
- end
56
-
57
- # Returns all tags which are applicable to the scenario.
58
- def all_tags
59
- applied_tags + @tags
60
- end
61
-
62
- private
63
-
64
-
65
- def parse_example(source_lines)
66
- CucumberAnalytics::Logging.logger.info('OutlineExample#parse_example')
67
-
68
- parse_feature_element_tags(source_lines)
69
- parse_feature_element(source_lines)
70
-
71
- source_lines.delete_if { |line| World.ignored_line?(line) }
72
-
73
- unless source_lines.empty?
74
- @parameters = source_lines.shift.split('|')
75
- @parameters.shift
76
- @parameters.pop
77
-
78
- @parameters.collect! { |param| param.strip }
79
- end
80
-
81
- unless source_lines.empty?
82
- @rows = source_lines.collect { |row| row.split('|') }.collect do |row|
83
- row.shift
84
- row.collect { |value| value.strip }
85
- end
86
-
87
- @rows.collect! { |row| Hash[@parameters.zip(row)] }
88
- end
89
- end
90
-
91
- def parse_feature_element_description(source_lines)
92
- CucumberAnalytics::Logging.logger.info('OutlineExample#parse_feature_element_description')
93
- CucumberAnalytics::Logging.logger.debug('source lines')
94
- source_lines.each do |line|
95
- CucumberAnalytics::Logging.logger.debug(line.chomp)
96
- end
97
-
98
- until source_lines.first =~ /^\s*\|/ or
99
- source_lines.empty?
100
-
101
- unless World.ignored_line?(source_lines.first)
102
- @description << source_lines.first.strip
103
- end
104
-
105
- source_lines.shift
106
- end
107
- end
108
-
109
- end
110
- end
@@ -1,45 +0,0 @@
1
- module CucumberAnalytics
2
- class ParsedBackground < TestElement
3
-
4
-
5
- # Creates a new ParsedBackground object and, if *source_lines* is provided,
6
- # populates the object.
7
- def initialize(source_lines = nil)
8
- CucumberAnalytics::Logging.logger.info('ParsedBackground#initialize')
9
-
10
- super
11
-
12
- parse_background(source_lines) if source_lines
13
- end
14
-
15
-
16
- private
17
-
18
-
19
- def parse_background(source_lines)
20
- CucumberAnalytics::Logging.logger.info('ParsedBackground#parse_background')
21
-
22
- parse_feature_element(source_lines)
23
- parse_test_element_steps(source_lines)
24
- end
25
-
26
- def parse_feature_element_description(source_lines)
27
- CucumberAnalytics::Logging.logger.info('ParsedBackground#parse_feature_element_description')
28
- CucumberAnalytics::Logging.logger.debug('source lines')
29
- source_lines.each do |line|
30
- CucumberAnalytics::Logging.logger.debug(line.chomp)
31
- end
32
-
33
- until source_lines.first =~ /^\s*(?:(?:Given )|(?:When )|(?:Then )|(?:And )|(?:\* ))/ or
34
- source_lines.empty?
35
-
36
- unless World.ignored_line?(source_lines.first)
37
- @description << source_lines.first.strip
38
- end
39
-
40
- source_lines.shift
41
- end
42
- end
43
-
44
- end
45
- end