cuke_modeler 1.0.4 → 1.1.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 (68) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +12 -0
  3. data/lib/cuke_modeler/adapters/gherkin_2_adapter.rb +5 -5
  4. data/lib/cuke_modeler/adapters/gherkin_3_adapter.rb +8 -5
  5. data/lib/cuke_modeler/adapters/gherkin_4_adapter.rb +8 -5
  6. data/lib/cuke_modeler/containing.rb +12 -7
  7. data/lib/cuke_modeler/models/background.rb +7 -2
  8. data/lib/cuke_modeler/models/cell.rb +2 -1
  9. data/lib/cuke_modeler/models/doc_string.rb +2 -1
  10. data/lib/cuke_modeler/models/example.rb +8 -4
  11. data/lib/cuke_modeler/models/feature.rb +4 -1
  12. data/lib/cuke_modeler/models/outline.rb +6 -2
  13. data/lib/cuke_modeler/models/row.rb +2 -1
  14. data/lib/cuke_modeler/models/scenario.rb +7 -2
  15. data/lib/cuke_modeler/models/step.rb +2 -1
  16. data/lib/cuke_modeler/models/table.rb +2 -1
  17. data/lib/cuke_modeler/models/tag.rb +2 -1
  18. data/lib/cuke_modeler/parsing.rb +45 -0
  19. data/lib/cuke_modeler/version.rb +1 -1
  20. data/testing/cucumber/features/modeling/background_modeling.feature +7 -0
  21. data/testing/cucumber/features/modeling/background_output.feature +6 -1
  22. data/testing/cucumber/features/modeling/directory_output.feature +6 -1
  23. data/testing/cucumber/features/modeling/doc_string_output.feature +6 -1
  24. data/testing/cucumber/features/modeling/example_modeling.feature +7 -0
  25. data/testing/cucumber/features/modeling/example_output.feature +6 -1
  26. data/testing/cucumber/features/modeling/feature_file_output.feature +6 -1
  27. data/testing/cucumber/features/modeling/feature_modeling.feature +7 -0
  28. data/testing/cucumber/features/modeling/feature_output.feature +6 -1
  29. data/testing/cucumber/features/modeling/model_output.feature +1 -8
  30. data/testing/cucumber/features/modeling/outline_modeling.feature +7 -0
  31. data/testing/cucumber/features/modeling/outline_output.feature +6 -1
  32. data/testing/cucumber/features/modeling/row_output.feature +6 -1
  33. data/testing/cucumber/features/modeling/scenario_modeling.feature +7 -0
  34. data/testing/cucumber/features/modeling/scenario_output.feature +6 -1
  35. data/testing/cucumber/features/modeling/step_output.feature +6 -1
  36. data/testing/cucumber/features/modeling/table_output.feature +6 -1
  37. data/testing/cucumber/features/modeling/tag_output.feature +6 -1
  38. data/testing/cucumber/step_definitions/verification_steps.rb +21 -12
  39. data/testing/dialect_helper.rb +48 -0
  40. data/testing/rspec/spec/integration/background_integration_spec.rb +93 -88
  41. data/testing/rspec/spec/integration/cell_integration_spec.rb +26 -27
  42. data/testing/rspec/spec/integration/directory_integration_spec.rb +4 -4
  43. data/testing/rspec/spec/integration/doc_string_integration_spec.rb +38 -39
  44. data/testing/rspec/spec/integration/example_integration_spec.rb +97 -95
  45. data/testing/rspec/spec/integration/feature_file_integration_spec.rb +5 -5
  46. data/testing/rspec/spec/integration/feature_integration_spec.rb +157 -155
  47. data/testing/rspec/spec/integration/gherkin_2_adapter_spec.rb +17 -17
  48. data/testing/rspec/spec/integration/gherkin_3_adapter_spec.rb +17 -17
  49. data/testing/rspec/spec/integration/gherkin_4_adapter_spec.rb +17 -17
  50. data/testing/rspec/spec/integration/outline_integration_spec.rb +359 -354
  51. data/testing/rspec/spec/integration/parsing_integration_spec.rb +30 -2
  52. data/testing/rspec/spec/integration/row_integration_spec.rb +23 -25
  53. data/testing/rspec/spec/integration/scenario_integration_spec.rb +238 -235
  54. data/testing/rspec/spec/integration/step_integration_spec.rb +69 -64
  55. data/testing/rspec/spec/integration/table_integration_spec.rb +32 -36
  56. data/testing/rspec/spec/integration/tag_integration_spec.rb +26 -27
  57. data/testing/rspec/spec/spec_helper.rb +43 -0
  58. data/testing/rspec/spec/unit/background_unit_spec.rb +7 -0
  59. data/testing/rspec/spec/unit/example_unit_spec.rb +7 -0
  60. data/testing/rspec/spec/unit/feature_unit_spec.rb +7 -0
  61. data/testing/rspec/spec/unit/outline_unit_spec.rb +7 -0
  62. data/testing/rspec/spec/unit/parsing_unit_spec.rb +33 -0
  63. data/testing/rspec/spec/unit/scenario_unit_spec.rb +7 -0
  64. data/testing/rspec/spec/unit/shared/keyworded_models_unit_specs.rb +58 -0
  65. data/testing/rspec/spec/unit/step_unit_spec.rb +1 -23
  66. data/testing/test_languages.json +45 -0
  67. data/todo.txt +1 -1
  68. metadata +6 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c92f8c24b0eb10a93381bc8c70e4afff4be3af22
