cucumber_analytics 1.4.2 → 1.5.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.
- data/History.rdoc +7 -0
- data/README.rdoc +4 -0
- data/Rakefile +1 -1
- data/cucumber_analytics.gemspec +3 -1
- data/features/modeling/background_modeling.feature +27 -13
- data/features/modeling/background_output.feature +130 -0
- data/features/modeling/directory_modeling.feature +11 -6
- data/features/modeling/directory_output.feature +13 -0
- data/features/modeling/doc_string_modeling.feature +18 -11
- data/features/modeling/doc_string_output.feature +71 -0
- data/features/modeling/example_modeling.feature +30 -19
- data/features/modeling/example_output.feature +192 -0
- data/features/modeling/feature_file_modeling.feature +9 -4
- data/features/modeling/feature_file_output.feature +13 -0
- data/features/modeling/feature_modeling.feature +33 -20
- data/features/modeling/feature_output.feature +244 -0
- data/features/modeling/outline_modeling.feature +29 -16
- data/features/modeling/outline_output.feature +197 -0
- data/features/modeling/row_modeling.feature +9 -4
- data/features/modeling/row_output.feature +27 -0
- data/features/modeling/scenario_modeling.feature +27 -14
- data/features/modeling/scenario_output.feature +147 -0
- data/features/modeling/step_modeling.feature +13 -8
- data/features/modeling/step_output.feature +52 -0
- data/features/modeling/table_modeling.feature +9 -4
- data/features/modeling/table_output.feature +42 -0
- data/features/modeling/table_row_modeling.feature +9 -4
- data/features/modeling/table_row_output.feature +27 -0
- data/features/modeling/tag_modeling.feature +10 -5
- data/features/modeling/tag_output.feature +16 -0
- data/features/step_definitions/action_steps.rb +3 -0
- data/features/step_definitions/background_steps.rb +17 -4
- data/features/step_definitions/directory_steps.rb +11 -0
- data/features/step_definitions/doc_string_steps.rb +18 -15
- data/features/step_definitions/feature_file_steps.rb +12 -1
- data/features/step_definitions/feature_steps.rb +23 -6
- data/features/step_definitions/outline_steps.rb +70 -9
- data/features/step_definitions/step_steps.rb +9 -1
- data/features/step_definitions/table_steps.rb +35 -2
- data/features/step_definitions/tag_steps.rb +8 -0
- data/features/step_definitions/test_steps.rb +14 -3
- data/features/step_definitions/verification_steps.rb +9 -0
- data/features/support/env.rb +1 -0
- data/lib/cucumber_analytics/background.rb +12 -0
- data/lib/cucumber_analytics/directory.rb +5 -0
- data/lib/cucumber_analytics/doc_string.rb +22 -0
- data/lib/cucumber_analytics/example.rb +55 -0
- data/lib/cucumber_analytics/feature.rb +26 -0
- data/lib/cucumber_analytics/feature_element.rb +25 -1
- data/lib/cucumber_analytics/feature_file.rb +5 -0
- data/lib/cucumber_analytics/outline.rb +18 -0
- data/lib/cucumber_analytics/parsing.rb +3 -1
- data/lib/cucumber_analytics/row.rb +5 -0
- data/lib/cucumber_analytics/scenario.rb +13 -0
- data/lib/cucumber_analytics/step.rb +8 -0
- data/lib/cucumber_analytics/table.rb +21 -0
- data/lib/cucumber_analytics/table_row.rb +5 -0
- data/lib/cucumber_analytics/tag.rb +5 -0
- data/lib/cucumber_analytics/taggable.rb +4 -0
- data/lib/cucumber_analytics/test_element.rb +8 -0
- data/lib/cucumber_analytics/version.rb +1 -1
- data/spec/integration/background_integration_spec.rb +12 -0
- data/spec/integration/example_integration_spec.rb +21 -0
- data/spec/integration/feature_integration_spec.rb +29 -0
- data/spec/integration/outline_integration_spec.rb +22 -0
- data/spec/integration/scenario_integration_spec.rb +16 -0
- data/spec/integration/step_integration_spec.rb +20 -0
- data/spec/integration/table_integration_spec.rb +11 -0
- data/spec/unit/background_unit_spec.rb +28 -0
- data/spec/unit/directory_unit_spec.rb +12 -0
- data/spec/unit/doc_string_unit_spec.rb +43 -3
- data/spec/unit/example_unit_spec.rb +53 -0
- data/spec/unit/feature_element_unit_specs.rb +9 -2
- data/spec/unit/feature_file_unit_spec.rb +12 -0
- data/spec/unit/feature_unit_spec.rb +30 -0
- data/spec/unit/outline_unit_spec.rb +30 -0
- data/spec/unit/row_unit_spec.rb +19 -7
- data/spec/unit/scenario_unit_spec.rb +30 -0
- data/spec/unit/step_unit_spec.rb +25 -1
- data/spec/unit/table_row_unit_spec.rb +12 -0
- data/spec/unit/table_unit_spec.rb +25 -0
- data/spec/unit/tag_unit_spec.rb +12 -0
- metadata +165 -86
- checksums.yaml +0 -15
@@ -3,13 +3,15 @@ Feature: Step elements can be modeled.
|
|
3
3
|
|
4
4
|
Acceptance criteria
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
6
|
+
1. All conceptual pieces of a step can be modeled:
|
7
|
+
- the step's keyword
|
8
|
+
- the text of the step
|
9
|
+
- the step's arguments, if any
|
10
|
+
- the step's associated block, if any
|
11
|
+
- the step's source line
|
12
|
+
- the step's raw element
|
13
|
+
|
14
|
+
2. Steps can be outputted in a convenient form
|
13
15
|
|
14
16
|
|
15
17
|
Background: Test file setup.
|
@@ -68,8 +70,11 @@ Feature: Step elements can be modeled.
|
|
68
70
|
And step "3" has a "table"
|
69
71
|
And step "4" has no block
|
70
72
|
|
73
|
+
Scenario: Convenient output of a step
|
74
|
+
Then the step has convenient output
|
75
|
+
|
71
76
|
Scenario Outline: Step models pass all other specifications
|
72
|
-
Exact specifications detailing the API for
|
77
|
+
Exact specifications detailing the API for step models.
|
73
78
|
Given that there are "<additional specifications>" detailing models
|
74
79
|
When the corresponding specifications are run
|
75
80
|
Then all of those specifications are met
|
@@ -0,0 +1,52 @@
|
|
1
|
+
Feature: Outputting step elements
|
2
|
+
|
3
|
+
The output of an element model is a representation of the element as it would
|
4
|
+
appear in gherkin.
|
5
|
+
|
6
|
+
|
7
|
+
Scenario: Output of a step without a block
|
8
|
+
Given a step element based on the following gherkin:
|
9
|
+
"""
|
10
|
+
* a step
|
11
|
+
"""
|
12
|
+
When it is outputted
|
13
|
+
Then the following text is provided:
|
14
|
+
"""
|
15
|
+
* a step
|
16
|
+
"""
|
17
|
+
|
18
|
+
Scenario: Output of a step with a doc string
|
19
|
+
Given a step element based on the following gherkin:
|
20
|
+
"""
|
21
|
+
* a step
|
22
|
+
\"\"\"
|
23
|
+
Some text
|
24
|
+
|
25
|
+
some more text
|
26
|
+
\"\"\"
|
27
|
+
"""
|
28
|
+
When it is outputted
|
29
|
+
Then the following text is provided:
|
30
|
+
"""
|
31
|
+
* a step
|
32
|
+
\"\"\"
|
33
|
+
Some text
|
34
|
+
|
35
|
+
some more text
|
36
|
+
\"\"\"
|
37
|
+
"""
|
38
|
+
|
39
|
+
Scenario: Output of a step with a table
|
40
|
+
Given a step element based on the following gherkin:
|
41
|
+
"""
|
42
|
+
* a step
|
43
|
+
|value1|
|
44
|
+
|value2|
|
45
|
+
"""
|
46
|
+
When it is outputted
|
47
|
+
Then the following text is provided:
|
48
|
+
"""
|
49
|
+
* a step
|
50
|
+
| value1 |
|
51
|
+
| value2 |
|
52
|
+
"""
|
@@ -3,9 +3,11 @@ Feature: Table elements can be modeled.
|
|
3
3
|
|
4
4
|
Acceptance criteria
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
1. All conceptual pieces of a table can be modeled:
|
7
|
+
- the table's contents
|
8
|
+
- the table's raw element
|
9
|
+
|
10
|
+
2. Tables can be outputted in a convenient form
|
9
11
|
|
10
12
|
|
11
13
|
Background: Test file setup.
|
@@ -35,8 +37,11 @@ Feature: Table elements can be modeled.
|
|
35
37
|
Scenario: The raw table element is modeled.
|
36
38
|
Then the table correctly stores its underlying implementation
|
37
39
|
|
40
|
+
Scenario: Convenient output of a table
|
41
|
+
Then the table has convenient output
|
42
|
+
|
38
43
|
Scenario Outline: Table models pass all other specifications
|
39
|
-
Exact specifications detailing the API for
|
44
|
+
Exact specifications detailing the API for table models.
|
40
45
|
Given that there are "<additional specifications>" detailing models
|
41
46
|
When the corresponding specifications are run
|
42
47
|
Then all of those specifications are met
|
@@ -0,0 +1,42 @@
|
|
1
|
+
Feature: Outputting table elements
|
2
|
+
|
3
|
+
The output of an element model is a representation of the element as it would
|
4
|
+
appear in gherkin.
|
5
|
+
|
6
|
+
|
7
|
+
Scenario: Output of a table that has one row
|
8
|
+
Given a table element based on the following gherkin:
|
9
|
+
"""
|
10
|
+
|value|
|
11
|
+
"""
|
12
|
+
When it is outputted
|
13
|
+
Then the following text is provided:
|
14
|
+
"""
|
15
|
+
| value |
|
16
|
+
"""
|
17
|
+
|
18
|
+
Scenario: Output of a table that has multiple rows
|
19
|
+
Given a table element based on the following gherkin:
|
20
|
+
"""
|
21
|
+
|value1|
|
22
|
+
|value2|
|
23
|
+
"""
|
24
|
+
When it is outputted
|
25
|
+
Then the following text is provided:
|
26
|
+
"""
|
27
|
+
| value1 |
|
28
|
+
| value2 |
|
29
|
+
"""
|
30
|
+
|
31
|
+
Scenario: Whitespace buffers are based on the longest value in a column
|
32
|
+
Given a table element based on the following gherkin:
|
33
|
+
"""
|
34
|
+
|value|x|
|
35
|
+
|y|another_value|
|
36
|
+
"""
|
37
|
+
When it is outputted
|
38
|
+
Then the following text is provided:
|
39
|
+
"""
|
40
|
+
| value | x |
|
41
|
+
| y | another_value |
|
42
|
+
"""
|
@@ -3,10 +3,12 @@ Feature: Table Row elements can be modeled.
|
|
3
3
|
|
4
4
|
Acceptance criteria
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
1. All conceptual pieces of a table row can be modeled:
|
7
|
+
- the row's source line
|
8
|
+
- the row's cells
|
9
|
+
- the row's raw element
|
10
|
+
|
11
|
+
2. Rows can be outputted in a convenient form
|
10
12
|
|
11
13
|
|
12
14
|
Background: Test file setup.
|
@@ -50,6 +52,9 @@ Feature: Table Row elements can be modeled.
|
|
50
52
|
And step "2" table row "2" cells are as follows:
|
51
53
|
| value 2 |
|
52
54
|
|
55
|
+
Scenario: Convenient output of a table row
|
56
|
+
Then the table row has convenient output
|
57
|
+
|
53
58
|
Scenario Outline: Table row models pass all other specifications
|
54
59
|
Exact specifications detailing the API for table table row models.
|
55
60
|
Given that there are "<additional specifications>" detailing models
|
@@ -0,0 +1,27 @@
|
|
1
|
+
Feature: Outputting table row elements
|
2
|
+
|
3
|
+
The output of an element model is a representation of the element as it would
|
4
|
+
appear in gherkin.
|
5
|
+
|
6
|
+
|
7
|
+
Scenario: Output of a table row that has one cell
|
8
|
+
Given a table row element based on the following gherkin:
|
9
|
+
"""
|
10
|
+
|value|
|
11
|
+
"""
|
12
|
+
When it is outputted
|
13
|
+
Then the following text is provided:
|
14
|
+
"""
|
15
|
+
| value |
|
16
|
+
"""
|
17
|
+
|
18
|
+
Scenario: Output of a table row that has multiple cells
|
19
|
+
Given a table row element based on the following gherkin:
|
20
|
+
"""
|
21
|
+
|value|another_value|
|
22
|
+
"""
|
23
|
+
When it is outputted
|
24
|
+
Then the following text is provided:
|
25
|
+
"""
|
26
|
+
| value | another_value |
|
27
|
+
"""
|
@@ -3,10 +3,12 @@ Feature: Tag elements can be modeled.
|
|
3
3
|
|
4
4
|
Acceptance criteria
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
1. All conceptual pieces of a tag can be modeled:
|
7
|
+
- the tag's name
|
8
|
+
- the tags's source line
|
9
|
+
- the tags's raw element
|
10
|
+
|
11
|
+
2. Features can be outputted in a convenient form
|
10
12
|
|
11
13
|
|
12
14
|
Background: Test file setup.
|
@@ -41,8 +43,11 @@ Feature: Tag elements can be modeled.
|
|
41
43
|
And the test tag name is "@outline_tag"
|
42
44
|
And the example tag name is "@example_tag"
|
43
45
|
|
46
|
+
Scenario: Convenient output of a tag
|
47
|
+
Then the tag has convenient output
|
48
|
+
|
44
49
|
Scenario Outline: Tag models pass all other specifications
|
45
|
-
Exact specifications detailing the API for
|
50
|
+
Exact specifications detailing the API for tag models.
|
46
51
|
Given that there are "<additional specifications>" detailing models
|
47
52
|
When the corresponding specifications are run
|
48
53
|
Then all of those specifications are met
|
@@ -0,0 +1,16 @@
|
|
1
|
+
Feature: Outputting tag elements
|
2
|
+
|
3
|
+
The output of an element model is a representation of the element as it would
|
4
|
+
appear in gherkin.
|
5
|
+
|
6
|
+
|
7
|
+
Scenario: Output of a tag that has a name
|
8
|
+
Given a tag element based on the following gherkin:
|
9
|
+
"""
|
10
|
+
@some_tag
|
11
|
+
"""
|
12
|
+
When it is outputted
|
13
|
+
Then the following text is provided:
|
14
|
+
"""
|
15
|
+
@some_tag
|
16
|
+
"""
|
@@ -10,12 +10,16 @@ Then /^the(?: feature "([^"]*)")? background is found to have the following prop
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
-
Then /^the(?: feature "([^"]*)")? background
|
13
|
+
Then /^the(?: feature "([^"]*)")? background has the following description:/ do |file, text|
|
14
14
|
file ||= 1
|
15
|
-
expected_description = lines.raw.flatten
|
16
|
-
actual_description = @parsed_files[file - 1].feature.background.description
|
17
15
|
|
18
|
-
|
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)
|
19
23
|
end
|
20
24
|
|
21
25
|
Then /^the(?: feature "([^"]*)")? background's steps are as follows:$/ do |file, steps|
|
@@ -66,3 +70,12 @@ Then(/^the(?: feature "([^"]*)")? background correctly stores its underlying imp
|
|
66
70
|
|
67
71
|
assert(actual == expected, "Expected: #{expected}\n but was: #{actual}")
|
68
72
|
end
|
73
|
+
|
74
|
+
Given(/^a background element based on the following gherkin:$/) do |background_text|
|
75
|
+
@element = CucumberAnalytics::Background.new(background_text)
|
76
|
+
end
|
77
|
+
|
78
|
+
Then /^the background has convenient output$/ do
|
79
|
+
@parsed_files.first.feature.background.method(:to_s).owner.should == CucumberAnalytics::Background
|
80
|
+
end
|
81
|
+
|
@@ -39,3 +39,14 @@ When /^(?:the )?directory(?: "([^"]*)")? has no directories$/ do |directory|
|
|
39
39
|
|
40
40
|
assert(actual == expected, "Expected: #{expected}\n but was: #{actual}")
|
41
41
|
end
|
42
|
+
|
43
|
+
Given(/^a directory element based on "([^"]*)"$/) do |directory_name|
|
44
|
+
directory_path = "#{@default_file_directory}/#{directory_name}"
|
45
|
+
FileUtils.mkdir(directory_path) unless File.exists?(directory_path)
|
46
|
+
|
47
|
+
@element = CucumberAnalytics::Directory.new(directory_path)
|
48
|
+
end
|
49
|
+
|
50
|
+
Then(/^the directory has convenient output$/) do
|
51
|
+
@parsed_directories.first.method(:to_s).owner.should == CucumberAnalytics::Directory
|
52
|
+
end
|
@@ -25,17 +25,9 @@ Then /^(?:the )?(?:feature "([^"]*)" )?(?:test(?: "([^"]*)")? )?(?:step(?: "([^"
|
|
25
25
|
test ||= 1
|
26
26
|
step ||= 1
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
else
|
32
|
-
cell_value
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
actual = @parsed_files[file - 1].feature.tests[test - 1].steps[step - 1].block.contents
|
37
|
-
|
38
|
-
assert(actual == expected, "Expected: #{expected}\n but was: #{actual}")
|
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)
|
39
31
|
end
|
40
32
|
|
41
33
|
Then /^(?:the )?(?:feature "([^"]*)" )?(?:test(?: "([^"]*)")? )?(?:step(?: "([^"]*)") )?doc string contents are empty$/ do |file, test, step|
|
@@ -43,10 +35,9 @@ Then /^(?:the )?(?:feature "([^"]*)" )?(?:test(?: "([^"]*)")? )?(?:step(?: "([^"
|
|
43
35
|
test ||= 1
|
44
36
|
step ||= 1
|
45
37
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
assert(actual == expected, "Expected: #{expected}\n but was: #{actual}")
|
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
|
50
41
|
end
|
51
42
|
|
52
43
|
Then(/^(?:the )?(?:feature "([^"]*)" )?(?:test(?: "([^"]*)")? )?(?:step(?: "([^"]*)") )?doc string correctly stores its underlying implementation$/) do |file, test, step|
|
@@ -58,3 +49,15 @@ Then(/^(?:the )?(?:feature "([^"]*)" )?(?:test(?: "([^"]*)")? )?(?:step(?: "([^"
|
|
58
49
|
|
59
50
|
raw_element.has_key?('content_type').should be_true
|
60
51
|
end
|
52
|
+
|
53
|
+
Then(/^the doc string has convenient output$/) do
|
54
|
+
@parsed_files.first.feature.tests.first.steps.first.block.method(:to_s).owner.should == CucumberAnalytics::DocString
|
55
|
+
end
|
56
|
+
|
57
|
+
Given(/^a doc string element based on the following gherkin:$/) do |doc_string_text|
|
58
|
+
@element = CucumberAnalytics::DocString.new(doc_string_text)
|
59
|
+
end
|
60
|
+
|
61
|
+
Given(/^a doc string element based on the string "(.*)"$/) do |string|
|
62
|
+
@element = CucumberAnalytics::DocString.new(string.gsub('\n', "\n"))
|
63
|
+
end
|
@@ -27,4 +27,15 @@ When /^(?:the )?file(?: "([^"]*)")? has no features$/ do |file|
|
|
27
27
|
file ||= 1
|
28
28
|
|
29
29
|
assert @parsed_files[file - 1].feature.nil?
|
30
|
-
end
|
30
|
+
end
|
31
|
+
|
32
|
+
Then(/^the feature file has convenient output$/) do
|
33
|
+
@parsed_files.first.method(:to_s).owner.should == CucumberAnalytics::FeatureFile
|
34
|
+
end
|
35
|
+
|
36
|
+
Given(/^a feature file element based on "([^"]*)"$/) do |file_name|
|
37
|
+
file_path = "#{@default_file_directory}/#{file_name}"
|
38
|
+
File.open(file_path, 'w') { |file| file.puts "Feature:" } unless File.exists?(file_path)
|
39
|
+
|
40
|
+
@element = CucumberAnalytics::FeatureFile.new(file_path)
|
41
|
+
end
|
@@ -10,11 +10,12 @@ Then /^(?:the )?feature(?: "([^"]*)")? is found to have the following properties
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
-
Then /^the
|
14
|
-
|
15
|
-
|
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
16
|
|
17
|
-
|
17
|
+
new_description.should == text
|
18
|
+
old_description.should == remove_whitespace(text)
|
18
19
|
end
|
19
20
|
|
20
21
|
Then /^feature "([^"]*)" is found to have the following tags:$/ do |file, expected_tags|
|
@@ -24,8 +25,9 @@ Then /^feature "([^"]*)" is found to have the following tags:$/ do |file, expect
|
|
24
25
|
@parsed_files[file - 1].feature.tag_elements.collect { |tag| tag.name }.should == expected_tags
|
25
26
|
end
|
26
27
|
|
27
|
-
Then /^feature "([^"]*)" has no
|
28
|
-
|
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 == []
|
29
31
|
end
|
30
32
|
|
31
33
|
Then /^feature "([^"]*)" has no tags$/ do |file|
|
@@ -77,3 +79,18 @@ Then /^(?:the )?feature(?: "([^"]*)")? correctly stores its underlying implement
|
|
77
79
|
|
78
80
|
raw_element.has_key?('elements').should be_true
|
79
81
|
end
|
82
|
+
|
83
|
+
Then(/^the feature has convenient output$/) do
|
84
|
+
@parsed_files.first.feature.method(:to_s).owner.should == CucumberAnalytics::Feature
|
85
|
+
end
|
86
|
+
|
87
|
+
Given(/^a feature element based on the following gherkin:$/) do |feature_text|
|
88
|
+
@element = CucumberAnalytics::Feature.new(feature_text)
|
89
|
+
end
|
90
|
+
|
91
|
+
def remove_whitespace(text)
|
92
|
+
stripped_text = text.split("\n").collect { |line| line.strip }
|
93
|
+
stripped_text.delete('')
|
94
|
+
|
95
|
+
stripped_text
|
96
|
+
end
|
@@ -16,7 +16,7 @@ Then /^(?:the )?(?:feature "([^"]*)" )?test(?: "([^"]*)")? example block(?: "([^
|
|
16
16
|
properties = properties.rows_hash
|
17
17
|
|
18
18
|
properties.each do |property, value|
|
19
|
-
|
19
|
+
@parsed_files[file - 1].feature.tests[test - 1].examples[example - 1].send(property.to_sym).to_s.should == value
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
@@ -36,14 +36,28 @@ Then /^(?:the )?(?:feature "([^"]*)" )?test(?: "([^"]*)")? example block(?: "([^
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
Then /^(?:the )?(?:feature "([^"]*)" )?test(?: "([^"]*)")? example block(?: "([^"]*)")?
|
39
|
+
Then /^(?:the )?(?:feature "([^"]*)" )?test(?: "([^"]*)")? example block(?: "([^"]*)")? has the following description:$/ do |file, test, example, text|
|
40
40
|
file ||= 1
|
41
41
|
test ||= 1
|
42
42
|
example ||= 1
|
43
43
|
|
44
|
-
|
44
|
+
new_description = @parsed_files[file - 1].feature.tests[test - 1].examples[example - 1].description_text
|
45
|
+
old_description = @parsed_files[file - 1].feature.tests[test - 1].examples[example - 1].description
|
45
46
|
|
46
|
-
|
47
|
+
new_description.should == text
|
48
|
+
old_description.should == remove_whitespace(text)
|
49
|
+
end
|
50
|
+
|
51
|
+
Then /^(?:the )?(?:feature "([^"]*)" )?test(?: "([^"]*)")? example block(?: "([^"]*)")? has no description$/ do |file, test, example|
|
52
|
+
file ||= 1
|
53
|
+
test ||= 1
|
54
|
+
example ||= 1
|
55
|
+
|
56
|
+
new_description = @parsed_files[file - 1].feature.tests[test - 1].examples[example - 1].description_text
|
57
|
+
old_description = @parsed_files[file - 1].feature.tests[test - 1].examples[example - 1].description
|
58
|
+
|
59
|
+
new_description.should == ''
|
60
|
+
old_description.should == []
|
47
61
|
end
|
48
62
|
|
49
63
|
Then /^(?:the )?(?:feature "([^"]*)" )?test(?: "([^"]*)")? example block(?: "([^"]*)")? is found to have the following tags:$/ do |file, test, example, expected_tags|
|
@@ -86,9 +100,13 @@ Then /^(?:the )?(?:feature "([^"]*)" )?test(?: "([^"]*)")? example block(?: "([^
|
|
86
100
|
example = @parsed_files[file - 1].feature.tests[test - 1].examples[example - 1]
|
87
101
|
|
88
102
|
expected = rows.collect { |row| row.split(',') }
|
89
|
-
actual = example.row_elements[1..example.row_elements.count].collect { |row| row.cells }
|
90
103
|
|
104
|
+
actual = example.row_elements[1..example.row_elements.count].collect { |row| row.cells }
|
91
105
|
assert(actual == expected, "Expected: #{expected}\n but was: #{actual}")
|
106
|
+
|
107
|
+
# todo - remove once Hash rows are no longer supported
|
108
|
+
actual = example.rows.collect { |row| example.parameters.collect { |parameter| row[parameter] } }
|
109
|
+
assert(actual == expected, "Expected: #{expected.inspect}\n but was: #{actual.inspect}")
|
92
110
|
end
|
93
111
|
|
94
112
|
When /^(?:the )?(?:feature "([^"]*)" )?test(?: "([^"]*)")? example block(?: "([^"]*)")? has the following rows added to it:$/ do |file, test, example, rows|
|
@@ -163,10 +181,9 @@ Then /^(?:the )?(?:feature "([^"]*)" )?test(?: "([^"]*)")? example block(?: "([^
|
|
163
181
|
|
164
182
|
example = @parsed_files[file - 1].feature.tests[test - 1].examples[example - 1]
|
165
183
|
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
assert(actual == expected, "Expected: #{expected}\n but was: #{actual}")
|
184
|
+
example.row_elements[1..example.row_elements.count].should be_empty
|
185
|
+
#todo - remove once Hash rows are no longer supported
|
186
|
+
example.rows.should be_empty
|
170
187
|
end
|
171
188
|
|
172
189
|
Then /^(?:the )?(?:feature "([^"]*)" )?test(?: "([^"]*)")? example block(?: "([^"]*)")? row(?: "([^"]*)")? correctly stores its underlying implementation$/ do |file, test, example, row|
|
@@ -189,3 +206,47 @@ Then /^(?:the )?(?:feature "([^"]*)" )?test(?: "([^"]*)")? example block(?: "([^
|
|
189
206
|
|
190
207
|
raw_element.has_key?('rows').should be_true
|
191
208
|
end
|
209
|
+
|
210
|
+
Then(/^the row has convenient output$/) do
|
211
|
+
@parsed_files.first.feature.tests.first.examples.first.row_elements.first.method(:to_s).owner.should == CucumberAnalytics::Row
|
212
|
+
end
|
213
|
+
|
214
|
+
Given(/^a row element based on the following gherkin:$/) do |row_text|
|
215
|
+
@element = CucumberAnalytics::Row.new(row_text)
|
216
|
+
end
|
217
|
+
|
218
|
+
Given(/^a row element$/) do
|
219
|
+
@element = CucumberAnalytics::Row.new
|
220
|
+
end
|
221
|
+
|
222
|
+
When(/^the row element has no cells$/) do
|
223
|
+
@element.cells = []
|
224
|
+
end
|
225
|
+
|
226
|
+
Then(/^the example block has convenient output$/) do
|
227
|
+
@parsed_files.first.feature.tests.first.examples.first.method(:to_s).owner.should == CucumberAnalytics::Example
|
228
|
+
end
|
229
|
+
|
230
|
+
Given(/^an example element based on the following gherkin:$/) do |example_text|
|
231
|
+
@element = CucumberAnalytics::Example.new(example_text)
|
232
|
+
end
|
233
|
+
|
234
|
+
Given(/^an example element$/) do
|
235
|
+
@element = CucumberAnalytics::Example.new
|
236
|
+
end
|
237
|
+
|
238
|
+
When(/^the example element has no parameters or rows$/) do
|
239
|
+
@element.parameters = []
|
240
|
+
|
241
|
+
#todo - remove once Hash rows are no longer supported
|
242
|
+
@element.rows = []
|
243
|
+
@element.row_elements = []
|
244
|
+
end
|
245
|
+
|
246
|
+
Then(/^the outline has convenient output$/) do
|
247
|
+
@parsed_files.first.feature.tests.first.method(:to_s).owner.should == CucumberAnalytics::Outline
|
248
|
+
end
|
249
|
+
|
250
|
+
Given(/^an outline element based on the following gherkin:$/) do |outline_text|
|
251
|
+
@element = CucumberAnalytics::Outline.new(outline_text)
|
252
|
+
end
|