cuke_modeler 0.4.1 → 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.
- checksums.yaml +4 -4
- data/.gitignore +17 -17
- data/.travis.yml +1 -1
- data/Gemfile +4 -0
- data/History.rdoc +71 -3
- data/LICENSE.txt +22 -22
- data/README.md +24 -10
- data/Rakefile +2 -12
- data/cuke_modeler.gemspec +1 -1
- data/features/analysis/test_comparison.feature +37 -122
- data/features/modeling/background_modeling.feature +77 -0
- data/features/modeling/background_output.feature +42 -0
- data/features/modeling/cell_modeling.feature +23 -0
- data/features/modeling/cell_output.feature +22 -0
- data/features/modeling/directory_modeling.feature +65 -0
- data/features/modeling/directory_output.feature +12 -0
- data/features/modeling/doc_string_modeling.feature +61 -0
- data/features/modeling/doc_string_output.feature +32 -0
- data/features/modeling/example_modeling.feature +125 -0
- data/features/modeling/example_output.feature +39 -0
- data/features/modeling/feature_file_modeling.feature +40 -0
- data/features/modeling/feature_file_output.feature +12 -0
- data/features/modeling/feature_modeling.feature +109 -0
- data/features/modeling/feature_output.feature +104 -0
- data/features/modeling/model_output.feature +22 -0
- data/features/modeling/model_structure.feature +48 -0
- data/features/modeling/outline_modeling.feature +144 -0
- data/features/modeling/outline_output.feature +69 -0
- data/features/modeling/row_modeling.feature +48 -0
- data/features/modeling/row_output.feature +22 -0
- data/features/modeling/scenario_modeling.feature +118 -0
- data/features/modeling/scenario_output.feature +45 -0
- data/features/modeling/step_modeling.feature +84 -0
- data/features/modeling/step_output.feature +29 -0
- data/features/modeling/table_modeling.feature +50 -0
- data/features/modeling/table_output.feature +24 -0
- data/features/modeling/tag_modeling.feature +43 -0
- data/features/modeling/tag_output.feature +22 -0
- data/features/step_definitions/action_steps.rb +11 -1
- data/features/step_definitions/background_steps.rb +1 -85
- data/features/step_definitions/directory_steps.rb +2 -48
- data/features/step_definitions/doc_string_steps.rb +1 -67
- data/features/step_definitions/feature_file_steps.rb +2 -37
- data/features/step_definitions/feature_steps.rb +4 -100
- data/features/step_definitions/modeling_steps.rb +44 -0
- data/features/step_definitions/setup_steps.rb +19 -41
- data/features/step_definitions/step_steps.rb +2 -166
- data/features/step_definitions/table_steps.rb +1 -58
- data/features/step_definitions/tag_steps.rb +2 -72
- data/features/step_definitions/verification_steps.rb +152 -4
- data/features/support/env.rb +4 -6
- data/gemfiles/{gherkin.gemfile → gherkin2.gemfile} +4 -0
- data/gemfiles/gherkin3.gemfile +4 -0
- data/gemfiles/gherkin4.gemfile +4 -0
- data/lib/cuke_modeler.rb +24 -22
- data/lib/cuke_modeler/adapters/gherkin_2_adapter.rb +103 -31
- data/lib/cuke_modeler/adapters/gherkin_3_adapter.rb +103 -40
- data/lib/cuke_modeler/adapters/gherkin_4_adapter.rb +111 -50
- data/lib/cuke_modeler/containing.rb +255 -4
- data/lib/cuke_modeler/described.rb +28 -0
- data/lib/cuke_modeler/models/background.rb +66 -0
- data/lib/cuke_modeler/models/cell.rb +48 -0
- data/lib/cuke_modeler/models/directory.rb +95 -0
- data/lib/cuke_modeler/models/doc_string.rb +59 -0
- data/lib/cuke_modeler/models/example.rb +167 -0
- data/lib/cuke_modeler/models/feature.rb +106 -0
- data/lib/cuke_modeler/models/feature_file.rb +64 -0
- data/lib/cuke_modeler/models/model.rb +32 -0
- data/lib/cuke_modeler/models/outline.rb +79 -0
- data/lib/cuke_modeler/models/row.rb +49 -0
- data/lib/cuke_modeler/models/scenario.rb +69 -0
- data/lib/cuke_modeler/models/step.rb +68 -0
- data/lib/cuke_modeler/models/table.rb +67 -0
- data/lib/cuke_modeler/models/tag.rb +46 -0
- data/lib/cuke_modeler/named.rb +19 -0
- data/lib/cuke_modeler/nested.rb +22 -15
- data/lib/cuke_modeler/parsed.rb +11 -0
- data/lib/cuke_modeler/parsing.rb +66 -83
- data/lib/cuke_modeler/sourceable.rb +3 -11
- data/lib/cuke_modeler/stepped.rb +24 -0
- data/lib/cuke_modeler/taggable.rb +6 -29
- data/lib/cuke_modeler/version.rb +2 -1
- data/spec/integration/background_integration_spec.rb +332 -7
- data/spec/integration/cell_integration_spec.rb +321 -0
- data/spec/integration/directory_integration_spec.rb +175 -9
- data/spec/integration/doc_string_integration_spec.rb +318 -7
- data/spec/integration/example_integration_spec.rb +602 -19
- data/spec/integration/feature_file_integration_spec.rb +98 -3
- data/spec/integration/feature_integration_spec.rb +445 -27
- data/spec/integration/gherkin_2_adapter_spec.rb +122 -0
- data/spec/integration/gherkin_3_adapter_spec.rb +125 -0
- data/spec/integration/gherkin_4_adapter_spec.rb +123 -0
- data/spec/integration/model_integration_spec.rb +15 -0
- data/spec/integration/nested_integration_spec.rb +91 -0
- data/spec/integration/outline_integration_spec.rb +485 -12
- data/spec/integration/parsing_integration_spec.rb +85 -0
- data/spec/integration/row_integration_spec.rb +221 -18
- data/spec/integration/scenario_integration_spec.rb +368 -14
- data/spec/integration/shared/models_integration_specs.rb +18 -0
- data/spec/integration/step_integration_spec.rb +328 -77
- data/spec/integration/table_integration_spec.rb +242 -20
- data/spec/integration/tag_integration_spec.rb +178 -13
- data/spec/spec_helper.rb +32 -18
- data/spec/unit/background_unit_spec.rb +24 -44
- data/spec/unit/cell_unit_spec.rb +73 -0
- data/spec/unit/described_unit_spec.rb +23 -0
- data/spec/unit/directory_unit_spec.rb +52 -62
- data/spec/unit/doc_string_unit_spec.rb +47 -100
- data/spec/unit/example_unit_spec.rb +50 -296
- data/spec/unit/feature_file_unit_spec.rb +53 -52
- data/spec/unit/feature_unit_spec.rb +39 -83
- data/spec/unit/model_unit_spec.rb +15 -0
- data/spec/unit/named_unit_spec.rb +23 -0
- data/spec/unit/nested_unit_spec.rb +24 -21
- data/spec/unit/outline_unit_spec.rb +46 -69
- data/spec/unit/parsed_unit_spec.rb +27 -0
- data/spec/unit/parsing_unit_spec.rb +2 -70
- data/spec/unit/row_unit_spec.rb +22 -51
- data/spec/unit/scenario_unit_spec.rb +27 -59
- data/spec/unit/{bare_bones_unit_specs.rb → shared/bare_bones_models_unit_specs.rb} +2 -2
- data/spec/unit/shared/containing_models_unit_specs.rb +18 -0
- data/spec/unit/shared/described_models_unit_specs.rb +38 -0
- data/spec/unit/shared/models_unit_specs.rb +15 -0
- data/spec/unit/shared/named_models_unit_specs.rb +39 -0
- data/spec/unit/shared/nested_models_unit_specs.rb +51 -0
- data/spec/unit/shared/parsed_models_unit_specs.rb +39 -0
- data/spec/unit/shared/prepopulated_models_unit_specs.rb +18 -0
- data/spec/unit/shared/sourced_models_unit_specs.rb +39 -0
- data/spec/unit/shared/stepped_models_unit_specs.rb +46 -0
- data/spec/unit/shared/stringifiable_models_unit_specs.rb +18 -0
- data/spec/unit/shared/tagged_models_unit_specs.rb +72 -0
- data/spec/unit/sourceable_unit_spec.rb +12 -4
- data/spec/unit/step_unit_spec.rb +40 -231
- data/spec/unit/stepped_unit_spec.rb +23 -0
- data/spec/unit/table_unit_spec.rb +27 -89
- data/spec/unit/tag_unit_spec.rb +30 -53
- data/spec/unit/taggable_unit_spec.rb +26 -42
- data/todo.txt +32 -0
- metadata +135 -217
- data/features/analysis/test_manipulation.feature +0 -37
- data/features/modeling/gherkin/background_modeling.feature +0 -65
- data/features/modeling/gherkin/background_output.feature +0 -131
- data/features/modeling/gherkin/directory_modeling.feature +0 -110
- data/features/modeling/gherkin/directory_output.feature +0 -14
- data/features/modeling/gherkin/doc_string_modeling.feature +0 -53
- data/features/modeling/gherkin/doc_string_output.feature +0 -72
- data/features/modeling/gherkin/example_modeling.feature +0 -101
- data/features/modeling/gherkin/example_output.feature +0 -193
- data/features/modeling/gherkin/feature_file_modeling.feature +0 -54
- data/features/modeling/gherkin/feature_file_output.feature +0 -14
- data/features/modeling/gherkin/feature_modeling.feature +0 -154
- data/features/modeling/gherkin/feature_output.feature +0 -245
- data/features/modeling/gherkin/outline_modeling.feature +0 -90
- data/features/modeling/gherkin/outline_output.feature +0 -198
- data/features/modeling/gherkin/row_modeling.feature +0 -68
- data/features/modeling/gherkin/row_output.feature +0 -28
- data/features/modeling/gherkin/scenario_modeling.feature +0 -79
- data/features/modeling/gherkin/scenario_output.feature +0 -148
- data/features/modeling/gherkin/step_modeling.feature +0 -75
- data/features/modeling/gherkin/step_output.feature +0 -53
- data/features/modeling/gherkin/table_modeling.feature +0 -42
- data/features/modeling/gherkin/table_output.feature +0 -43
- data/features/modeling/gherkin/table_row_modeling.feature +0 -57
- data/features/modeling/gherkin/table_row_output.feature +0 -28
- data/features/modeling/gherkin/tag_modeling.feature +0 -48
- data/features/modeling/gherkin/tag_output.feature +0 -17
- data/features/modeling/gherkin3/background_modeling.feature +0 -64
- data/features/modeling/gherkin3/background_output.feature +0 -131
- data/features/modeling/gherkin3/directory_modeling.feature +0 -110
- data/features/modeling/gherkin3/directory_output.feature +0 -14
- data/features/modeling/gherkin3/doc_string_modeling.feature +0 -53
- data/features/modeling/gherkin3/doc_string_output.feature +0 -72
- data/features/modeling/gherkin3/example_modeling.feature +0 -100
- data/features/modeling/gherkin3/example_output.feature +0 -207
- data/features/modeling/gherkin3/feature_file_modeling.feature +0 -54
- data/features/modeling/gherkin3/feature_file_output.feature +0 -14
- data/features/modeling/gherkin3/feature_modeling.feature +0 -155
- data/features/modeling/gherkin3/feature_output.feature +0 -249
- data/features/modeling/gherkin3/outline_modeling.feature +0 -89
- data/features/modeling/gherkin3/outline_output.feature +0 -255
- data/features/modeling/gherkin3/row_modeling.feature +0 -68
- data/features/modeling/gherkin3/row_output.feature +0 -28
- data/features/modeling/gherkin3/scenario_modeling.feature +0 -78
- data/features/modeling/gherkin3/scenario_output.feature +0 -148
- data/features/modeling/gherkin3/step_modeling.feature +0 -75
- data/features/modeling/gherkin3/step_output.feature +0 -53
- data/features/modeling/gherkin3/table_modeling.feature +0 -42
- data/features/modeling/gherkin3/table_output.feature +0 -43
- data/features/modeling/gherkin3/table_row_modeling.feature +0 -57
- data/features/modeling/gherkin3/table_row_output.feature +0 -28
- data/features/modeling/gherkin3/tag_modeling.feature +0 -49
- data/features/modeling/gherkin3/tag_output.feature +0 -17
- data/features/modeling/gherkin4/background_modeling.feature +0 -64
- data/features/modeling/gherkin4/background_output.feature +0 -131
- data/features/modeling/gherkin4/directory_modeling.feature +0 -110
- data/features/modeling/gherkin4/directory_output.feature +0 -14
- data/features/modeling/gherkin4/doc_string_modeling.feature +0 -53
- data/features/modeling/gherkin4/doc_string_output.feature +0 -72
- data/features/modeling/gherkin4/example_modeling.feature +0 -100
- data/features/modeling/gherkin4/example_output.feature +0 -193
- data/features/modeling/gherkin4/feature_file_modeling.feature +0 -54
- data/features/modeling/gherkin4/feature_file_output.feature +0 -14
- data/features/modeling/gherkin4/feature_modeling.feature +0 -153
- data/features/modeling/gherkin4/feature_output.feature +0 -245
- data/features/modeling/gherkin4/outline_modeling.feature +0 -89
- data/features/modeling/gherkin4/outline_output.feature +0 -198
- data/features/modeling/gherkin4/row_modeling.feature +0 -68
- data/features/modeling/gherkin4/row_output.feature +0 -28
- data/features/modeling/gherkin4/scenario_modeling.feature +0 -78
- data/features/modeling/gherkin4/scenario_output.feature +0 -148
- data/features/modeling/gherkin4/step_modeling.feature +0 -75
- data/features/modeling/gherkin4/step_output.feature +0 -53
- data/features/modeling/gherkin4/table_modeling.feature +0 -42
- data/features/modeling/gherkin4/table_output.feature +0 -43
- data/features/modeling/gherkin4/table_row_modeling.feature +0 -57
- data/features/modeling/gherkin4/table_row_output.feature +0 -28
- data/features/modeling/gherkin4/tag_modeling.feature +0 -48
- data/features/modeling/gherkin4/tag_output.feature +0 -17
- data/features/step_definitions/outline_steps.rb +0 -258
- data/features/step_definitions/test_steps.rb +0 -123
- data/lib/cuke_modeler/background.rb +0 -38
- data/lib/cuke_modeler/directory.rb +0 -83
- data/lib/cuke_modeler/doc_string.rb +0 -87
- data/lib/cuke_modeler/example.rb +0 -195
- data/lib/cuke_modeler/feature.rb +0 -147
- data/lib/cuke_modeler/feature_element.rb +0 -73
- data/lib/cuke_modeler/feature_file.rb +0 -77
- data/lib/cuke_modeler/outline.rb +0 -68
- data/lib/cuke_modeler/raw.rb +0 -20
- data/lib/cuke_modeler/row.rb +0 -64
- data/lib/cuke_modeler/scenario.rb +0 -45
- data/lib/cuke_modeler/step.rb +0 -216
- data/lib/cuke_modeler/table.rb +0 -90
- data/lib/cuke_modeler/table_row.rb +0 -64
- data/lib/cuke_modeler/tag.rb +0 -62
- data/lib/cuke_modeler/test_element.rb +0 -79
- data/lib/cuke_modeler/world.rb +0 -113
- data/spec/integration/table_row_integration_spec.rb +0 -76
- data/spec/integration/world_integration_spec.rb +0 -14
- data/spec/unit/containing_element_unit_specs.rb +0 -18
- data/spec/unit/feature_element_unit_spec.rb +0 -19
- data/spec/unit/feature_element_unit_specs.rb +0 -52
- data/spec/unit/nested_element_unit_specs.rb +0 -39
- data/spec/unit/prepopulated_unit_specs.rb +0 -14
- data/spec/unit/raw_element_unit_specs.rb +0 -27
- data/spec/unit/raw_unit_spec.rb +0 -28
- data/spec/unit/sourced_element_unit_specs.rb +0 -18
- data/spec/unit/table_row_unit_spec.rb +0 -102
- data/spec/unit/tagged_element_unit_specs.rb +0 -67
- data/spec/unit/test_element_unit_spec.rb +0 -54
- data/spec/unit/test_element_unit_specs.rb +0 -34
- data/spec/unit/world_unit_spec.rb +0 -140
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Feature: Table output
|
|
2
|
+
|
|
3
|
+
A table model's string output is a Gherkin representation of itself.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
Scenario: Outputting a table model
|
|
7
|
+
Given the following gherkin:
|
|
8
|
+
"""
|
|
9
|
+
|value1|value2|
|
|
10
|
+
|value3|value4|
|
|
11
|
+
"""
|
|
12
|
+
And a table model based on that gherkin
|
|
13
|
+
"""
|
|
14
|
+
@model = CukeModeler::Table.new(<source_text>)
|
|
15
|
+
"""
|
|
16
|
+
When the model is output as a string
|
|
17
|
+
"""
|
|
18
|
+
@model.to_s
|
|
19
|
+
"""
|
|
20
|
+
Then the following text is provided:
|
|
21
|
+
"""
|
|
22
|
+
| value1 | value2 |
|
|
23
|
+
| value3 | value4 |
|
|
24
|
+
"""
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
Feature: Tag modeling
|
|
2
|
+
|
|
3
|
+
Tag models represent a tag portion of a feature. They expose several attributes of the tag
|
|
4
|
+
that they represent.
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Background:
|
|
8
|
+
Given the following gherkin:
|
|
9
|
+
"""
|
|
10
|
+
@a_tag
|
|
11
|
+
"""
|
|
12
|
+
And a tag model based on that gherkin
|
|
13
|
+
"""
|
|
14
|
+
@model = CukeModeler::Tag.new(<source_text>)
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
Scenario: Modeling a tag's name
|
|
19
|
+
When the tag's name is requested
|
|
20
|
+
"""
|
|
21
|
+
@model.name
|
|
22
|
+
"""
|
|
23
|
+
Then the model returns "@a_tag"
|
|
24
|
+
|
|
25
|
+
Scenario: Modeling a tag's source line
|
|
26
|
+
Given the following gherkin:
|
|
27
|
+
"""
|
|
28
|
+
@a_tag
|
|
29
|
+
Feature:
|
|
30
|
+
"""
|
|
31
|
+
And a feature model based on that gherkin
|
|
32
|
+
"""
|
|
33
|
+
@model = CukeModeler::Feature.new(<source_text>)
|
|
34
|
+
"""
|
|
35
|
+
And the tag model of that feature model
|
|
36
|
+
"""
|
|
37
|
+
@model = @model.tags.first
|
|
38
|
+
"""
|
|
39
|
+
When the tag's source line is requested
|
|
40
|
+
"""
|
|
41
|
+
@model.source_line
|
|
42
|
+
"""
|
|
43
|
+
Then the model returns "1"
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Feature: Tag output
|
|
2
|
+
|
|
3
|
+
A tag model's string output is a Gherkin representation of itself.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
Scenario: Outputting a tag model
|
|
7
|
+
Given the following gherkin:
|
|
8
|
+
"""
|
|
9
|
+
@a_tag
|
|
10
|
+
"""
|
|
11
|
+
And a scenario model based on that gherkin
|
|
12
|
+
"""
|
|
13
|
+
@model = CukeModeler::Tag.new(<source_text>)
|
|
14
|
+
"""
|
|
15
|
+
When the model is output as a string
|
|
16
|
+
"""
|
|
17
|
+
@model.to_s
|
|
18
|
+
"""
|
|
19
|
+
Then the following text is provided:
|
|
20
|
+
"""
|
|
21
|
+
@a_tag
|
|
22
|
+
"""
|
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
When(/^it is outputted$/) do
|
|
2
|
-
@output = @
|
|
2
|
+
@output = @model.to_s
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
When(/^the models are compared$/) do
|
|
6
|
+
@results = []
|
|
7
|
+
|
|
8
|
+
(@models.count - 1).times do |index|
|
|
9
|
+
@results << (@models[index] == @models[index + 1])
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
@results << (@models.first == @models.last)
|
|
3
13
|
end
|
|
@@ -1,85 +1 @@
|
|
|
1
|
-
|
|
2
|
-
file ||= 1
|
|
3
|
-
properties = properties.rows_hash
|
|
4
|
-
|
|
5
|
-
properties.each do |property, expected_value|
|
|
6
|
-
expected = expected_value
|
|
7
|
-
actual = @parsed_files[file - 1].feature.background.send(property.to_sym).to_s
|
|
8
|
-
|
|
9
|
-
actual.should == expected
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
Then /^the(?: feature "([^"]*)")? background has the following description:/ do |file, text|
|
|
14
|
-
file ||= 1
|
|
15
|
-
|
|
16
|
-
expected = text
|
|
17
|
-
|
|
18
|
-
new_description = @parsed_files[file - 1].feature.background.description_text
|
|
19
|
-
old_description = @parsed_files[file - 1].feature.background.description
|
|
20
|
-
|
|
21
|
-
new_description.should == expected
|
|
22
|
-
old_description.should == remove_whitespace(expected)
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
Then /^the(?: feature "([^"]*)")? background's steps are as follows:$/ do |file, steps|
|
|
26
|
-
file ||= 1
|
|
27
|
-
|
|
28
|
-
steps = steps.raw.flatten.collect do |step|
|
|
29
|
-
if step.start_with? "'"
|
|
30
|
-
step.slice(1..step.length - 2)
|
|
31
|
-
else
|
|
32
|
-
step
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
actual_steps = Array.new.tap do |steps|
|
|
37
|
-
@parsed_files[file - 1].feature.background.steps.each do |step|
|
|
38
|
-
steps << step.base
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
expected = steps
|
|
43
|
-
actual = actual_steps.flatten
|
|
44
|
-
|
|
45
|
-
assert(actual == expected, "Expected: #{expected}\n but was: #{actual}")
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
When /^step "([^"]*)" of the background (?:of feature "([^"]*)" )?has the following block:$/ do |step, file, block|
|
|
49
|
-
file ||= 1
|
|
50
|
-
|
|
51
|
-
block = block.raw.flatten.collect do |line|
|
|
52
|
-
if line.start_with? "'"
|
|
53
|
-
line.slice(1..line.length - 2)
|
|
54
|
-
else
|
|
55
|
-
line
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
assert @parsed_files[file - 1].feature.background.steps[step - 1].block == block
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
Then(/^the(?: feature "([^"]*)")? background correctly stores its underlying implementation$/) do |file|
|
|
64
|
-
file ||= 1
|
|
65
|
-
|
|
66
|
-
raw_element = @parsed_files[file - 1].feature.background.raw_element
|
|
67
|
-
|
|
68
|
-
expected = 'Background'
|
|
69
|
-
if Gem.loaded_specs['gherkin'].version.version[/^3|4/]
|
|
70
|
-
actual = raw_element[:keyword]
|
|
71
|
-
else
|
|
72
|
-
actual = raw_element['keyword']
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
assert(actual == expected, "Expected: #{expected}\n but was: #{actual}")
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
Given(/^a background element based on the following gherkin:$/) do |background_text|
|
|
79
|
-
@element = CukeModeler::Background.new(background_text)
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
Then /^the background has convenient output$/ do
|
|
83
|
-
@parsed_files.first.feature.background.method(:to_s).owner.should == CukeModeler::Background
|
|
84
|
-
end
|
|
85
|
-
|
|
1
|
+
# No steps specific to this type of model
|
|
@@ -1,52 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
directory ||= 1
|
|
3
|
-
properties = properties.rows_hash
|
|
4
|
-
|
|
5
|
-
properties.each do |property, expected_value|
|
|
6
|
-
if property == 'path'
|
|
7
|
-
expected_value.sub!('path_to', @default_file_directory)
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
expected = expected_value
|
|
11
|
-
actual = @parsed_directories[directory - 1].send(property.to_sym).to_s
|
|
12
|
-
|
|
13
|
-
assert(actual == expected, "Expected: #{expected}\n but was: #{actual}")
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
When /^(?:the )?directory(?: "([^"]*)")? feature files are as follows:$/ do |directory, files|
|
|
18
|
-
directory ||= 1
|
|
19
|
-
|
|
20
|
-
actual_files = @parsed_directories[directory - 1].feature_files.collect { |file| file.name }
|
|
21
|
-
|
|
22
|
-
assert actual_files.flatten.sort == files.raw.flatten.sort
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
When /^(?:the )?directory(?: "([^"]*)")? directories are as follows:$/ do |directory, directories|
|
|
26
|
-
directory ||= 1
|
|
27
|
-
|
|
28
|
-
expected = directories.raw.flatten.sort
|
|
29
|
-
actual = @parsed_directories[directory - 1].directories.collect { |sub_directory| sub_directory.name }
|
|
30
|
-
|
|
31
|
-
assert(actual == expected, "Expected: #{expected}\n but was: #{actual}")
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
When /^(?:the )?directory(?: "([^"]*)")? has no directories$/ do |directory|
|
|
35
|
-
directory ||= 1
|
|
36
|
-
|
|
37
|
-
expected = []
|
|
38
|
-
actual = @parsed_directories[directory - 1].directories
|
|
39
|
-
|
|
40
|
-
assert(actual == expected, "Expected: #{expected}\n but was: #{actual}")
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
Given(/^a directory element based on "([^"]*)"$/) do |directory_name|
|
|
1
|
+
Given(/^a directory model based on "([^"]*)"$/) do |directory_name|
|
|
44
2
|
directory_path = "#{@default_file_directory}/#{directory_name}"
|
|
45
3
|
FileUtils.mkdir(directory_path) unless File.exists?(directory_path)
|
|
46
4
|
|
|
47
|
-
@
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
Then(/^the directory has convenient output$/) do
|
|
51
|
-
@parsed_directories.first.method(:to_s).owner.should == CukeModeler::Directory
|
|
5
|
+
@model = CukeModeler::Directory.new(directory_path)
|
|
52
6
|
end
|
|
@@ -1,67 +1 @@
|
|
|
1
|
-
|
|
2
|
-
file ||= 1
|
|
3
|
-
test ||= 1
|
|
4
|
-
step ||= 1
|
|
5
|
-
|
|
6
|
-
expected = type
|
|
7
|
-
actual = @parsed_files[file - 1].feature.tests[test - 1].steps[step - 1].block.content_type
|
|
8
|
-
|
|
9
|
-
assert(actual == expected, "Expected: #{expected}\n but was: #{actual}")
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
Then /^(?:the )?(?:feature "([^"]*)" )?(?:test(?: "([^"]*)")? )?(?:step(?: "([^"]*)") )?doc string has no content type$/ do |file, test, step|
|
|
13
|
-
file ||= 1
|
|
14
|
-
test ||= 1
|
|
15
|
-
step ||= 1
|
|
16
|
-
|
|
17
|
-
expected = nil
|
|
18
|
-
actual = @parsed_files[file - 1].feature.tests[test - 1].steps[step - 1].block.content_type
|
|
19
|
-
|
|
20
|
-
assert(actual == expected, "Expected: #{expected}\n but was: #{actual}")
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
Then /^(?:the )?(?:feature "([^"]*)" )?(?:test(?: "([^"]*)")? )?(?:step(?: "([^"]*)") )?doc string has the following contents:$/ do |file, test, step, contents|
|
|
24
|
-
file ||= 1
|
|
25
|
-
test ||= 1
|
|
26
|
-
step ||= 1
|
|
27
|
-
|
|
28
|
-
@parsed_files[file - 1].feature.tests[test - 1].steps[step - 1].block.contents_text.should == contents
|
|
29
|
-
# Remove once Array contents is no longer supported
|
|
30
|
-
@parsed_files[file - 1].feature.tests[test - 1].steps[step - 1].block.contents.should == contents.split("\n", -1)
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
Then /^(?:the )?(?:feature "([^"]*)" )?(?:test(?: "([^"]*)")? )?(?:step(?: "([^"]*)") )?doc string contents are empty$/ do |file, test, step|
|
|
34
|
-
file ||= 1
|
|
35
|
-
test ||= 1
|
|
36
|
-
step ||= 1
|
|
37
|
-
|
|
38
|
-
#todo Remove once Array contents is no longer supported
|
|
39
|
-
@parsed_files[file - 1].feature.tests[test - 1].steps[step - 1].block.contents.should be_empty
|
|
40
|
-
@parsed_files[file - 1].feature.tests[test - 1].steps[step - 1].block.contents_text.should be_empty
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
Then(/^(?:the )?(?:feature "([^"]*)" )?(?:test(?: "([^"]*)")? )?(?:step(?: "([^"]*)") )?doc string correctly stores its underlying implementation$/) do |file, test, step|
|
|
44
|
-
file ||= 1
|
|
45
|
-
test ||= 1
|
|
46
|
-
step ||= 1
|
|
47
|
-
|
|
48
|
-
raw_element = @parsed_files[file - 1].feature.tests[test - 1].steps[step - 1].block.raw_element
|
|
49
|
-
|
|
50
|
-
if Gem.loaded_specs['gherkin'].version.version[/^3|4/]
|
|
51
|
-
raw_element.has_key?(:contentType).should be_true
|
|
52
|
-
else
|
|
53
|
-
raw_element.has_key?('content_type').should be_true
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
Then(/^the doc string has convenient output$/) do
|
|
58
|
-
@parsed_files.first.feature.tests.first.steps.first.block.method(:to_s).owner.should == CukeModeler::DocString
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
Given(/^a doc string element based on the following gherkin:$/) do |doc_string_text|
|
|
62
|
-
@element = CukeModeler::DocString.new(doc_string_text)
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
Given(/^a doc string element based on the string "(.*)"$/) do |string|
|
|
66
|
-
@element = CukeModeler::DocString.new(string.gsub('\n', "\n"))
|
|
67
|
-
end
|
|
1
|
+
# No steps specific to this type of model
|
|
@@ -1,41 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
file ||= 1
|
|
3
|
-
properties = properties.rows_hash
|
|
4
|
-
|
|
5
|
-
properties.each do |property, expected_value|
|
|
6
|
-
if property == 'path'
|
|
7
|
-
expected_value.sub!('path_to', @test_directory)
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
expected = expected_value
|
|
11
|
-
actual = @parsed_files[file - 1].send(property.to_sym).to_s
|
|
12
|
-
|
|
13
|
-
assert(actual == expected, "Expected: #{expected}\n but was: #{actual}")
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
When /^(?:the )?file(?: "([^"]*)")? features are as follows:$/ do |file, feature|
|
|
18
|
-
file ||= 1
|
|
19
|
-
|
|
20
|
-
expected = feature.raw.flatten.first
|
|
21
|
-
actual = @parsed_files[file - 1].feature.name
|
|
22
|
-
|
|
23
|
-
assert(actual == expected, "Expected: #{expected}\n but was: #{actual}")
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
When /^(?:the )?file(?: "([^"]*)")? has no features$/ do |file|
|
|
27
|
-
file ||= 1
|
|
28
|
-
|
|
29
|
-
assert @parsed_files[file - 1].feature.nil?
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
Then(/^the feature file has convenient output$/) do
|
|
33
|
-
@parsed_files.first.method(:to_s).owner.should == CukeModeler::FeatureFile
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
Given(/^a feature file element based on "([^"]*)"$/) do |file_name|
|
|
1
|
+
Given(/^a feature file model based on "([^"]*)"$/) do |file_name|
|
|
37
2
|
file_path = "#{@default_file_directory}/#{file_name}"
|
|
38
3
|
File.open(file_path, 'w') { |file| file.puts "Feature:" } unless File.exists?(file_path)
|
|
39
4
|
|
|
40
|
-
@
|
|
5
|
+
@model = CukeModeler::FeatureFile.new(file_path)
|
|
41
6
|
end
|
|
@@ -1,103 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
properties = properties.rows_hash
|
|
4
|
-
|
|
5
|
-
properties.each do |property, expected_value|
|
|
6
|
-
expected = expected_value
|
|
7
|
-
actual = @parsed_files[file - 1].feature.send(property.to_sym).to_s
|
|
8
|
-
|
|
9
|
-
assert(actual == expected, "Expected #{property} to be: #{expected}\n but was: #{actual}")
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
Then /^(?:the )?feature "([^"]*)" has the following description:$/ do |file, text|
|
|
14
|
-
new_description = @parsed_files[file - 1].feature.description_text
|
|
15
|
-
old_description = @parsed_files[file - 1].feature.description
|
|
16
|
-
|
|
17
|
-
new_description.should == text
|
|
18
|
-
old_description.should == remove_whitespace(text)
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
Then /^feature "([^"]*)" is found to have the following tags:$/ do |file, expected_tags|
|
|
22
|
-
expected_tags = expected_tags.raw.flatten
|
|
23
|
-
|
|
24
|
-
@parsed_files[file - 1].feature.tags.should == expected_tags
|
|
25
|
-
@parsed_files[file - 1].feature.tag_elements.collect { |tag| tag.name }.should == expected_tags
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
Then /^feature "([^"]*)" has no description$/ do |file|
|
|
29
|
-
@parsed_files[file - 1].feature.description_text.should == ''
|
|
30
|
-
@parsed_files[file - 1].feature.description.should == []
|
|
1
|
+
And(/^the \w+ model of that feature model$/) do |code_text|
|
|
2
|
+
eval(code_text)
|
|
31
3
|
end
|
|
32
4
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
assert @parsed_files[file - 1].feature.tag_elements.collect { |tag| tag.name } == []
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
When /^(?:the )?feature(?: "([^"]*)")? scenarios are as follows:$/ do |file, scenarios|
|
|
39
|
-
file ||= 1
|
|
40
|
-
|
|
41
|
-
actual_scenarios = @parsed_files[file - 1].feature.scenarios.collect { |scenario| scenario.name }
|
|
42
|
-
|
|
43
|
-
assert actual_scenarios.flatten.sort == scenarios.raw.flatten.sort
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
When /^(?:the )?feature(?: "([^"]*)")? outlines are as follows:$/ do |file, outlines|
|
|
47
|
-
file ||= 1
|
|
48
|
-
|
|
49
|
-
actual_outlines = @parsed_files[file - 1].feature.outlines.collect { |outline| outline.name }
|
|
50
|
-
|
|
51
|
-
expected = outlines.raw.flatten.sort
|
|
52
|
-
actual = actual_outlines.flatten.sort
|
|
53
|
-
|
|
54
|
-
assert(actual == expected, "Expected: #{expected}\n but was: #{actual}")
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
When /^(?:the )?feature(?: "([^"]*)")? background is as follows:$/ do |file, background|
|
|
58
|
-
file ||= 1
|
|
59
|
-
|
|
60
|
-
@parsed_files[file - 1].feature.background.name.should == background.raw.flatten.first
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
When /^feature "([^"]*)" has no scenarios$/ do |file|
|
|
64
|
-
assert @parsed_files[file - 1].feature.scenarios == []
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
When /^feature "([^"]*)" has no outlines/ do |file|
|
|
68
|
-
assert @parsed_files[file - 1].feature.outlines == []
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
When /^feature "([^"]*)" has no background/ do |file|
|
|
72
|
-
assert @parsed_files[file - 1].feature.has_background? == false
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
Then /^(?:the )?feature(?: "([^"]*)")? correctly stores its underlying implementation$/ do |file|
|
|
76
|
-
file ||= 1
|
|
77
|
-
|
|
78
|
-
raw_element = @parsed_files[file - 1].feature.raw_element
|
|
79
|
-
|
|
80
|
-
case
|
|
81
|
-
when Gem.loaded_specs['gherkin'].version.version[/^4/]
|
|
82
|
-
expect(raw_element).to have_key(:children)
|
|
83
|
-
when Gem.loaded_specs['gherkin'].version.version[/^3/]
|
|
84
|
-
expect(raw_element).to have_key(:scenarioDefinitions)
|
|
85
|
-
else
|
|
86
|
-
expect(raw_element).to have_key('elements')
|
|
87
|
-
end
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
Then(/^the feature has convenient output$/) do
|
|
91
|
-
@parsed_files.first.feature.method(:to_s).owner.should == CukeModeler::Feature
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
Given(/^a feature element based on the following gherkin:$/) do |feature_text|
|
|
95
|
-
@element = CukeModeler::Feature.new(feature_text)
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
def remove_whitespace(text)
|
|
99
|
-
stripped_text = text.split("\n").collect { |line| line.strip }
|
|
100
|
-
stripped_text.delete('')
|
|
101
|
-
|
|
102
|
-
stripped_text
|
|
5
|
+
And(/^the \w+(?: \w+)? model inside of that feature model$/) do |code_text|
|
|
6
|
+
eval(code_text)
|
|
103
7
|
end
|