4
- data.tar.gz: 878358f86a7f812b4d2268e708155f1c34b31ce1
3
+ metadata.gz: 329eb638d9b52dada19e21e6753722e0400d3991
4
+ data.tar.gz: dfb9d2bd435da763e2d0f909c68e3b36e7f30a98
5
5
  SHA512:
6
- metadata.gz: 3fd79be1950f2d569a4456aca2c5eca55e2243e4957a0d094c657224c1179709adb19b353d1a46da74e556e3ebafa551f4c3e97e7537f0072074e9c572ea3514
7
- data.tar.gz: d9852037c1c5394afa1240fd3f2a3ddde314606a999fd6ab93360bffd70df27a1cc58d0a852acf9c85f33db9f6367daf0fd4e8f9985825008f167dc6f734fa82
6
+ metadata.gz: d5e6e71f9dd644940330211fda900bf879f6451c4965b7265f197740784342d26c6a26fac59d3ef77e7a02382fa61ddfc085a1b31641ead50ace3f473e98c64b
7
+ data.tar.gz: 67da157b4e93b31a719b60a3ab191c2eaca7b324bc64d6bfd5d3fa62d7f7fb32ff8391319b787fe0116fd89470287911fb8f1ac6d74714fdef328631d54b287c
data/History.md CHANGED
@@ -1,3 +1,15 @@
1
+ ### Version 1.1.0 / 2016-10-28
2
+
3
+ * Support added for non-English dialects. This gem should now be able to model
4
+ feature files using any dialect supported by the 'gherkin' gem.
5
+
6
+ * Models for elements of Gherkin that have keywords (e.g. 'Feature', 'Scenario',
7
+ 'Examples') now keep track of the keyword used by the element that they model.
8
+
9
+ * Bug fix - Fixed a bug that was causing example models to output extra newline
10
+ characters under certain circumstances.
11
+
12
+
1
13
  ### Version 1.0.4 / 2016-10-07
2
14
 
3
15
  * Bug Fix - Fixed a bug that caused some models to include nil objects in their
@@ -200,15 +200,15 @@ module CukeModeler
200
200
  def adapt_child_elements!(parsed_feature)
201
201
  if parsed_feature['elements']
202
202
  parsed_feature['elements'].each do |element|
203
- case element['keyword']
204
- when 'Background'
203
+ case element['type']
204
+ when 'background'
205
205
  adapt_background!(element)
206
- when 'Scenario'
206
+ when 'scenario'
207
207
  adapt_scenario!(element)
