cucumber_analytics 1.5.1 → 1.5.2
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 +6 -0
- data/Rakefile +10 -27
- data/cucumber_analytics.gemspec +1 -0
- data/features/modeling/background_modeling.feature +0 -11
- data/features/modeling/directory_modeling.feature +0 -11
- data/features/modeling/doc_string_modeling.feature +0 -11
- data/features/modeling/example_modeling.feature +0 -11
- data/features/modeling/feature_file_modeling.feature +0 -11
- data/features/modeling/feature_modeling.feature +0 -11
- data/features/modeling/outline_modeling.feature +0 -11
- data/features/modeling/row_modeling.feature +0 -10
- data/features/modeling/scenario_modeling.feature +0 -11
- data/features/modeling/step_modeling.feature +0 -11
- data/features/modeling/table_modeling.feature +0 -11
- data/features/modeling/table_row_modeling.feature +0 -11
- data/features/modeling/tag_modeling.feature +0 -11
- data/features/step_definitions/background_steps.rb +4 -4
- data/features/step_definitions/directory_steps.rb +1 -1
- data/features/step_definitions/doc_string_steps.rb +6 -6
- data/features/step_definitions/feature_file_steps.rb +1 -1
- data/features/step_definitions/feature_steps.rb +11 -11
- data/features/step_definitions/outline_steps.rb +18 -18
- data/features/step_definitions/step_steps.rb +6 -6
- data/features/step_definitions/table_steps.rb +6 -6
- data/features/step_definitions/tag_steps.rb +10 -10
- data/features/step_definitions/test_steps.rb +8 -8
- data/features/step_definitions/verification_steps.rb +2 -2
- data/features/step_definitions/world_steps.rb +8 -8
- data/lib/cucumber_analytics/step.rb +3 -1
- data/lib/cucumber_analytics/test_element.rb +2 -0
- data/lib/cucumber_analytics/version.rb +1 -1
- data/spec/integration/background_integration_spec.rb +5 -5
- data/spec/integration/directory_integration_spec.rb +4 -4
- data/spec/integration/doc_string_integration_spec.rb +6 -6
- data/spec/integration/example_integration_spec.rb +8 -8
- data/spec/integration/feature_file_integration_spec.rb +3 -3
- data/spec/integration/feature_integration_spec.rb +15 -15
- data/spec/integration/outline_integration_spec.rb +7 -7
- data/spec/integration/scenario_integration_spec.rb +6 -6
- data/spec/integration/step_integration_spec.rb +16 -17
- data/spec/integration/table_integration_spec.rb +8 -8
- data/spec/integration/table_row_integration_spec.rb +7 -7
- data/spec/integration/tag_integration_spec.rb +6 -6
- data/spec/integration/world_integration_spec.rb +2 -2
- data/spec/unit/background_unit_spec.rb +2 -2
- data/spec/unit/containing_element_unit_specs.rb +2 -2
- data/spec/unit/directory_unit_spec.rb +14 -14
- data/spec/unit/doc_string_unit_spec.rb +18 -18
- data/spec/unit/example_unit_spec.rb +32 -32
- data/spec/unit/feature_element_unit_specs.rb +12 -12
- data/spec/unit/feature_file_unit_spec.rb +12 -12
- data/spec/unit/feature_unit_spec.rb +16 -16
- data/spec/unit/nested_element_unit_specs.rb +6 -6
- data/spec/unit/nested_unit_spec.rb +5 -5
- data/spec/unit/outline_unit_spec.rb +7 -7
- data/spec/unit/parsing_unit_spec.rb +4 -4
- data/spec/unit/prepopulated_unit_specs.rb +1 -1
- data/spec/unit/raw_element_unit_specs.rb +4 -4
- data/spec/unit/raw_unit_spec.rb +3 -3
- data/spec/unit/row_unit_spec.rb +6 -6
- data/spec/unit/scenario_unit_spec.rb +3 -3
- data/spec/unit/sourceable_unit_spec.rb +1 -1
- data/spec/unit/sourced_element_unit_specs.rb +2 -2
- data/spec/unit/step_unit_spec.rb +53 -44
- data/spec/unit/table_row_unit_spec.rb +6 -6
- data/spec/unit/table_unit_spec.rb +14 -14
- data/spec/unit/tag_unit_spec.rb +5 -5
- data/spec/unit/taggable_unit_spec.rb +14 -14
- data/spec/unit/tagged_element_unit_specs.rb +14 -14
- data/spec/unit/test_element_unit_spec.rb +11 -3
- data/spec/unit/test_element_unit_specs.rb +5 -5
- data/spec/unit/world_unit_spec.rb +26 -26
- metadata +26 -5
- data/features/step_definitions/spec_steps.rb +0 -18
|
@@ -28,7 +28,7 @@ describe 'FeatureFile, Unit' do
|
|
|
28
28
|
|
|
29
29
|
feature = CucumberAnalytics::FeatureFile.new(path)
|
|
30
30
|
|
|
31
|
-
feature.name.
|
|
31
|
+
expect(feature.name).to eq(DEFAULT_FEATURE_FILE_NAME)
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
it 'knows the path of the file that it is modeling' do
|
|
@@ -37,29 +37,29 @@ describe 'FeatureFile, Unit' do
|
|
|
37
37
|
|
|
38
38
|
directory = CucumberAnalytics::FeatureFile.new(path)
|
|
39
39
|
|
|
40
|
-
directory.path.
|
|
40
|
+
expect(directory.path).to eq(path)
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
it 'has features - #features' do
|
|
44
|
-
@feature_file.
|
|
44
|
+
expect(@feature_file.respond_to?(:features)).to be true
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
it 'can get and set its features - #features, #features=' do
|
|
48
48
|
@feature_file.features = :some_features
|
|
49
|
-
@feature_file.features.
|
|
49
|
+
expect(@feature_file.features).to eq(:some_features)
|
|
50
50
|
@feature_file.features = :some_other_features
|
|
51
|
-
@feature_file.features.
|
|
51
|
+
expect(@feature_file.features).to eq(:some_other_features)
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
it 'knows how many features it has - #feature_count' do
|
|
55
55
|
@feature_file.features = [:a_feature]
|
|
56
|
-
@feature_file.feature_count.
|
|
56
|
+
expect(@feature_file.feature_count).to eq(1)
|
|
57
57
|
@feature_file.features = []
|
|
58
|
-
@feature_file.feature_count.
|
|
58
|
+
expect(@feature_file.feature_count).to eq(0)
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
it 'starts with no features' do
|
|
62
|
-
@feature_file.features.
|
|
62
|
+
expect(@feature_file.features).to eq([])
|
|
63
63
|
end
|
|
64
64
|
|
|
65
65
|
it 'contains features' do
|
|
@@ -68,21 +68,21 @@ describe 'FeatureFile, Unit' do
|
|
|
68
68
|
|
|
69
69
|
@feature_file.features = features
|
|
70
70
|
|
|
71
|
-
@feature_file.contains.
|
|
71
|
+
expect(@feature_file.contains).to match_array(everything)
|
|
72
72
|
end
|
|
73
73
|
|
|
74
74
|
it 'can easily access its sole feature' do
|
|
75
75
|
@feature_file.features = []
|
|
76
|
-
@feature_file.feature.
|
|
76
|
+
expect(@feature_file.feature).to be_nil
|
|
77
77
|
|
|
78
78
|
@feature_file.features = [:a_feature]
|
|
79
|
-
@feature_file.feature.
|
|
79
|
+
expect(@feature_file.feature).to eq(:a_feature)
|
|
80
80
|
end
|
|
81
81
|
|
|
82
82
|
context 'feature file output edge cases' do
|
|
83
83
|
|
|
84
84
|
it 'is a String' do
|
|
85
|
-
@feature_file.to_s.
|
|
85
|
+
expect(@feature_file.to_s).to be_a(String)
|
|
86
86
|
end
|
|
87
87
|
|
|
88
88
|
it 'can output an empty feature file' do
|
|
@@ -25,7 +25,7 @@ describe 'Feature, Unit' do
|
|
|
25
25
|
expect { @element = clazz.new(source) }.to_not raise_error
|
|
26
26
|
|
|
27
27
|
# Sanity check in case instantiation failed in a non-explosive manner
|
|
28
|
-
@element.name.
|
|
28
|
+
expect(@element.name).to eq('test feature')
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
it 'will complain about unknown element types' do
|
|
@@ -37,39 +37,39 @@ describe 'Feature, Unit' do
|
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
it 'has a background - #background' do
|
|
40
|
-
@feature.
|
|
40
|
+
expect(@feature.respond_to?(:background)).to be true
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
it 'can get and set its background - #background, #background=' do
|
|
44
44
|
@feature.background = :some_background
|
|
45
|
-
@feature.background.
|
|
45
|
+
expect(@feature.background).to eq(:some_background)
|
|
46
46
|
@feature.background = :some_other_background
|
|
47
|
-
@feature.background.
|
|
47
|
+
expect(@feature.background).to eq(:some_other_background)
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
it 'knows whether or not it presently has a background - has_background?' do
|
|
51
51
|
@feature.background = :a_background
|
|
52
|
-
@feature.
|
|
52
|
+
expect(@feature).to have_background
|
|
53
53
|
@feature.background = nil
|
|
54
|
-
@feature.
|
|
54
|
+
expect(@feature).to_not have_background
|
|
55
55
|
end
|
|
56
56
|
|
|
57
57
|
it 'has tests - #tests' do
|
|
58
|
-
@feature.
|
|
58
|
+
expect(@feature.respond_to?(:tests)).to be true
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
it 'can get and set its tests - #tests, #tests=' do
|
|
62
62
|
@feature.tests = :some_tests
|
|
63
|
-
@feature.tests.
|
|
63
|
+
expect(@feature.tests).to eq(:some_tests)
|
|
64
64
|
@feature.tests = :some_other_tests
|
|
65
|
-
@feature.tests.
|
|
65
|
+
expect(@feature.tests).to eq(:some_other_tests)
|
|
66
66
|
end
|
|
67
67
|
|
|
68
68
|
it 'knows how many tests it has - #test_count' do
|
|
69
69
|
@feature.tests = []
|
|
70
|
-
@feature.test_count.
|
|
70
|
+
expect(@feature.test_count).to eq(0)
|
|
71
71
|
@feature.tests = [:test_1, :test_2]
|
|
72
|
-
@feature.test_count.
|
|
72
|
+
expect(@feature.test_count).to eq(2)
|
|
73
73
|
end
|
|
74
74
|
|
|
75
75
|
it 'contains backgrounds and tests' do
|
|
@@ -80,7 +80,7 @@ describe 'Feature, Unit' do
|
|
|
80
80
|
@feature.background = background
|
|
81
81
|
@feature.tests = tests
|
|
82
82
|
|
|
83
|
-
@feature.contains.
|
|
83
|
+
expect(@feature.contains).to match_array(everything)
|
|
84
84
|
end
|
|
85
85
|
|
|
86
86
|
it 'contains a background only if one is present' do
|
|
@@ -91,21 +91,21 @@ describe 'Feature, Unit' do
|
|
|
91
91
|
@feature.background = background
|
|
92
92
|
@feature.tests = tests
|
|
93
93
|
|
|
94
|
-
@feature.contains.
|
|
94
|
+
expect(@feature.contains).to match_array(everything)
|
|
95
95
|
end
|
|
96
96
|
|
|
97
97
|
it 'starts with no background' do
|
|
98
|
-
@feature.background.
|
|
98
|
+
expect(@feature.background).to be_nil
|
|
99
99
|
end
|
|
100
100
|
|
|
101
101
|
it 'starts with no tests' do
|
|
102
|
-
@feature.tests.
|
|
102
|
+
expect(@feature.tests).to eq([])
|
|
103
103
|
end
|
|
104
104
|
|
|
105
105
|
context 'feature output edge cases' do
|
|
106
106
|
|
|
107
107
|
it 'is a String' do
|
|
108
|
-
@feature.to_s.
|
|
108
|
+
expect(@feature.to_s).to be_a(String)
|
|
109
109
|
end
|
|
110
110
|
|
|
111
111
|
it 'can output an empty feature' do
|
|
@@ -7,26 +7,26 @@ shared_examples_for 'a nested element' do |clazz|
|
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
it 'has a parent element - #parent_element' do
|
|
10
|
-
@nested_element.
|
|
10
|
+
expect(@nested_element.respond_to?(:parent_element)).to be true
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
it 'can get and set its parent element - #parent_element, #parent_element=' do
|
|
14
14
|
@nested_element.parent_element = :some_parent_element
|
|
15
|
-
@nested_element.parent_element.
|
|
15
|
+
expect(@nested_element.parent_element).to eq(:some_parent_element)
|
|
16
16
|
@nested_element.parent_element = :some_other_parent_element
|
|
17
|
-
@nested_element.parent_element.
|
|
17
|
+
expect(@nested_element.parent_element).to eq(:some_other_parent_element)
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
it 'starts with no parent element' do
|
|
21
|
-
@nested_element.parent_element.
|
|
21
|
+
expect(@nested_element.parent_element).to be_nil
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
it 'has access to its ancestors' do
|
|
25
|
-
@nested_element.
|
|
25
|
+
expect(@nested_element.respond_to?(:get_ancestor)).to be true
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
it 'gets an ancestor based on type' do
|
|
29
|
-
(clazz.instance_method(:get_ancestor).arity == 1).
|
|
29
|
+
expect(clazz.instance_method(:get_ancestor).arity == 1).to be true
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
it 'raises and exception if an unknown ancestor type is requested' do
|
|
@@ -12,22 +12,22 @@ describe 'Nested, Unit' do
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
it 'has a parent element - #parent_element' do
|
|
15
|
-
@nested_element.
|
|
15
|
+
expect(@nested_element.respond_to?(:parent_element)).to be true
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
it 'can get and set its parent element - #parent_element, #parent_element=' do
|
|
19
19
|
@nested_element.parent_element = :some_parent_element
|
|
20
|
-
@nested_element.parent_element.
|
|
20
|
+
expect(@nested_element.parent_element).to eq(:some_parent_element)
|
|
21
21
|
@nested_element.parent_element = :some_other_parent_element
|
|
22
|
-
@nested_element.parent_element.
|
|
22
|
+
expect(@nested_element.parent_element).to eq(:some_other_parent_element)
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
it 'has access to its ancestors' do
|
|
26
|
-
@nested_element.
|
|
26
|
+
expect(@nested_element.respond_to?(:get_ancestor)).to be true
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
it 'gets an ancestor based on type' do
|
|
30
|
-
(nodule.instance_method(:get_ancestor).arity == 1).
|
|
30
|
+
expect(nodule.instance_method(:get_ancestor).arity == 1).to be true
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
it 'raises and exception if an unknown ancestor type is requested' do
|
|
@@ -23,7 +23,7 @@ describe 'Outline, Unit' do
|
|
|
23
23
|
expect { @element = clazz.new(source) }.to_not raise_error
|
|
24
24
|
|
|
25
25
|
# Sanity check in case instantiation failed in a non-explosive manner
|
|
26
|
-
@element.name.
|
|
26
|
+
expect(@element.name).to eq('test outline')
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
|
|
@@ -33,18 +33,18 @@ describe 'Outline, Unit' do
|
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
it 'has examples - #examples' do
|
|
36
|
-
@outline.
|
|
36
|
+
expect(@outline.respond_to?(:examples)).to be true
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
it 'can get and set its examples - #examples, #examples=' do
|
|
40
40
|
@outline.examples = :some_examples
|
|
41
|
-
@outline.examples.
|
|
41
|
+
expect(@outline.examples).to eq(:some_examples)
|
|
42
42
|
@outline.examples = :some_other_examples
|
|
43
|
-
@outline.examples.
|
|
43
|
+
expect(@outline.examples).to eq(:some_other_examples)
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
it 'starts with no examples' do
|
|
47
|
-
@outline.examples.
|
|
47
|
+
expect(@outline.examples).to eq([])
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
it 'contains steps and examples' do
|
|
@@ -55,13 +55,13 @@ describe 'Outline, Unit' do
|
|
|
55
55
|
@outline.steps = steps
|
|
56
56
|
@outline.examples = examples
|
|
57
57
|
|
|
58
|
-
@outline.contains.
|
|
58
|
+
expect(@outline.contains).to match_array(everything)
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
context 'outline output edge cases' do
|
|
62
62
|
|
|
63
63
|
it 'is a String' do
|
|
64
|
-
@outline.to_s.
|
|
64
|
+
expect(@outline.to_s).to be_a(String)
|
|
65
65
|
end
|
|
66
66
|
|
|
67
67
|
it 'can output an empty outline' do
|
|
@@ -5,17 +5,17 @@ SimpleCov.command_name('Parsing') unless RUBY_VERSION.to_s < '1.9.0'
|
|
|
5
5
|
describe 'Parsing, Unit' do
|
|
6
6
|
|
|
7
7
|
it 'can parse text - #parse_text' do
|
|
8
|
-
CucumberAnalytics::Parsing.
|
|
8
|
+
expect(CucumberAnalytics::Parsing.respond_to?(:parse_text)).to be true
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
it 'can only parse strings' do
|
|
12
|
-
expect{CucumberAnalytics::Parsing.parse_text(5)}.to raise_error(ArgumentError)
|
|
13
|
-
expect{CucumberAnalytics::Parsing.parse_text('Feature:')}.to_not raise_error
|
|
12
|
+
expect { CucumberAnalytics::Parsing.parse_text(5) }.to raise_error(ArgumentError)
|
|
13
|
+
expect { CucumberAnalytics::Parsing.parse_text('Feature:') }.to_not raise_error
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
it 'returns an Array' do
|
|
17
17
|
result = CucumberAnalytics::Parsing.parse_text('Feature:')
|
|
18
|
-
result.
|
|
18
|
+
expect(result).to be_a(Array)
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
end
|
|
@@ -7,18 +7,18 @@ shared_examples_for 'a raw element' do |clazz|
|
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
it 'has an underlying implementation representation - #raw_element' do
|
|
10
|
-
@element.
|
|
10
|
+
expect(@element.respond_to?(:raw_element)).to be true
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
it 'can get and set its underlying implementation representation - #raw_element, #raw_element=' do
|
|
14
14
|
@element.raw_element = :some_raw_element
|
|
15
|
-
@element.raw_element.
|
|
15
|
+
expect(@element.raw_element).to eq(:some_raw_element)
|
|
16
16
|
@element.raw_element = :some_other_raw_element
|
|
17
|
-
@element.raw_element.
|
|
17
|
+
expect(@element.raw_element).to eq(:some_other_raw_element)
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
it 'starts with no underlying implementation representation' do
|
|
21
|
-
@element.raw_element.
|
|
21
|
+
expect(@element.raw_element).to be_nil
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
end
|
data/spec/unit/raw_unit_spec.rb
CHANGED
|
@@ -12,14 +12,14 @@ describe 'Raw, Unit' do
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
it 'has a raw element - #raw_element' do
|
|
15
|
-
@element.
|
|
15
|
+
expect(@element.respond_to?(:raw_element)).to be true
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
it 'can get and set its raw element - #raw_element, #raw_element=' do
|
|
19
19
|
@element.raw_element = :some_raw_element
|
|
20
|
-
@element.raw_element.
|
|
20
|
+
expect(@element.raw_element).to eq(:some_raw_element)
|
|
21
21
|
@element.raw_element = :some_other_raw_element
|
|
22
|
-
@element.raw_element.
|
|
22
|
+
expect(@element.raw_element).to eq(:some_other_raw_element)
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
end
|
data/spec/unit/row_unit_spec.rb
CHANGED
|
@@ -18,7 +18,7 @@ describe 'Row, Unit' do
|
|
|
18
18
|
expect { @element = clazz.new(source) }.to_not raise_error
|
|
19
19
|
|
|
20
20
|
# Sanity check in case instantiation failed in a non-explosive manner
|
|
21
|
-
@element.cells.
|
|
21
|
+
expect(@element.cells).to eq(['a', 'row'])
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
before(:each) do
|
|
@@ -26,24 +26,24 @@ describe 'Row, Unit' do
|
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
it 'has cells - #cells' do
|
|
29
|
-
@row.
|
|
29
|
+
expect(@row.respond_to?(:cells)).to be true
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
it 'can get and set its cells - #cells, #cells=' do
|
|
33
33
|
@row.cells = :some_cells
|
|
34
|
-
@row.cells.
|
|
34
|
+
expect(@row.cells).to eq(:some_cells)
|
|
35
35
|
@row.cells = :some_other_cells
|
|
36
|
-
@row.cells.
|
|
36
|
+
expect(@row.cells).to eq(:some_other_cells)
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
it 'starts with no cells' do
|
|
40
|
-
@row.cells.
|
|
40
|
+
expect(@row.cells).to eq([])
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
context 'row output edge cases' do
|
|
44
44
|
|
|
45
45
|
it 'is a String' do
|
|
46
|
-
@row.to_s.
|
|
46
|
+
expect(@row.to_s).to be_a(String)
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
it 'can output an empty row' do
|
|
@@ -22,7 +22,7 @@ describe 'Scenario, Unit' do
|
|
|
22
22
|
expect { @element = clazz.new(source) }.to_not raise_error
|
|
23
23
|
|
|
24
24
|
# Sanity check in case instantiation failed in a non-explosive manner
|
|
25
|
-
@element.name.
|
|
25
|
+
expect(@element.name).to eq('test scenario')
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
before(:each) do
|
|
@@ -35,13 +35,13 @@ describe 'Scenario, Unit' do
|
|
|
35
35
|
|
|
36
36
|
@scenario.steps = steps
|
|
37
37
|
|
|
38
|
-
@scenario.contains.
|
|
38
|
+
expect(@scenario.contains).to match_array(everything)
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
context 'scenario output edge cases' do
|
|
42
42
|
|
|
43
43
|
it 'is a String' do
|
|
44
|
-
@scenario.to_s.
|
|
44
|
+
expect(@scenario.to_s).to be_a(String)
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
it 'can output an empty scenario' do
|
|
@@ -8,11 +8,11 @@ shared_examples_for 'a sourced element' do |clazz|
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
it 'has a source line - #source_line' do
|
|
11
|
-
@element.
|
|
11
|
+
expect(@element.respond_to?(:source_line)).to be true
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
it 'starts with no source line' do
|
|
15
|
-
@element.source_line.
|
|
15
|
+
expect(@element.source_line).to be_nil
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
end
|
data/spec/unit/step_unit_spec.rb
CHANGED
|
@@ -17,105 +17,105 @@ describe 'Step, Unit' do
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
it 'has arguments - #arguments' do
|
|
20
|
-
@step.
|
|
20
|
+
expect(@step.respond_to?(:arguments)).to be true
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
it 'can get and set its arguments - #arguments, #arguments=' do
|
|
24
24
|
@step.arguments = :some_arguments
|
|
25
|
-
@step.arguments.
|
|
25
|
+
expect(@step.arguments).to eq(:some_arguments)
|
|
26
26
|
@step.arguments = :some_other_arguments
|
|
27
|
-
@step.arguments.
|
|
27
|
+
expect(@step.arguments).to eq(:some_other_arguments)
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
it 'starts with no arguments' do
|
|
31
|
-
@step.arguments.
|
|
31
|
+
expect(@step.arguments).to eq([])
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
it 'has a base - #base' do
|
|
35
|
-
@step.
|
|
35
|
+
expect(@step.respond_to?(:base)).to be true
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
it 'can get and set its base - #base, #base=' do
|
|
39
39
|
@step.base = :some_base
|
|
40
|
-
@step.base.
|
|
40
|
+
expect(@step.base).to eq(:some_base)
|
|
41
41
|
@step.base = :some_other_base
|
|
42
|
-
@step.base.
|
|
42
|
+
expect(@step.base).to eq(:some_other_base)
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
it 'starts with no base' do
|
|
46
|
-
@step.base.
|
|
46
|
+
expect(@step.base).to be_nil
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
it 'has a block - #block' do
|
|
50
|
-
@step.
|
|
50
|
+
expect(@step.respond_to?(:block)).to be true
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
it 'can get and set its block - #block, #block=' do
|
|
54
54
|
@step.block = :some_block
|
|
55
|
-
@step.block.
|
|
55
|
+
expect(@step.block).to eq(:some_block)
|
|
56
56
|
@step.block = :some_other_block
|
|
57
|
-
@step.block.
|
|
57
|
+
expect(@step.block).to eq(:some_other_block)
|
|
58
58
|
end
|
|
59
59
|
|
|
60
60
|
it 'starts with no block' do
|
|
61
|
-
@step.block.
|
|
61
|
+
expect(@step.block).to be_nil
|
|
62
62
|
end
|
|
63
63
|
|
|
64
64
|
it 'has a keyword - #keyword' do
|
|
65
|
-
@step.
|
|
65
|
+
expect(@step.respond_to?(:keyword)).to be true
|
|
66
66
|
end
|
|
67
67
|
|
|
68
68
|
it 'can get and set its keyword - #keyword, #keyword=' do
|
|
69
69
|
@step.keyword = :some_keyword
|
|
70
|
-
@step.keyword.
|
|
70
|
+
expect(@step.keyword).to eq(:some_keyword)
|
|
71
71
|
@step.keyword = :some_other_keyword
|
|
72
|
-
@step.keyword.
|
|
72
|
+
expect(@step.keyword).to eq(:some_other_keyword)
|
|
73
73
|
end
|
|
74
74
|
|
|
75
75
|
it 'starts with no keyword' do
|
|
76
|
-
@step.keyword.
|
|
76
|
+
expect(@step.keyword).to be_nil
|
|
77
77
|
end
|
|
78
78
|
|
|
79
79
|
it 'has a left delimiter - #left_delimiter' do
|
|
80
|
-
@step.
|
|
80
|
+
expect(@step.respond_to?(:left_delimiter)).to be true
|
|
81
81
|
end
|
|
82
82
|
|
|
83
83
|
it 'can get and set its left delimiter - #left_delimiter, #left_delimiter=' do
|
|
84
84
|
@step.left_delimiter = :some_left_delimiter
|
|
85
|
-
@step.left_delimiter.
|
|
85
|
+
expect(@step.left_delimiter).to eq(:some_left_delimiter)
|
|
86
86
|
@step.left_delimiter = :some_other_left_delimiter
|
|
87
|
-
@step.left_delimiter.
|
|
87
|
+
expect(@step.left_delimiter).to eq(:some_other_left_delimiter)
|
|
88
88
|
end
|
|
89
89
|
|
|
90
90
|
it 'starts with no left delimiter' do
|
|
91
|
-
@step.left_delimiter.
|
|
91
|
+
expect(@step.left_delimiter).to be_nil
|
|
92
92
|
end
|
|
93
93
|
|
|
94
94
|
it 'has a right delimiter - #right_delimiter' do
|
|
95
|
-
@step.
|
|
95
|
+
expect(@step.respond_to?(:right_delimiter)).to be true
|
|
96
96
|
end
|
|
97
97
|
|
|
98
98
|
it 'can get and set its right delimiter - #right_delimiter, #right_delimiter=' do
|
|
99
99
|
@step.right_delimiter = :some_right_delimiter
|
|
100
|
-
@step.right_delimiter.
|
|
100
|
+
expect(@step.right_delimiter).to eq(:some_right_delimiter)
|
|
101
101
|
@step.right_delimiter = :some_other_right_delimiter
|
|
102
|
-
@step.right_delimiter.
|
|
102
|
+
expect(@step.right_delimiter).to eq(:some_other_right_delimiter)
|
|
103
103
|
end
|
|
104
104
|
|
|
105
105
|
it 'starts with no right delimiter' do
|
|
106
|
-
@step.right_delimiter.
|
|
106
|
+
expect(@step.right_delimiter).to be_nil
|
|
107
107
|
end
|
|
108
108
|
|
|
109
109
|
it 'can set both of its delimiters at once - #delimiter=' do
|
|
110
110
|
@step.delimiter = :new_delimiter
|
|
111
|
-
@step.left_delimiter.
|
|
112
|
-
@step.right_delimiter.
|
|
111
|
+
expect(@step.left_delimiter).to eq(:new_delimiter)
|
|
112
|
+
expect(@step.right_delimiter).to eq(:new_delimiter)
|
|
113
113
|
end
|
|
114
114
|
|
|
115
115
|
context '#scan_arguments' do
|
|
116
116
|
|
|
117
117
|
it 'can explicitly scan for arguments' do
|
|
118
|
-
@step.
|
|
118
|
+
expect(@step.respond_to?(:scan_arguments)).to be true
|
|
119
119
|
end
|
|
120
120
|
|
|
121
121
|
it 'can determine its arguments based on a regular expression' do
|
|
@@ -123,9 +123,9 @@ describe 'Step, Unit' do
|
|
|
123
123
|
step = CucumberAnalytics::Step.new(source)
|
|
124
124
|
|
|
125
125
|
step.scan_arguments(/parameter/)
|
|
126
|
-
step.arguments.
|
|
126
|
+
expect(step.arguments).to eq(['parameter'])
|
|
127
127
|
step.scan_arguments(/t s/)
|
|
128
|
-
step.arguments.
|
|
128
|
+
expect(step.arguments).to eq(['t s'])
|
|
129
129
|
end
|
|
130
130
|
|
|
131
131
|
it 'can determine its arguments based on delimiters' do
|
|
@@ -134,9 +134,9 @@ describe 'Step, Unit' do
|
|
|
134
134
|
step = CucumberAnalytics::Step.new(source)
|
|
135
135
|
|
|
136
136
|
step.scan_arguments('-', '-')
|
|
137
|
-
step.arguments.
|
|
137
|
+
expect(step.arguments).to eq(['parameter 1', 'parameter 2'])
|
|
138
138
|
step.scan_arguments('!', '!')
|
|
139
|
-
step.arguments.
|
|
139
|
+
expect(step.arguments).to eq([])
|
|
140
140
|
end
|
|
141
141
|
|
|
142
142
|
it 'can use different left and right delimiters when scanning' do
|
|
@@ -145,7 +145,7 @@ describe 'Step, Unit' do
|
|
|
145
145
|
step = CucumberAnalytics::Step.new(source)
|
|
146
146
|
|
|
147
147
|
step.scan_arguments('!', '-')
|
|
148
|
-
step.arguments.
|
|
148
|
+
expect(step.arguments).to eq(['a parameter'])
|
|
149
149
|
end
|
|
150
150
|
|
|
151
151
|
it 'can use delimiters of varying lengths' do
|
|
@@ -154,7 +154,7 @@ describe 'Step, Unit' do
|
|
|
154
154
|
step = CucumberAnalytics::Step.new(source)
|
|
155
155
|
|
|
156
156
|
step.scan_arguments('-start-', '-end-')
|
|
157
|
-
step.arguments.
|
|
157
|
+
expect(step.arguments).to eq(['a parameter'])
|
|
158
158
|
end
|
|
159
159
|
|
|
160
160
|
it 'can handle delimiters with special regular expression characters' do
|
|
@@ -163,7 +163,7 @@ describe 'Step, Unit' do
|
|
|
163
163
|
step = CucumberAnalytics::Step.new(source)
|
|
164
164
|
|
|
165
165
|
step.scan_arguments('\d+', '.?')
|
|
166
|
-
step.arguments.
|
|
166
|
+
expect(step.arguments).to eq(['a parameter'])
|
|
167
167
|
end
|
|
168
168
|
|
|
169
169
|
it 'defaults to its set delimiters when scanning' do
|
|
@@ -174,7 +174,7 @@ describe 'Step, Unit' do
|
|
|
174
174
|
step.right_delimiter = '"'
|
|
175
175
|
step.scan_arguments
|
|
176
176
|
|
|
177
|
-
step.arguments.
|
|
177
|
+
expect(step.arguments).to eq(['parameter 2'])
|
|
178
178
|
end
|
|
179
179
|
end
|
|
180
180
|
|
|
@@ -184,7 +184,7 @@ describe 'Step, Unit' do
|
|
|
184
184
|
expect { @element = clazz.new(source) }.to_not raise_error
|
|
185
185
|
|
|
186
186
|
# Sanity check in case instantiation failed in a non-explosive manner
|
|
187
|
-
@element.base.
|
|
187
|
+
expect(@element.base).to eq('test step')
|
|
188
188
|
end
|
|
189
189
|
|
|
190
190
|
context '#step_text' do
|
|
@@ -196,39 +196,39 @@ describe 'Step, Unit' do
|
|
|
196
196
|
end
|
|
197
197
|
|
|
198
198
|
it 'can provide different flavors of step\'s text' do
|
|
199
|
-
@step.
|
|
199
|
+
expect(@step.respond_to?(:step_text)).to be true
|
|
200
200
|
end
|
|
201
201
|
|
|
202
202
|
it 'returns different text based on options' do
|
|
203
|
-
(clazz.instance_method(:step_text).arity != 0).
|
|
203
|
+
expect(clazz.instance_method(:step_text).arity != 0).to be true
|
|
204
204
|
end
|
|
205
205
|
|
|
206
206
|
it 'returns the step\'s text as an Array' do
|
|
207
|
-
@step.step_text.
|
|
207
|
+
expect(@step.step_text).to be_a(Array)
|
|
208
208
|
end
|
|
209
209
|
|
|
210
210
|
it 'can provide the step\'s text without the arguments' do
|
|
211
211
|
expected_output = ['Given a test step with -- ^and@ *parameter 2!!']
|
|
212
212
|
|
|
213
|
-
@step.step_text(:with_arguments => false).
|
|
213
|
+
expect(@step.step_text(:with_arguments => false)).to eq(expected_output)
|
|
214
214
|
end
|
|
215
215
|
|
|
216
216
|
it 'can determine its arguments based on delimiters' do
|
|
217
217
|
expected_output = ['Given a test step with -parameter 1- ^@ *parameter 2!!']
|
|
218
218
|
|
|
219
|
-
@step.step_text(:with_arguments => false, :left_delimiter => '^', :right_delimiter => '@').
|
|
219
|
+
expect(@step.step_text(:with_arguments => false, :left_delimiter => '^', :right_delimiter => '@')).to eq(expected_output)
|
|
220
220
|
end
|
|
221
221
|
|
|
222
222
|
it 'can use delimiters of varying lengths' do
|
|
223
223
|
expected_output = ['Given a test step with -parameter 1- ^and@ *!!']
|
|
224
224
|
|
|
225
|
-
@step.step_text(:with_arguments => false, :left_delimiter => '*', :right_delimiter => '!!').
|
|
225
|
+
expect(@step.step_text(:with_arguments => false, :left_delimiter => '*', :right_delimiter => '!!')).to eq(expected_output)
|
|
226
226
|
end
|
|
227
227
|
|
|
228
228
|
it 'can handle delimiters with special regular expression characters' do
|
|
229
229
|
expected_output = ['Given a test step with -parameter 1- ^and@ *!!']
|
|
230
230
|
|
|
231
|
-
@step.step_text(:with_arguments => false, :left_delimiter => '*', :right_delimiter => '!!').
|
|
231
|
+
expect(@step.step_text(:with_arguments => false, :left_delimiter => '*', :right_delimiter => '!!')).to eq(expected_output)
|
|
232
232
|
end
|
|
233
233
|
|
|
234
234
|
end
|
|
@@ -236,7 +236,7 @@ describe 'Step, Unit' do
|
|
|
236
236
|
context 'step output edge cases' do
|
|
237
237
|
|
|
238
238
|
it 'is a String' do
|
|
239
|
-
@step.to_s.
|
|
239
|
+
expect(@step.to_s).to be_a(String)
|
|
240
240
|
end
|
|
241
241
|
|
|
242
242
|
it 'can output an empty step' do
|
|
@@ -256,4 +256,13 @@ describe 'Step, Unit' do
|
|
|
256
256
|
end
|
|
257
257
|
|
|
258
258
|
end
|
|
259
|
+
|
|
260
|
+
it 'can gracefully be compared to other types of objects' do
|
|
261
|
+
# Some common types of object
|
|
262
|
+
[1, 'foo', :bar, [], {}].each do |thing|
|
|
263
|
+
expect { @step == thing }.to_not raise_error
|
|
264
|
+
expect(@step == thing).to be false
|
|
265
|
+
end
|
|
266
|
+
end
|
|
267
|
+
|
|
259
268
|
end
|