cuke_modeler 0.0.1
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 +7 -0
- data/.gitignore +17 -0
- data/.simplecov +8 -0
- data/Gemfile +4 -0
- data/History.rdoc +3 -0
- data/LICENSE.txt +22 -0
- data/README.md +73 -0
- data/Rakefile +38 -0
- data/cuke_modeler.gemspec +29 -0
- data/features/analysis/test_comparison.feature +123 -0
- data/features/analysis/test_manipulation.feature +37 -0
- data/features/modeling/background_modeling.feature +75 -0
- data/features/modeling/background_output.feature +130 -0
- data/features/modeling/directory_modeling.feature +120 -0
- data/features/modeling/directory_output.feature +13 -0
- data/features/modeling/doc_string_modeling.feature +63 -0
- data/features/modeling/doc_string_output.feature +71 -0
- data/features/modeling/example_modeling.feature +111 -0
- data/features/modeling/example_output.feature +192 -0
- data/features/modeling/feature_file_modeling.feature +64 -0
- data/features/modeling/feature_file_output.feature +13 -0
- data/features/modeling/feature_modeling.feature +164 -0
- data/features/modeling/feature_output.feature +244 -0
- data/features/modeling/outline_modeling.feature +100 -0
- data/features/modeling/outline_output.feature +197 -0
- data/features/modeling/row_modeling.feature +77 -0
- data/features/modeling/row_output.feature +27 -0
- data/features/modeling/scenario_modeling.feature +89 -0
- data/features/modeling/scenario_output.feature +147 -0
- data/features/modeling/step_modeling.feature +85 -0
- data/features/modeling/step_output.feature +52 -0
- data/features/modeling/table_modeling.feature +52 -0
- data/features/modeling/table_output.feature +42 -0
- data/features/modeling/table_row_modeling.feature +67 -0
- data/features/modeling/table_row_output.feature +27 -0
- data/features/modeling/tag_modeling.feature +58 -0
- data/features/modeling/tag_output.feature +16 -0
- data/features/step_definitions/action_steps.rb +3 -0
- data/features/step_definitions/background_steps.rb +81 -0
- data/features/step_definitions/directory_steps.rb +52 -0
- data/features/step_definitions/doc_string_steps.rb +63 -0
- data/features/step_definitions/feature_file_steps.rb +41 -0
- data/features/step_definitions/feature_steps.rb +96 -0
- data/features/step_definitions/outline_steps.rb +252 -0
- data/features/step_definitions/setup_steps.rb +50 -0
- data/features/step_definitions/spec_steps.rb +18 -0
- data/features/step_definitions/step_steps.rb +159 -0
- data/features/step_definitions/table_steps.rb +54 -0
- data/features/step_definitions/tag_steps.rb +61 -0
- data/features/step_definitions/test_steps.rb +114 -0
- data/features/step_definitions/verification_steps.rb +9 -0
- data/features/support/env.rb +27 -0
- data/features/support/transforms.rb +3 -0
- data/lib/cuke_modeler.rb +29 -0
- data/lib/cuke_modeler/background.rb +38 -0
- data/lib/cuke_modeler/containing.rb +18 -0
- data/lib/cuke_modeler/directory.rb +86 -0
- data/lib/cuke_modeler/doc_string.rb +87 -0
- data/lib/cuke_modeler/example.rb +184 -0
- data/lib/cuke_modeler/feature.rb +147 -0
- data/lib/cuke_modeler/feature_element.rb +73 -0
- data/lib/cuke_modeler/feature_file.rb +77 -0
- data/lib/cuke_modeler/nested.rb +34 -0
- data/lib/cuke_modeler/outline.rb +68 -0
- data/lib/cuke_modeler/parsing.rb +32 -0
- data/lib/cuke_modeler/raw.rb +20 -0
- data/lib/cuke_modeler/row.rb +64 -0
- data/lib/cuke_modeler/scenario.rb +45 -0
- data/lib/cuke_modeler/sourceable.rb +20 -0
- data/lib/cuke_modeler/step.rb +214 -0
- data/lib/cuke_modeler/table.rb +90 -0
- data/lib/cuke_modeler/table_row.rb +64 -0
- data/lib/cuke_modeler/tag.rb +62 -0
- data/lib/cuke_modeler/taggable.rb +54 -0
- data/lib/cuke_modeler/test_element.rb +77 -0
- data/lib/cuke_modeler/version.rb +3 -0
- data/lib/cuke_modeler/world.rb +113 -0
- data/spec/integration/background_integration_spec.rb +72 -0
- data/spec/integration/directory_integration_spec.rb +48 -0
- data/spec/integration/doc_string_integration_spec.rb +66 -0
- data/spec/integration/example_integration_spec.rb +94 -0
- data/spec/integration/feature_file_integration_spec.rb +44 -0
- data/spec/integration/feature_integration_spec.rb +152 -0
- data/spec/integration/outline_integration_spec.rb +92 -0
- data/spec/integration/scenario_integration_spec.rb +80 -0
- data/spec/integration/step_integration_spec.rb +184 -0
- data/spec/integration/table_integration_spec.rb +86 -0
- data/spec/integration/table_row_integration_spec.rb +68 -0
- data/spec/integration/tag_integration_spec.rb +67 -0
- data/spec/integration/world_integration_spec.rb +13 -0
- data/spec/spec_helper.rb +30 -0
- data/spec/unit/background_unit_spec.rb +55 -0
- data/spec/unit/bare_bones_unit_specs.rb +13 -0
- data/spec/unit/containing_element_unit_specs.rb +17 -0
- data/spec/unit/directory_unit_spec.rb +103 -0
- data/spec/unit/doc_string_unit_spec.rb +109 -0
- data/spec/unit/example_unit_spec.rb +251 -0
- data/spec/unit/feature_element_unit_spec.rb +19 -0
- data/spec/unit/feature_element_unit_specs.rb +46 -0
- data/spec/unit/feature_file_unit_spec.rb +94 -0
- data/spec/unit/feature_unit_spec.rb +135 -0
- data/spec/unit/nested_element_unit_specs.rb +36 -0
- data/spec/unit/nested_unit_spec.rb +37 -0
- data/spec/unit/outline_unit_spec.rb +91 -0
- data/spec/unit/parsing_unit_spec.rb +21 -0
- data/spec/unit/prepopulated_unit_specs.rb +13 -0
- data/spec/unit/raw_element_unit_specs.rb +24 -0
- data/spec/unit/raw_unit_spec.rb +25 -0
- data/spec/unit/row_unit_spec.rb +55 -0
- data/spec/unit/scenario_unit_spec.rb +71 -0
- data/spec/unit/sourceable_unit_spec.rb +17 -0
- data/spec/unit/sourced_element_unit_specs.rb +18 -0
- data/spec/unit/step_unit_spec.rb +259 -0
- data/spec/unit/table_row_unit_spec.rb +55 -0
- data/spec/unit/table_unit_spec.rb +96 -0
- data/spec/unit/tag_unit_spec.rb +51 -0
- data/spec/unit/taggable_unit_spec.rb +78 -0
- data/spec/unit/tagged_element_unit_specs.rb +63 -0
- data/spec/unit/test_element_unit_spec.rb +40 -0
- data/spec/unit/test_element_unit_specs.rb +31 -0
- data/spec/unit/world_unit_spec.rb +130 -0
- metadata +364 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
SimpleCov.command_name('FeatureElement') unless RUBY_VERSION.to_s < '1.9.0'
|
|
4
|
+
|
|
5
|
+
describe 'FeatureElement, Unit' do
|
|
6
|
+
|
|
7
|
+
clazz = CukeModeler::FeatureElement
|
|
8
|
+
|
|
9
|
+
it_should_behave_like 'a feature element', clazz
|
|
10
|
+
it_should_behave_like 'a nested element', clazz
|
|
11
|
+
it_should_behave_like 'a prepopulated element', clazz
|
|
12
|
+
it_should_behave_like 'a bare bones element', clazz
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
before(:each) do
|
|
16
|
+
@element = clazz.new
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
shared_examples_for 'a feature element' do |clazz|
|
|
4
|
+
|
|
5
|
+
before(:each) do
|
|
6
|
+
@element = clazz.new
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
it 'has a name - #name' do
|
|
10
|
+
@element.should respond_to(:name)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it 'can get and set its name - #name, #name=' do
|
|
14
|
+
@element.name = :some_name
|
|
15
|
+
@element.name.should == :some_name
|
|
16
|
+
@element.name = :some_other_name
|
|
17
|
+
@element.name.should == :some_other_name
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it 'has a description' do
|
|
21
|
+
@element.should respond_to(:description)
|
|
22
|
+
@element.should respond_to(:description_text)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it 'can get and set its description' do
|
|
26
|
+
@element.description = :some_description
|
|
27
|
+
@element.description.should == :some_description
|
|
28
|
+
@element.description = :some_other_description
|
|
29
|
+
@element.description.should == :some_other_description
|
|
30
|
+
|
|
31
|
+
@element.description_text = :some_description
|
|
32
|
+
@element.description_text.should == :some_description
|
|
33
|
+
@element.description_text = :some_other_description
|
|
34
|
+
@element.description_text.should == :some_other_description
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it 'starts with no name' do
|
|
38
|
+
@element.name.should == ''
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it 'starts with no description' do
|
|
42
|
+
@element.description.should == []
|
|
43
|
+
@element.description_text.should == ''
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
end
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
SimpleCov.command_name('FeatureFile') unless RUBY_VERSION.to_s < '1.9.0'
|
|
4
|
+
|
|
5
|
+
describe 'FeatureFile, Unit' do
|
|
6
|
+
|
|
7
|
+
clazz = CukeModeler::FeatureFile
|
|
8
|
+
|
|
9
|
+
it_should_behave_like 'a nested element', clazz
|
|
10
|
+
it_should_behave_like 'a containing element', clazz
|
|
11
|
+
it_should_behave_like 'a bare bones element', clazz
|
|
12
|
+
it_should_behave_like 'a prepopulated element', clazz
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
before(:each) do
|
|
16
|
+
@feature_file = clazz.new
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it 'cannot model a non-existent directory' do
|
|
20
|
+
path = "#{@default_file_directory}/missing_file.txt"
|
|
21
|
+
|
|
22
|
+
expect { CukeModeler::FeatureFile.new(path) }.to raise_error(ArgumentError)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it 'knows the name of the file that it is modeling' do
|
|
26
|
+
path = "#{@default_file_directory}/#{@default_feature_file_name}"
|
|
27
|
+
File.open(path, "w") {}
|
|
28
|
+
|
|
29
|
+
feature = CukeModeler::FeatureFile.new(path)
|
|
30
|
+
|
|
31
|
+
feature.name.should == @default_feature_file_name
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it 'knows the path of the file that it is modeling' do
|
|
35
|
+
path = "#{@default_file_directory}/#{@default_feature_file_name}"
|
|
36
|
+
File.open(path, "w") {}
|
|
37
|
+
|
|
38
|
+
directory = CukeModeler::FeatureFile.new(path)
|
|
39
|
+
|
|
40
|
+
directory.path.should == path
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
it 'has features - #features' do
|
|
44
|
+
@feature_file.should respond_to(:features)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
it 'can get and set its features - #features, #features=' do
|
|
48
|
+
@feature_file.features = :some_features
|
|
49
|
+
@feature_file.features.should == :some_features
|
|
50
|
+
@feature_file.features = :some_other_features
|
|
51
|
+
@feature_file.features.should == :some_other_features
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
it 'knows how many features it has - #feature_count' do
|
|
55
|
+
@feature_file.features = [:a_feature]
|
|
56
|
+
@feature_file.feature_count.should == 1
|
|
57
|
+
@feature_file.features = []
|
|
58
|
+
@feature_file.feature_count.should == 0
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
it 'starts with no features' do
|
|
62
|
+
@feature_file.features.should == []
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
it 'contains features' do
|
|
66
|
+
features = [:a_feature]
|
|
67
|
+
everything = features
|
|
68
|
+
|
|
69
|
+
@feature_file.features = features
|
|
70
|
+
|
|
71
|
+
@feature_file.contains.should =~ everything
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
it 'can easily access its sole feature' do
|
|
75
|
+
@feature_file.features = []
|
|
76
|
+
@feature_file.feature.should be_nil
|
|
77
|
+
|
|
78
|
+
@feature_file.features = [:a_feature]
|
|
79
|
+
@feature_file.feature.should == :a_feature
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
context 'feature file output edge cases' do
|
|
83
|
+
|
|
84
|
+
it 'is a String' do
|
|
85
|
+
@feature_file.to_s.should be_a(String)
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
it 'can output an empty feature file' do
|
|
89
|
+
expect { @feature_file.to_s }.to_not raise_error
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
end
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
SimpleCov.command_name('Feature') unless RUBY_VERSION.to_s < '1.9.0'
|
|
4
|
+
|
|
5
|
+
describe 'Feature, Unit' do
|
|
6
|
+
|
|
7
|
+
clazz = CukeModeler::Feature
|
|
8
|
+
|
|
9
|
+
it_should_behave_like 'a feature element', clazz
|
|
10
|
+
it_should_behave_like 'a nested element', clazz
|
|
11
|
+
it_should_behave_like 'a containing element', clazz
|
|
12
|
+
it_should_behave_like 'a tagged element', clazz
|
|
13
|
+
it_should_behave_like 'a bare bones element', clazz
|
|
14
|
+
it_should_behave_like 'a prepopulated element', clazz
|
|
15
|
+
it_should_behave_like 'a sourced element', clazz
|
|
16
|
+
it_should_behave_like 'a raw element', clazz
|
|
17
|
+
|
|
18
|
+
before(:each) do
|
|
19
|
+
@feature = clazz.new
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it 'can be parsed from stand alone text' do
|
|
23
|
+
source = 'Feature: test feature'
|
|
24
|
+
|
|
25
|
+
expect { @element = clazz.new(source) }.to_not raise_error
|
|
26
|
+
|
|
27
|
+
# Sanity check in case instantiation failed in a non-explosive manner
|
|
28
|
+
@element.name.should == 'test feature'
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it 'will complain about unknown element types' do
|
|
32
|
+
parsed_element = {'description' => '',
|
|
33
|
+
'elements' => [{'keyword' => 'Scenario', 'description' => ''},
|
|
34
|
+
{'keyword' => 'New Type', 'description' => ''}]}
|
|
35
|
+
|
|
36
|
+
expect { clazz.new(parsed_element) }.to raise_error(ArgumentError)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it 'has a background - #background' do
|
|
40
|
+
@feature.should respond_to(:background)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
it 'can get and set its background - #background, #background=' do
|
|
44
|
+
@feature.background = :some_background
|
|
45
|
+
@feature.background.should == :some_background
|
|
46
|
+
@feature.background = :some_other_background
|
|
47
|
+
@feature.background.should == :some_other_background
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it 'knows whether or not it presently has a background - has_background?' do
|
|
51
|
+
@feature.background = :a_background
|
|
52
|
+
@feature.has_background?.should be_true
|
|
53
|
+
@feature.background = nil
|
|
54
|
+
@feature.has_background?.should be_false
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
it 'has tests - #tests' do
|
|
58
|
+
@feature.should respond_to(:tests)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
it 'can get and set its tests - #tests, #tests=' do
|
|
62
|
+
@feature.tests = :some_tests
|
|
63
|
+
@feature.tests.should == :some_tests
|
|
64
|
+
@feature.tests = :some_other_tests
|
|
65
|
+
@feature.tests.should == :some_other_tests
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
it 'knows how many tests it has - #test_count' do
|
|
69
|
+
@feature.tests = []
|
|
70
|
+
@feature.test_count.should == 0
|
|
71
|
+
@feature.tests = [:test_1, :test_2]
|
|
72
|
+
@feature.test_count.should == 2
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
it 'contains backgrounds and tests' do
|
|
76
|
+
tests = [:test_1, :test_2]
|
|
77
|
+
background = :a_background
|
|
78
|
+
everything = [background] + tests
|
|
79
|
+
|
|
80
|
+
@feature.background = background
|
|
81
|
+
@feature.tests = tests
|
|
82
|
+
|
|
83
|
+
@feature.contains.should =~ everything
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
it 'contains a background only if one is present' do
|
|
87
|
+
tests = [:test_1, :test_2]
|
|
88
|
+
background = nil
|
|
89
|
+
everything = tests
|
|
90
|
+
|
|
91
|
+
@feature.background = background
|
|
92
|
+
@feature.tests = tests
|
|
93
|
+
|
|
94
|
+
@feature.contains.should =~ everything
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
it 'starts with no background' do
|
|
98
|
+
@feature.background.should == nil
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
it 'starts with no tests' do
|
|
102
|
+
@feature.tests.should == []
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
context 'feature output edge cases' do
|
|
106
|
+
|
|
107
|
+
it 'is a String' do
|
|
108
|
+
@feature.to_s.should be_a(String)
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
it 'can output an empty feature' do
|
|
112
|
+
expect { @feature.to_s }.to_not raise_error
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
it 'can output a feature that has only a name' do
|
|
116
|
+
@feature.name = 'a name'
|
|
117
|
+
|
|
118
|
+
expect { @feature.to_s }.to_not raise_error
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
it 'can output a feature that has only a description' do
|
|
122
|
+
@feature.description_text = 'a description'
|
|
123
|
+
|
|
124
|
+
expect { @feature.to_s }.to_not raise_error
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
it 'can output a feature that has only a tags' do
|
|
128
|
+
@feature.tags = ['a tag']
|
|
129
|
+
|
|
130
|
+
expect { @feature.to_s }.to_not raise_error
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
shared_examples_for 'a nested element' do |clazz|
|
|
4
|
+
|
|
5
|
+
before(:each) do
|
|
6
|
+
@nested_element = clazz.new
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
it 'has a parent element - #parent_element' do
|
|
10
|
+
@nested_element.should respond_to(:parent_element)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it 'can get and set its parent element - #parent_element, #parent_element=' do
|
|
14
|
+
@nested_element.parent_element = :some_parent_element
|
|
15
|
+
@nested_element.parent_element.should == :some_parent_element
|
|
16
|
+
@nested_element.parent_element = :some_other_parent_element
|
|
17
|
+
@nested_element.parent_element.should == :some_other_parent_element
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it 'starts with no parent element' do
|
|
21
|
+
@nested_element.parent_element.should == nil
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it 'has access to its ancestors' do
|
|
25
|
+
@nested_element.should respond_to(:get_ancestor)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
it 'gets an ancestor based on type' do
|
|
29
|
+
(clazz.instance_method(:get_ancestor).arity == 1).should be_true
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
it 'raises and exception if an unknown ancestor type is requested' do
|
|
33
|
+
expect { @nested_element.get_ancestor(:bad_ancestor_type) }.to raise_exception(ArgumentError)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
SimpleCov.command_name('Nested') unless RUBY_VERSION.to_s < '1.9.0'
|
|
4
|
+
|
|
5
|
+
describe 'Nested, Unit' do
|
|
6
|
+
|
|
7
|
+
nodule = CukeModeler::Nested
|
|
8
|
+
|
|
9
|
+
before(:each) do
|
|
10
|
+
@nested_element = Object.new.extend(nodule)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
it 'has a parent element - #parent_element' do
|
|
15
|
+
@nested_element.should respond_to(:parent_element)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it 'can get and set its parent element - #parent_element, #parent_element=' do
|
|
19
|
+
@nested_element.parent_element = :some_parent_element
|
|
20
|
+
@nested_element.parent_element.should == :some_parent_element
|
|
21
|
+
@nested_element.parent_element = :some_other_parent_element
|
|
22
|
+
@nested_element.parent_element.should == :some_other_parent_element
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it 'has access to its ancestors' do
|
|
26
|
+
@nested_element.should respond_to(:get_ancestor)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it 'gets an ancestor based on type' do
|
|
30
|
+
(nodule.instance_method(:get_ancestor).arity == 1).should be_true
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
it 'raises and exception if an unknown ancestor type is requested' do
|
|
34
|
+
expect { @nested_element.get_ancestor(:bad_ancestor_type) }.to raise_exception(ArgumentError)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
end
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
SimpleCov.command_name('Outline') unless RUBY_VERSION.to_s < '1.9.0'
|
|
4
|
+
|
|
5
|
+
describe 'Outline, Unit' do
|
|
6
|
+
|
|
7
|
+
clazz = CukeModeler::Outline
|
|
8
|
+
|
|
9
|
+
it_should_behave_like 'a feature element', clazz
|
|
10
|
+
it_should_behave_like 'a nested element', clazz
|
|
11
|
+
it_should_behave_like 'a containing element', clazz
|
|
12
|
+
it_should_behave_like 'a tagged element', clazz
|
|
13
|
+
it_should_behave_like 'a bare bones element', clazz
|
|
14
|
+
it_should_behave_like 'a prepopulated element', clazz
|
|
15
|
+
it_should_behave_like 'a test element', clazz
|
|
16
|
+
it_should_behave_like 'a sourced element', clazz
|
|
17
|
+
it_should_behave_like 'a raw element', clazz
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
it 'can be parsed from stand alone text' do
|
|
21
|
+
source = 'Scenario Outline: test outline'
|
|
22
|
+
|
|
23
|
+
expect { @element = clazz.new(source) }.to_not raise_error
|
|
24
|
+
|
|
25
|
+
# Sanity check in case instantiation failed in a non-explosive manner
|
|
26
|
+
@element.name.should == 'test outline'
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
before(:each) do
|
|
31
|
+
@outline = clazz.new
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
it 'has examples - #examples' do
|
|
36
|
+
@outline.should respond_to(:examples)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it 'can get and set its examples - #examples, #examples=' do
|
|
40
|
+
@outline.examples = :some_examples
|
|
41
|
+
@outline.examples.should == :some_examples
|
|
42
|
+
@outline.examples = :some_other_examples
|
|
43
|
+
@outline.examples.should == :some_other_examples
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
it 'starts with no examples' do
|
|
47
|
+
@outline.examples.should == []
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it 'contains steps and examples' do
|
|
51
|
+
steps = [:step_1, :step_2, :step_3]
|
|
52
|
+
examples = [:example_1, :example_2, :example_3]
|
|
53
|
+
everything = steps + examples
|
|
54
|
+
|
|
55
|
+
@outline.steps = steps
|
|
56
|
+
@outline.examples = examples
|
|
57
|
+
|
|
58
|
+
@outline.contains.should =~ everything
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
context 'outline output edge cases' do
|
|
62
|
+
|
|
63
|
+
it 'is a String' do
|
|
64
|
+
@outline.to_s.should be_a(String)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
it 'can output an empty outline' do
|
|
68
|
+
expect { @outline.to_s }.to_not raise_error
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
it 'can output an outline that has only a name' do
|
|
72
|
+
@outline.name = 'a name'
|
|
73
|
+
|
|
74
|
+
expect { @outline.to_s }.to_not raise_error
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
it 'can output an outline that has only a description' do
|
|
78
|
+
@outline.description_text = 'a description'
|
|
79
|
+
|
|
80
|
+
expect { @outline.to_s }.to_not raise_error
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
it 'can output an outline that has only a tags' do
|
|
84
|
+
@outline.tags = ['a tag']
|
|
85
|
+
|
|
86
|
+
expect { @outline.to_s }.to_not raise_error
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
end
|