208
- when 'Scenario Outline'
208
+ when 'scenario_outline'
209
209
  adapt_outline!(element)
210
210
  else
211
- raise("Unknown element keyword: #{element['keyword']}")
211
+ raise("Unknown element type: #{element['type']}")
212
212
  end
213
213
  end
214
214
  end
@@ -22,6 +22,7 @@ module CukeModeler
22
22
  parsed_feature['cuke_modeler_parsing_data'][:scenarioDefinitions] = nil
23
23
  parsed_feature['cuke_modeler_parsing_data'][:background] = nil
24
24
 
25
+ parsed_feature['keyword'] = parsed_feature.delete(:keyword)
25
26
  parsed_feature['name'] = parsed_feature.delete(:name)
26
27
  parsed_feature['description'] = parsed_feature.delete(:description) || ''
27
28
  parsed_feature['line'] = parsed_feature.delete(:location)[:line]
@@ -46,7 +47,8 @@ module CukeModeler
46
47
  # Removing parsed data for child elements in order to avoid duplicating data
47
48
  parsed_background['cuke_modeler_parsing_data'][:steps] = nil
48
49
 
49
- parsed_background['keyword'] = parsed_background.delete(:type).to_s
50
+ parsed_background['type'] = parsed_background.delete(:type).to_s
51
+ parsed_background['keyword'] = parsed_background.delete(:keyword).to_s
50
52
  parsed_background['name'] = parsed_background.delete(:name)
51
53
  parsed_background['description'] = parsed_background.delete(:description) || ''
52
54
  parsed_background['line'] = parsed_background.delete(:location)[:line]
@@ -122,6 +124,7 @@ module CukeModeler
122
124
  parsed_example['cuke_modeler_parsing_data'][:tableHeader] = nil
123
125
  parsed_example['cuke_modeler_parsing_data'][:tableBody] = nil
124
126
 
127
+ parsed_example['keyword'] = parsed_example.delete(:keyword)
125
128
  parsed_example['name'] = parsed_example.delete(:name)
126
129
  parsed_example['line'] = parsed_example.delete(:location)[:line]
127
130
  parsed_example['description'] = parsed_example.delete(:description) || ''
@@ -252,16 +255,16 @@ module CukeModeler
252
255
  # Saving off the original data
253
256
  parsed_test['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_test))
254
257
 
255
- parsed_test['keyword'] = parsed_test.delete(:type).to_s
258
+ parsed_test['keyword'] = parsed_test.delete(:keyword)
259
+ parsed_test['type'] = parsed_test.delete(:type).to_s
256
260
 
257
- case parsed_test['keyword']
261
+ case parsed_test['type']
258
262
  when 'Scenario'
259
263
  adapt_scenario!(parsed_test)
260
264
  when 'ScenarioOutline'
261
- parsed_test['keyword'] = 'Scenario Outline'
262
265
  adapt_outline!(parsed_test)
263
266
  else
264
- raise(ArgumentError, "Unknown test type: #{parsed_test['keyword']}")
267
+ raise(ArgumentError, "Unknown test type: #{parsed_test['type']}")
265
268
  end
266
269
  end
267
270
 
@@ -20,6 +20,7 @@ module CukeModeler
20
20
  parsed_feature['cuke_modeler_parsing_data'][:tags] = nil
21
21
  parsed_feature['cuke_modeler_parsing_data'][:children] = nil
22
22
 
23
+ parsed_feature['keyword'] = parsed_feature.delete(:keyword)
23
24
  parsed_feature['name'] = parsed_feature.delete(:name)
24
25
  parsed_feature['description'] = parsed_feature.delete(:description) || ''
25
26
  parsed_feature['line'] = parsed_feature.delete(:location)[:line]
@@ -43,7 +44,8 @@ module CukeModeler
43
44
  # Removing parsed data for child elements in order to avoid duplicating data
44
45
  parsed_background['cuke_modeler_parsing_data'][:steps] = nil
45
46
 
46
- parsed_background['keyword'] = parsed_background.delete(:type).to_s
47
+ parsed_background['type'] = parsed_background.delete(:type).to_s
48
+ parsed_background['keyword'] = parsed_background.delete(:keyword).to_s
47
49
  parsed_background['name'] = parsed_background.delete(:name)
48
50
  parsed_background['description'] = parsed_background.delete(:description) || ''
49
51
  parsed_background['line'] = parsed_background.delete(:location)[:line]
@@ -118,6 +120,7 @@ module CukeModeler
118
120
  parsed_example['cuke_modeler_parsing_data'][:tableHeader] = nil
119
121
  parsed_example['cuke_modeler_parsing_data'][:tableBody] = nil
120
122
 
123
+ parsed_example['keyword'] = parsed_example.delete(:keyword)
121
124
  parsed_example['name'] = parsed_example.delete(:name)
122
125
  parsed_example['line'] = parsed_example.delete(:location)[:line]
123
126
  parsed_example['description'] = parsed_example.delete(:description) || ''
@@ -264,16 +267,16 @@ module CukeModeler
264
267
  # Saving off the original data
265
268
  parsed_test['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_test))
266
269
 
267
- parsed_test['keyword'] = parsed_test.delete(:type).to_s
270
+ parsed_test['keyword'] = parsed_test.delete(:keyword)
271
+ parsed_test['type'] = parsed_test.delete(:type).to_s
268
272
 
269
- case parsed_test['keyword']
273
+ case parsed_test['type']
270
274
  when 'Scenario'
271
275
  adapt_scenario!(parsed_test)
272
276
  when 'ScenarioOutline'
273
- parsed_test['keyword'] = 'Scenario Outline'
274
277
  adapt_outline!(parsed_test)
275
278
  else
276
- raise(ArgumentError, "Unknown test type: #{parsed_test['keyword']}")
279
+ raise(ArgumentError, "Unknown test type: #{parsed_test['type']}")
277
280
  end
278
281
  end
279
282
 
@@ -23,6 +23,7 @@ module CukeModeler
23
23
  def populate_scenario(scenario_object, parsed_scenario_data)
24
24
  populate_parsing_data(scenario_object, parsed_scenario_data)
25
25
  populate_source_line(scenario_object, parsed_scenario_data)
26
+ populate_keyword(scenario_object, parsed_scenario_data)
26
27
  populate_name(scenario_object, parsed_scenario_data)
27
28
  populate_description(scenario_object, parsed_scenario_data)
28
29
  populate_steps(scenario_object, parsed_scenario_data)
@@ -32,6 +33,7 @@ module CukeModeler
32
33
  def populate_outline(outline_object, parsed_outline_data)
33
34
  populate_parsing_data(outline_object, parsed_outline_data)
34
35
  populate_source_line(outline_object, parsed_outline_data)
36
+ populate_keyword(outline_object, parsed_outline_data)
35
37
  populate_name(outline_object, parsed_outline_data)
36
38
  populate_description(outline_object, parsed_outline_data)
37
39
  populate_steps(outline_object, parsed_outline_data)
@@ -41,6 +43,7 @@ module CukeModeler
41
43
 
42
44
  def populate_background(background_object, parsed_background_data)
43
45
  populate_parsing_data(background_object, parsed_background_data)
46
+ populate_keyword(background_object, parsed_background_data)
44
47
  populate_name(background_object, parsed_background_data)
45
48
  populate_description(background_object, parsed_background_data)
46
49
  populate_source_line(background_object, parsed_background_data)
@@ -93,6 +96,7 @@ module CukeModeler
93
96
 
94
97
  def populate_example(example_object, parsed_example_data)
95
98
  populate_parsing_data(example_object, parsed_example_data)
99
+ populate_keyword(example_object, parsed_example_data)
96
100
  populate_source_line(example_object, parsed_example_data)
97
101
  populate_name(example_object, parsed_example_data)
98
102
  populate_description(example_object, parsed_example_data)
@@ -109,6 +113,7 @@ module CukeModeler
109
113
  def populate_feature(feature_object, parsed_feature_data)
110
114
  populate_parsing_data(feature_object, parsed_feature_data)
111
115
  populate_source_line(feature_object, parsed_feature_data)
116
+ populate_keyword(feature_object, parsed_feature_data)
112
117
  populate_name(feature_object, parsed_feature_data)
113
118
  populate_description(feature_object, parsed_feature_data)
114
119
  populate_tags(feature_object, parsed_feature_data)
@@ -143,8 +148,8 @@ module CukeModeler
143
148
  step_model.text = parsed_step_data['name']
144
149
  end
145
150
 
146
- def populate_keyword(step_model, parsed_step_data)
147
- step_model.keyword = parsed_step_data['keyword'].strip
151
+ def populate_keyword(model, parsed_model_data)
152
+ model.keyword = parsed_model_data['keyword'].strip
148
153
  end
149
154
 
150
155
  def populate_row_models(table_model, parsed_table_data)
@@ -188,15 +193,15 @@ module CukeModeler
188
193
 
189
194
  if elements
190
195
  elements.each do |element|
191
- case element['keyword']
192
- when 'Scenario'
196
+ case element['type']
197
+ when 'Scenario', 'scenario'
193
198
  feature_model.tests << build_child_model(Scenario, element)
194
- when 'Scenario Outline'
199
+ when 'ScenarioOutline', 'scenario_outline'
195
200
  feature_model.tests << build_child_model(Outline, element)
196
- when 'Background'
201
+ when 'Background', 'background'
197
202
  feature_model.background = build_child_model(Background, element)
198
203
  else
199
- raise(ArgumentError, "Unknown keyword: #{element['keyword']}")
204
+ raise(ArgumentError, "Unknown element type: #{element['type']}")
200
205
  end
201
206
  end
202
207
  end
@@ -4,6 +4,7 @@ module CukeModeler
4
4
 
5
5
  class Background < Model
6
6
 
7
+ include Parsing
7
8
  include Parsed
8
9
  include Named
9
10
  include Described
@@ -11,6 +12,10 @@ module CukeModeler
11
12
  include Sourceable
12
13
 
13
14
 
15
+ # The background's keyword
16
+ attr_accessor :keyword
17
+
18
+
14
19
  # Creates a new Background object and, if *source_text* is provided, populates
15
20
  # the object.
16
21
  def initialize(source_text = nil)
@@ -41,7 +46,7 @@ module CukeModeler
41
46
  def to_s
42
47
  text = ''
43
48
 
44
- text << "Background:#{name_output_string}"
49
+ text << "#{@keyword}:#{name_output_string}"
45
50
  text << "\n" + description_output_string unless (description.nil? || description.empty?)
46
51
  text << "\n" unless (steps.empty? || description.nil? || description.empty?)
47
52
  text << "\n" + steps_output_string unless steps.empty?
@@ -54,7 +59,7 @@ module CukeModeler
54
59
 
55
60
 
56
61
  def parse_source(source_text)
57
- base_file_string = "Feature: Fake feature to parse\n"
62
+ base_file_string = "#{dialect_feature_keyword}: Fake feature to parse\n"
58
63
  source_text = base_file_string + source_text
59
64
 
60
65
  parsed_file = Parsing::parse_text(source_text, 'cuke_modeler_stand_alone_background.feature')
@@ -5,6 +5,7 @@ module CukeModeler
5
5
  class Cell < Model
6
6
 
7
7
  include Sourceable
8
+ include Parsing
8
9
  include Parsed
9
10
 
10
11
 
@@ -35,7 +36,7 @@ module CukeModeler
35
36
 
36
37
 
37
38
  def parse_source(source_text)
38
- base_file_string = "Feature: Fake feature to parse\nScenario:\n* fake step\n"
39
+ base_file_string = "#{dialect_feature_keyword}: Fake feature to parse\n#{dialect_scenario_keyword}:\n#{dialect_step_keyword} fake step\n"
39
40
  source_text = base_file_string + '|' + source_text + '|'
40
41
 
41
42
  parsed_file = Parsing::parse_text(source_text, 'cuke_modeler_stand_alone_cell.feature')
@@ -4,6 +4,7 @@ module CukeModeler
4
4
 
5
5
  class DocString < Model
6
6
 
7
+ include Parsing
7
8
  include Parsed
8
9
  include Sourceable
9
10
 
@@ -39,7 +40,7 @@ module CukeModeler
39
40
 
40
41
 
41
42
  def parse_source(source_text)
42
- base_file_string = "Feature:\nScenario:\n* step\n"
43
+ base_file_string = "#{dialect_feature_keyword}:\n#{dialect_scenario_keyword}:\n#{dialect_step_keyword} step\n"
43
44
  source_text = base_file_string + source_text
44
45
 
45
46
  parsed_file = Parsing::parse_text(source_text, 'cuke_modeler_stand_alone_doc_string.feature')
@@ -4,6 +4,7 @@ module CukeModeler
4
4
 
5
5
  class Example < Model
6
6
 
7
+ include Parsing
7
8
  include Parsed
8
9
  include Named
9
10
  include Described
@@ -11,6 +12,9 @@ module CukeModeler
11
12
  include Taggable
12
13
 
13
14
 
15
+ # The example's keyword
16
+ attr_accessor :keyword
17
+
14
18
  # The row models in the example table
15
19
  attr_accessor :rows
16
20
 
@@ -101,10 +105,10 @@ module CukeModeler
101
105
  text = ''
102
106
 
103
107
  text << tag_output_string + "\n" unless tags.empty?
104
- text << "Examples:#{name_output_string}"
108
+ text << "#{@keyword}:#{name_output_string}"
105
109
  text << "\n" + description_output_string unless (description.nil? || description.empty?)
106
- text << "\n" unless (description.nil? || description.empty?)
107
- text << "\n" + parameters_output_string
110
+ text << "\n" unless (rows.empty? || description.nil? || description.empty?)
111
+ text << "\n" + parameters_output_string if parameter_row
108
112
  text << "\n" + rows_output_string unless argument_rows.empty?
109
113
 
110
114
  text
@@ -115,7 +119,7 @@ module CukeModeler
115
119
 
116
120
 
117
121
  def parse_source(source_text)
118
- base_file_string = "Feature: Fake feature to parse\nScenario Outline:\n* fake step\n"
122
+ base_file_string = "#{dialect_feature_keyword}: Fake feature to parse\n#{dialect_outline_keyword}:\n#{dialect_step_keyword} fake step\n"
119
123
  source_text = base_file_string + source_text
120
124
 
121
125
  parsed_file = Parsing::parse_text(source_text, 'cuke_modeler_stand_alone_example.feature')
@@ -11,6 +11,9 @@ module CukeModeler
11
11
  include Sourceable
12
12
 
13
13
 
14
+ # The keyword for the feature
15
+ attr_accessor :keyword
16
+
14
17
  # The Background object contained by the Feature
15
18
  attr_accessor :background
16
19
 
@@ -72,7 +75,7 @@ module CukeModeler
72
75
  text = ''
73
76
 
74
77
  text << tag_output_string + "\n" unless tags.empty?
75
- text << "Feature:#{name_output_string}"
78
+ text << "#{@keyword}:#{name_output_string}"
76
79
  text << "\n" + description_output_string unless (description.nil? || description.empty?)
77
80
  text << "\n\n" + background_output_string if background
78
81
  text << "\n\n" + tests_output_string unless tests.empty?
@@ -4,6 +4,7 @@ module CukeModeler
4
4
 
5
5
  class Outline < Model
6
6
 
7
+ include Parsing
7
8
  include Parsed
8
9
  include Named
9
10
  include Described
@@ -12,6 +13,9 @@ module CukeModeler
12
13
  include Taggable
13
14
 
14
15
 
16
+ # The outline's keyword
17
+ attr_accessor :keyword
18
+
15
19
  # The Example objects contained by the Outline
16
20
  attr_accessor :examples
17
21
 
@@ -49,7 +53,7 @@ module CukeModeler
49
53
  text = ''
50
54
 
51
55
  text << tag_output_string + "\n" unless tags.empty?
52
- text << "Scenario Outline:#{name_output_string}"
56
+ text << "#{@keyword}:#{name_output_string}"
53
57
  text << "\n" + description_output_string unless (description.nil? || description.empty?)
54
58
  text << "\n" unless (steps.empty? || description.nil? || description.empty?)
55
59
  text << "\n" + steps_output_string unless steps.empty?
@@ -63,7 +67,7 @@ module CukeModeler
63
67
 
64
68
 
65
69
  def parse_source(source_text)
66
- base_file_string = "Feature: Fake feature to parse\n"
70
+ base_file_string = "#{dialect_feature_keyword}: Fake feature to parse\n"
67
71
  source_text = base_file_string + source_text
68
72
 
69
73
  parsed_file = Parsing::parse_text(source_text, 'cuke_modeler_stand_alone_outline.feature')
@@ -5,6 +5,7 @@ module CukeModeler
5
5
  class Row < Model
6
6
 
7
7
  include Sourceable
8
+ include Parsing
8
9
  include Parsed
9
10
 
10
11
  # The cell models that make up the row
@@ -37,7 +38,7 @@ module CukeModeler
37
38
 
38
39
 
39
40
  def parse_source(source_text)
40
- base_file_string = "Feature: Fake feature to parse\nScenario:\n* fake step\n"
41
+ base_file_string = "#{dialect_feature_keyword}: Fake feature to parse\n#{dialect_scenario_keyword}:\n#{dialect_step_keyword} fake step\n"
41
42
  source_text = base_file_string + source_text
42
43
 
43
44
  parsed_file = Parsing::parse_text(source_text, 'cuke_modeler_stand_alone_row.feature')
@@ -4,6 +4,7 @@ module CukeModeler
4
4
 
5
5
  class Scenario < Model
6
6
 
7
+ include Parsing
7
8
  include Parsed
8
9
  include Named
9
10
  include Described
@@ -12,6 +13,10 @@ module CukeModeler
12
13
  include Taggable
13
14
 
14
15
 
16
+ # The scenario's keyword
17
+ attr_accessor :keyword
18
+
19
+
15
20
  # Creates a new Scenario object and, if *source_text* is provided, populates the
16
21
  # object.
17
22
  def initialize(source_text = nil)
@@ -44,7 +49,7 @@ module CukeModeler
44
49
  text = ''
45
50
 
46
51
  text << tag_output_string + "\n" unless tags.empty?
47
- text << "Scenario:#{name_output_string}"
52
+ text << "#{@keyword}:#{name_output_string}"
48
53
  text << "\n" + description_output_string unless (description.nil? || description.empty?)
49
54
  text << "\n" unless (steps.empty? || description.nil? || description.empty?)
50
55
  text << "\n" + steps_output_string unless steps.empty?
@@ -57,7 +62,7 @@ module CukeModeler
57
62
 
58
63
 
59
64
  def parse_source(source_text)
60
- base_file_string = "Feature: Fake feature to parse\n"
65
+ base_file_string = "#{dialect_feature_keyword}: Fake feature to parse\n"
61
66
  source_text = base_file_string + source_text
62
67
 
63
68
  parsed_file = Parsing::parse_text(source_text, 'cuke_modeler_stand_alone_scenario.feature')
@@ -5,6 +5,7 @@ module CukeModeler
5
5
  class Step < Model
6
6
 
7
7
  include Sourceable
8
+ include Parsing
8
9
  include Parsed
9
10
 
10
11
 
@@ -56,7 +57,7 @@ module CukeModeler
56
57
 
57
58
 
58
59
  def parse_source(source_text)
59
- base_file_string = "Feature: Fake feature to parse\nScenario:\n"
60
+ base_file_string = "#{dialect_feature_keyword}: Fake feature to parse\n#{dialect_scenario_keyword}:\n"
60
61
  source_text = base_file_string + source_text
61
62
 
62
63
  parsed_file = Parsing::parse_text(source_text, 'cuke_modeler_stand_alone_step.feature')