cuke_modeler 1.4.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +329 -0
- data/LICENSE.txt +1 -1
- data/README.md +25 -18
- data/cuke_modeler.gemspec +15 -9
- data/lib/cuke_modeler/adapters/gherkin_10_adapter.rb +12 -0
- data/lib/cuke_modeler/adapters/gherkin_11_adapter.rb +12 -0
- data/lib/cuke_modeler/adapters/gherkin_12_adapter.rb +12 -0
- data/lib/cuke_modeler/adapters/gherkin_13_adapter.rb +12 -0
- data/lib/cuke_modeler/adapters/{gherkin_6_adapter.rb → gherkin_9_adapter.rb} +75 -64
- data/lib/cuke_modeler/containing.rb +16 -0
- data/lib/cuke_modeler/described.rb +1 -0
- data/lib/cuke_modeler/models/background.rb +1 -1
- data/lib/cuke_modeler/models/cell.rb +1 -1
- data/lib/cuke_modeler/models/comment.rb +1 -1
- data/lib/cuke_modeler/models/directory.rb +2 -2
- data/lib/cuke_modeler/models/doc_string.rb +1 -1
- data/lib/cuke_modeler/models/example.rb +1 -1
- data/lib/cuke_modeler/models/feature.rb +1 -1
- data/lib/cuke_modeler/models/feature_file.rb +2 -2
- data/lib/cuke_modeler/models/outline.rb +1 -1
- data/lib/cuke_modeler/models/row.rb +1 -1
- data/lib/cuke_modeler/models/scenario.rb +1 -1
- data/lib/cuke_modeler/models/step.rb +32 -3
- data/lib/cuke_modeler/models/table.rb +1 -1
- data/lib/cuke_modeler/models/tag.rb +1 -1
- data/lib/cuke_modeler/named.rb +1 -0
- data/lib/cuke_modeler/nested.rb +1 -0
- data/lib/cuke_modeler/parsed.rb +1 -0
- data/lib/cuke_modeler/parsing.rb +88 -92
- data/lib/cuke_modeler/sourceable.rb +1 -0
- data/lib/cuke_modeler/stepped.rb +1 -0
- data/lib/cuke_modeler/taggable.rb +1 -0
- data/lib/cuke_modeler/version.rb +1 -1
- data/testing/cucumber/features/analysis/step_comparison.feature +25 -0
- data/testing/cucumber/features/analysis/test_comparison.feature +1 -1
- metadata +55 -142
- data/.gitignore +0 -18
- data/.simplecov +0 -7
- data/.travis.yml +0 -54
- data/Gemfile +0 -36
- data/History.md +0 -191
- data/Rakefile +0 -63
- data/appveyor.yml +0 -43
- data/lib/cuke_modeler/adapters/gherkin_2_adapter.rb +0 -273
- data/lib/cuke_modeler/adapters/gherkin_3_adapter.rb +0 -296
- data/lib/cuke_modeler/adapters/gherkin_4_adapter.rb +0 -308
- data/testing/cucumber/step_definitions/action_steps.rb +0 -13
- data/testing/cucumber/step_definitions/background_steps.rb +0 -1
- data/testing/cucumber/step_definitions/directory_steps.rb +0 -6
- data/testing/cucumber/step_definitions/doc_string_steps.rb +0 -1
- data/testing/cucumber/step_definitions/feature_file_steps.rb +0 -16
- data/testing/cucumber/step_definitions/feature_steps.rb +0 -7
- data/testing/cucumber/step_definitions/modeling_steps.rb +0 -44
- data/testing/cucumber/step_definitions/setup_steps.rb +0 -32
- data/testing/cucumber/step_definitions/step_steps.rb +0 -3
- data/testing/cucumber/step_definitions/table_steps.rb +0 -1
- data/testing/cucumber/step_definitions/tag_steps.rb +0 -3
- data/testing/cucumber/step_definitions/verification_steps.rb +0 -173
- data/testing/cucumber/support/env.rb +0 -30
- data/testing/dialect_helper.rb +0 -48
- data/testing/file_helper.rb +0 -47
- data/testing/gemfiles/gherkin2.gemfile +0 -32
- data/testing/gemfiles/gherkin3.gemfile +0 -26
- data/testing/gemfiles/gherkin4.gemfile +0 -27
- data/testing/gemfiles/gherkin5.gemfile +0 -26
- data/testing/gemfiles/gherkin6.gemfile +0 -10
- data/testing/rspec/spec/integration/background_integration_spec.rb +0 -442
- data/testing/rspec/spec/integration/cell_integration_spec.rb +0 -335
- data/testing/rspec/spec/integration/comment_integration_spec.rb +0 -177
- data/testing/rspec/spec/integration/directory_integration_spec.rb +0 -218
- data/testing/rspec/spec/integration/doc_string_integration_spec.rb +0 -402
- data/testing/rspec/spec/integration/example_integration_spec.rb +0 -741
- data/testing/rspec/spec/integration/feature_file_integration_spec.rb +0 -272
- data/testing/rspec/spec/integration/feature_integration_spec.rb +0 -650
- data/testing/rspec/spec/integration/gherkin_2_adapter_spec.rb +0 -166
- data/testing/rspec/spec/integration/gherkin_3_adapter_spec.rb +0 -166
- data/testing/rspec/spec/integration/gherkin_4_adapter_spec.rb +0 -165
- data/testing/rspec/spec/integration/gherkin_6_adapter_spec.rb +0 -166
- data/testing/rspec/spec/integration/model_integration_spec.rb +0 -15
- data/testing/rspec/spec/integration/nested_integration_spec.rb +0 -91
- data/testing/rspec/spec/integration/outline_integration_spec.rb +0 -624
- data/testing/rspec/spec/integration/parsing_integration_spec.rb +0 -117
- data/testing/rspec/spec/integration/row_integration_spec.rb +0 -291
- data/testing/rspec/spec/integration/scenario_integration_spec.rb +0 -479
- data/testing/rspec/spec/integration/shared/models_integration_specs.rb +0 -18
- data/testing/rspec/spec/integration/step_integration_spec.rb +0 -475
- data/testing/rspec/spec/integration/table_integration_spec.rb +0 -337
- data/testing/rspec/spec/integration/tag_integration_spec.rb +0 -259
- data/testing/rspec/spec/spec_helper.rb +0 -122
- data/testing/rspec/spec/unit/background_unit_spec.rb +0 -83
- data/testing/rspec/spec/unit/cell_unit_spec.rb +0 -68
- data/testing/rspec/spec/unit/comment_unit_spec.rb +0 -68
- data/testing/rspec/spec/unit/described_unit_spec.rb +0 -23
- data/testing/rspec/spec/unit/directory_unit_spec.rb +0 -127
- data/testing/rspec/spec/unit/doc_string_unit_spec.rb +0 -100
- data/testing/rspec/spec/unit/example_unit_spec.rb +0 -133
- data/testing/rspec/spec/unit/feature_file_unit_spec.rb +0 -125
- data/testing/rspec/spec/unit/feature_unit_spec.rb +0 -157
- data/testing/rspec/spec/unit/model_unit_spec.rb +0 -15
- data/testing/rspec/spec/unit/named_unit_spec.rb +0 -23
- data/testing/rspec/spec/unit/nested_unit_spec.rb +0 -43
- data/testing/rspec/spec/unit/outline_unit_spec.rb +0 -117
- data/testing/rspec/spec/unit/parsed_unit_spec.rb +0 -27
- data/testing/rspec/spec/unit/parsing_unit_spec.rb +0 -54
- data/testing/rspec/spec/unit/row_unit_spec.rb +0 -68
- data/testing/rspec/spec/unit/scenario_unit_spec.rb +0 -86
- data/testing/rspec/spec/unit/shared/bare_bones_models_unit_specs.rb +0 -14
- data/testing/rspec/spec/unit/shared/containing_models_unit_specs.rb +0 -25
- data/testing/rspec/spec/unit/shared/described_models_unit_specs.rb +0 -38
- data/testing/rspec/spec/unit/shared/keyworded_models_unit_specs.rb +0 -58
- data/testing/rspec/spec/unit/shared/models_unit_specs.rb +0 -15
- data/testing/rspec/spec/unit/shared/named_models_unit_specs.rb +0 -39
- data/testing/rspec/spec/unit/shared/nested_models_unit_specs.rb +0 -51
- data/testing/rspec/spec/unit/shared/parsed_models_unit_specs.rb +0 -39
- data/testing/rspec/spec/unit/shared/prepopulated_models_unit_specs.rb +0 -18
- data/testing/rspec/spec/unit/shared/sourced_models_unit_specs.rb +0 -39
- data/testing/rspec/spec/unit/shared/stepped_models_unit_specs.rb +0 -46
- data/testing/rspec/spec/unit/shared/stringifiable_models_unit_specs.rb +0 -18
- data/testing/rspec/spec/unit/shared/tagged_models_unit_specs.rb +0 -72
- data/testing/rspec/spec/unit/sourceable_unit_spec.rb +0 -27
- data/testing/rspec/spec/unit/step_unit_spec.rb +0 -109
- data/testing/rspec/spec/unit/stepped_unit_spec.rb +0 -23
- data/testing/rspec/spec/unit/table_unit_spec.rb +0 -77
- data/testing/rspec/spec/unit/tag_unit_spec.rb +0 -68
- data/testing/rspec/spec/unit/taggable_unit_spec.rb +0 -69
- data/testing/test_languages.json +0 -45
- data/todo.txt +0 -24
@@ -1,100 +0,0 @@
|
|
1
|
-
require "#{File.dirname(__FILE__)}/../spec_helper"
|
2
|
-
|
3
|
-
|
4
|
-
describe 'DocString, Unit', :unit_test => true do
|
5
|
-
|
6
|
-
let(:clazz) { CukeModeler::DocString }
|
7
|
-
let(:doc_string) { clazz.new }
|
8
|
-
|
9
|
-
describe 'common behavior' do
|
10
|
-
|
11
|
-
it_should_behave_like 'a model'
|
12
|
-
it_should_behave_like 'a parsed model'
|
13
|
-
it_should_behave_like 'a sourced model'
|
14
|
-
|
15
|
-
end
|
16
|
-
|
17
|
-
|
18
|
-
describe 'unique behavior' do
|
19
|
-
|
20
|
-
it 'has a content type' do
|
21
|
-
expect(doc_string).to respond_to(:content_type)
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'can change its content type' do
|
25
|
-
expect(doc_string).to respond_to(:content_type=)
|
26
|
-
|
27
|
-
doc_string.content_type = :some_content_type
|
28
|
-
expect(doc_string.content_type).to eq(:some_content_type)
|
29
|
-
doc_string.content_type = :some_other_content_type
|
30
|
-
expect(doc_string.content_type).to eq(:some_other_content_type)
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'has content' do
|
34
|
-
expect(doc_string).to respond_to(:content)
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'can change its content' do
|
38
|
-
expect(doc_string).to respond_to(:content=)
|
39
|
-
|
40
|
-
doc_string.content = :some_content
|
41
|
-
expect(doc_string.content).to eq(:some_content)
|
42
|
-
doc_string.content = :some_other_content
|
43
|
-
expect(doc_string.content).to eq(:some_other_content)
|
44
|
-
end
|
45
|
-
|
46
|
-
|
47
|
-
describe 'abstract instantiation' do
|
48
|
-
|
49
|
-
context 'a new doc string object' do
|
50
|
-
|
51
|
-
let(:doc_string) { clazz.new }
|
52
|
-
|
53
|
-
|
54
|
-
it 'starts with no content type' do
|
55
|
-
expect(doc_string.content_type).to be_nil
|
56
|
-
end
|
57
|
-
|
58
|
-
it 'starts with no content' do
|
59
|
-
expect(doc_string.content).to be_nil
|
60
|
-
end
|
61
|
-
|
62
|
-
end
|
63
|
-
|
64
|
-
end
|
65
|
-
|
66
|
-
|
67
|
-
describe 'doc string output' do
|
68
|
-
|
69
|
-
context 'from abstract instantiation' do
|
70
|
-
|
71
|
-
context 'a new doc string object' do
|
72
|
-
|
73
|
-
let(:doc_string) { clazz.new }
|
74
|
-
|
75
|
-
|
76
|
-
it 'can output an empty doc string' do
|
77
|
-
expect { doc_string.to_s }.to_not raise_error
|
78
|
-
end
|
79
|
-
|
80
|
-
it 'can output a doc string that has only a content type' do
|
81
|
-
doc_string.content_type = 'some type'
|
82
|
-
|
83
|
-
expect { doc_string.to_s }.to_not raise_error
|
84
|
-
end
|
85
|
-
|
86
|
-
it 'can output a doc string that has only content' do
|
87
|
-
doc_string.content = 'foo'
|
88
|
-
|
89
|
-
expect { doc_string.to_s }.to_not raise_error
|
90
|
-
end
|
91
|
-
|
92
|
-
end
|
93
|
-
|
94
|
-
end
|
95
|
-
|
96
|
-
end
|
97
|
-
|
98
|
-
end
|
99
|
-
|
100
|
-
end
|
@@ -1,133 +0,0 @@
|
|
1
|
-
require "#{File.dirname(__FILE__)}/../spec_helper"
|
2
|
-
|
3
|
-
|
4
|
-
describe 'Example, Unit', :unit_test => true do
|
5
|
-
|
6
|
-
let(:clazz) { CukeModeler::Example }
|
7
|
-
let(:example) { clazz.new }
|
8
|
-
|
9
|
-
describe 'common behavior' do
|
10
|
-
|
11
|
-
it_should_behave_like 'a model'
|
12
|
-
it_should_behave_like 'a keyworded model'
|
13
|
-
it_should_behave_like 'a named model'
|
14
|
-
it_should_behave_like 'a described model'
|
15
|
-
it_should_behave_like 'a tagged model'
|
16
|
-
it_should_behave_like 'a sourced model'
|
17
|
-
it_should_behave_like 'a parsed model'
|
18
|
-
|
19
|
-
end
|
20
|
-
|
21
|
-
|
22
|
-
describe 'unique behavior' do
|
23
|
-
|
24
|
-
it 'has rows' do
|
25
|
-
expect(example).to respond_to(:rows)
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'can change its rows' do
|
29
|
-
expect(example).to respond_to(:rows=)
|
30
|
-
|
31
|
-
example.rows = :some_rows
|
32
|
-
expect(example.rows).to eq(:some_rows)
|
33
|
-
example.rows = :some_other_rows
|
34
|
-
expect(example.rows).to eq(:some_other_rows)
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'can selectively access its parameter row' do
|
38
|
-
expect(example).to respond_to(:parameter_row)
|
39
|
-
end
|
40
|
-
|
41
|
-
it 'can selectively access its argument rows' do
|
42
|
-
expect(example).to respond_to(:argument_rows)
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'can determine its parameters' do
|
46
|
-
expect(example).to respond_to(:parameters)
|
47
|
-
end
|
48
|
-
|
49
|
-
|
50
|
-
describe 'abstract instantiation' do
|
51
|
-
|
52
|
-
context 'a new example object' do
|
53
|
-
|
54
|
-
let(:example) { clazz.new }
|
55
|
-
|
56
|
-
|
57
|
-
it 'starts with no rows' do
|
58
|
-
expect(example.rows).to eq([])
|
59
|
-
end
|
60
|
-
|
61
|
-
it 'starts with no argument rows' do
|
62
|
-
expect(example.argument_rows).to eq([])
|
63
|
-
end
|
64
|
-
|
65
|
-
it 'starts with no parameter row' do
|
66
|
-
expect(example.parameter_row).to be_nil
|
67
|
-
end
|
68
|
-
|
69
|
-
it 'starts with no parameters' do
|
70
|
-
expect(example.parameters).to eq([])
|
71
|
-
end
|
72
|
-
|
73
|
-
end
|
74
|
-
|
75
|
-
end
|
76
|
-
|
77
|
-
|
78
|
-
it 'can add a new example row' do
|
79
|
-
expect(clazz.new).to respond_to(:add_row)
|
80
|
-
end
|
81
|
-
|
82
|
-
it 'can remove an existing example row' do
|
83
|
-
expect(clazz.new).to respond_to(:remove_row)
|
84
|
-
end
|
85
|
-
|
86
|
-
it 'contains rows and tags' do
|
87
|
-
tags = [:tag_1, :tag_2]
|
88
|
-
rows = [:row_1, :row_2]
|
89
|
-
everything = rows + tags
|
90
|
-
|
91
|
-
example.rows = rows
|
92
|
-
example.tags = tags
|
93
|
-
|
94
|
-
expect(example.children).to match_array(everything)
|
95
|
-
end
|
96
|
-
|
97
|
-
|
98
|
-
describe 'example output' do
|
99
|
-
|
100
|
-
context 'from abstract instantiation' do
|
101
|
-
|
102
|
-
let(:example) { clazz.new }
|
103
|
-
|
104
|
-
|
105
|
-
it 'can output an empty example' do
|
106
|
-
expect { example.to_s }.to_not raise_error
|
107
|
-
end
|
108
|
-
|
109
|
-
it 'can output an example that has only a keyword' do
|
110
|
-
example.keyword = 'foo'
|
111
|
-
|
112
|
-
expect(example.to_s).to eq('foo:')
|
113
|
-
end
|
114
|
-
|
115
|
-
it 'can output an example that has only a name' do
|
116
|
-
example.name = 'a name'
|
117
|
-
|
118
|
-
expect { example.to_s }.to_not raise_error
|
119
|
-
end
|
120
|
-
|
121
|
-
it 'can output an example that has only a description' do
|
122
|
-
example.description = 'a description'
|
123
|
-
|
124
|
-
expect { example.to_s }.to_not raise_error
|
125
|
-
end
|
126
|
-
|
127
|
-
end
|
128
|
-
|
129
|
-
end
|
130
|
-
|
131
|
-
end
|
132
|
-
|
133
|
-
end
|
@@ -1,125 +0,0 @@
|
|
1
|
-
require "#{File.dirname(__FILE__)}/../spec_helper"
|
2
|
-
|
3
|
-
|
4
|
-
describe 'FeatureFile, Unit', :unit_test => true do
|
5
|
-
|
6
|
-
let(:clazz) { CukeModeler::FeatureFile }
|
7
|
-
let(:feature_file) { clazz.new }
|
8
|
-
|
9
|
-
|
10
|
-
describe 'common behavior' do
|
11
|
-
|
12
|
-
it_should_behave_like 'a model'
|
13
|
-
it_should_behave_like 'a parsed model'
|
14
|
-
|
15
|
-
end
|
16
|
-
|
17
|
-
|
18
|
-
describe 'unique behavior' do
|
19
|
-
|
20
|
-
it 'has a path' do
|
21
|
-
expect(feature_file).to respond_to(:path)
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'can change its path' do
|
25
|
-
expect(feature_file).to respond_to(:path=)
|
26
|
-
|
27
|
-
feature_file.path = :some_path
|
28
|
-
expect(feature_file.path).to eq(:some_path)
|
29
|
-
feature_file.path = :some_other_path
|
30
|
-
expect(feature_file.path).to eq(:some_other_path)
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'has a feature' do
|
34
|
-
expect(feature_file).to respond_to(:feature)
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'can change its feature' do
|
38
|
-
expect(feature_file).to respond_to(:feature=)
|
39
|
-
|
40
|
-
feature_file.feature = :some_features
|
41
|
-
expect(feature_file.feature).to eq(:some_features)
|
42
|
-
feature_file.feature = :some_other_features
|
43
|
-
expect(feature_file.feature).to eq(:some_other_features)
|
44
|
-
end
|
45
|
-
|
46
|
-
it 'has comments' do
|
47
|
-
expect(feature_file).to respond_to(:comments)
|
48
|
-
end
|
49
|
-
|
50
|
-
it 'can change its comments' do
|
51
|
-
expect(feature_file).to respond_to(:comments=)
|
52
|
-
|
53
|
-
feature_file.comments = :some_comments
|
54
|
-
expect(feature_file.comments).to eq(:some_comments)
|
55
|
-
feature_file.comments = :some_other_comments
|
56
|
-
expect(feature_file.comments).to eq(:some_other_comments)
|
57
|
-
end
|
58
|
-
|
59
|
-
it 'knows the name of the file that it is modeling' do
|
60
|
-
expect(feature_file).to respond_to(:name)
|
61
|
-
end
|
62
|
-
|
63
|
-
|
64
|
-
it 'derives its file name from its path' do
|
65
|
-
feature_file.path = 'path/to/foo'
|
66
|
-
|
67
|
-
expect(feature_file.name).to eq('foo')
|
68
|
-
end
|
69
|
-
|
70
|
-
|
71
|
-
describe 'abstract instantiation' do
|
72
|
-
|
73
|
-
context 'a new feature file object' do
|
74
|
-
|
75
|
-
let(:feature_file) { clazz.new }
|
76
|
-
|
77
|
-
|
78
|
-
it 'starts with no path' do
|
79
|
-
expect(feature_file.path).to be_nil
|
80
|
-
end
|
81
|
-
|
82
|
-
it 'starts with no name' do
|
83
|
-
expect(feature_file.name).to be_nil
|
84
|
-
end
|
85
|
-
|
86
|
-
it 'starts with no feature' do
|
87
|
-
expect(feature_file.feature).to be_nil
|
88
|
-
end
|
89
|
-
|
90
|
-
it 'starts with no comments' do
|
91
|
-
expect(feature_file.comments).to eq([])
|
92
|
-
end
|
93
|
-
|
94
|
-
end
|
95
|
-
|
96
|
-
end
|
97
|
-
|
98
|
-
it 'contains a feature' do
|
99
|
-
feature = :a_feature
|
100
|
-
everything = [feature]
|
101
|
-
|
102
|
-
feature_file.feature = feature
|
103
|
-
|
104
|
-
expect(feature_file.children).to match_array(everything)
|
105
|
-
end
|
106
|
-
|
107
|
-
|
108
|
-
describe 'feature file output' do
|
109
|
-
|
110
|
-
context 'from abstract instantiation' do
|
111
|
-
|
112
|
-
let(:feature_file) { clazz.new }
|
113
|
-
|
114
|
-
|
115
|
-
it 'can output an empty feature file' do
|
116
|
-
expect { feature_file.to_s }.to_not raise_error
|
117
|
-
end
|
118
|
-
|
119
|
-
end
|
120
|
-
|
121
|
-
end
|
122
|
-
|
123
|
-
end
|
124
|
-
|
125
|
-
end
|
@@ -1,157 +0,0 @@
|
|
1
|
-
require "#{File.dirname(__FILE__)}/../spec_helper"
|
2
|
-
|
3
|
-
|
4
|
-
describe 'Feature, Unit', :unit_test => true do
|
5
|
-
|
6
|
-
let(:clazz) { CukeModeler::Feature }
|
7
|
-
let(:feature) { clazz.new }
|
8
|
-
|
9
|
-
|
10
|
-
describe 'common behavior' do
|
11
|
-
|
12
|
-
it_should_behave_like 'a model'
|
13
|
-
it_should_behave_like 'a keyworded model'
|
14
|
-
it_should_behave_like 'a named model'
|
15
|
-
it_should_behave_like 'a described model'
|
16
|
-
it_should_behave_like 'a tagged model'
|
17
|
-
it_should_behave_like 'a sourced model'
|
18
|
-
it_should_behave_like 'a parsed model'
|
19
|
-
|
20
|
-
end
|
21
|
-
|
22
|
-
|
23
|
-
describe 'unique behavior' do
|
24
|
-
|
25
|
-
it 'will complain about unknown element types' do
|
26
|
-
parsed_element = {'description' => '',
|
27
|
-
'elements' => [{'keyword' => 'Scenario', 'description' => ''},
|
28
|
-
{'keyword' => 'New Type', 'description' => ''}]}
|
29
|
-
|
30
|
-
expect { clazz.new(parsed_element) }.to raise_error(ArgumentError)
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'has a background' do
|
34
|
-
expect(feature).to respond_to(:background)
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'can change its background' do
|
38
|
-
expect(feature).to respond_to(:background=)
|
39
|
-
|
40
|
-
feature.background = :some_background
|
41
|
-
expect(feature.background).to eq(:some_background)
|
42
|
-
feature.background = :some_other_background
|
43
|
-
expect(feature.background).to eq(:some_other_background)
|
44
|
-
end
|
45
|
-
|
46
|
-
it 'knows whether or not it presently has a background - has_background?' do
|
47
|
-
feature.background = :a_background
|
48
|
-
expect(feature).to have_background
|
49
|
-
feature.background = nil
|
50
|
-
expect(feature).to_not have_background
|
51
|
-
end
|
52
|
-
|
53
|
-
it 'has tests' do
|
54
|
-
expect(feature).to respond_to(:tests)
|
55
|
-
end
|
56
|
-
|
57
|
-
it 'can change its tests' do
|
58
|
-
expect(feature).to respond_to(:tests=)
|
59
|
-
|
60
|
-
feature.tests = :some_tests
|
61
|
-
expect(feature.tests).to eq(:some_tests)
|
62
|
-
feature.tests = :some_other_tests
|
63
|
-
expect(feature.tests).to eq(:some_other_tests)
|
64
|
-
end
|
65
|
-
|
66
|
-
it 'can selectively access its scenarios' do
|
67
|
-
expect(feature).to respond_to(:scenarios)
|
68
|
-
end
|
69
|
-
|
70
|
-
it 'can selectively access its outlines' do
|
71
|
-
expect(feature).to respond_to(:outlines)
|
72
|
-
end
|
73
|
-
|
74
|
-
it 'finds no scenarios or outlines when it has no tests' do
|
75
|
-
feature.tests = []
|
76
|
-
|
77
|
-
expect(feature.scenarios).to be_empty
|
78
|
-
expect(feature.outlines).to be_empty
|
79
|
-
end
|
80
|
-
|
81
|
-
it 'contains a background, tests, and tags' do
|
82
|
-
tags = [:tag_1, :tagt_2]
|
83
|
-
tests = [:test_1, :test_2]
|
84
|
-
background = :a_background
|
85
|
-
everything = [background] + tests + tags
|
86
|
-
|
87
|
-
feature.background = background
|
88
|
-
feature.tests = tests
|
89
|
-
feature.tags = tags
|
90
|
-
|
91
|
-
expect(feature.children).to match_array(everything)
|
92
|
-
end
|
93
|
-
|
94
|
-
it 'contains a background only if one is present' do
|
95
|
-
tests = [:test_1, :test_2]
|
96
|
-
background = nil
|
97
|
-
everything = tests
|
98
|
-
|
99
|
-
feature.background = background
|
100
|
-
feature.tests = tests
|
101
|
-
|
102
|
-
expect(feature.children).to match_array(everything)
|
103
|
-
end
|
104
|
-
|
105
|
-
|
106
|
-
context 'from abstract instantiation' do
|
107
|
-
|
108
|
-
let(:feature) { clazz.new }
|
109
|
-
|
110
|
-
|
111
|
-
it 'starts with no background' do
|
112
|
-
expect(feature.background).to be_nil
|
113
|
-
end
|
114
|
-
|
115
|
-
it 'starts with no tests' do
|
116
|
-
expect(feature.tests).to eq([])
|
117
|
-
end
|
118
|
-
|
119
|
-
end
|
120
|
-
|
121
|
-
|
122
|
-
describe 'feature output' do
|
123
|
-
|
124
|
-
context 'from abstract instantiation' do
|
125
|
-
|
126
|
-
let(:feature) { clazz.new }
|
127
|
-
|
128
|
-
|
129
|
-
it 'can output an empty feature' do
|
130
|
-
expect { feature.to_s }.to_not raise_error
|
131
|
-
end
|
132
|
-
|
133
|
-
it 'can output a feature that has only a keyword' do
|
134
|
-
feature.keyword = 'foo'
|
135
|
-
|
136
|
-
expect(feature.to_s).to eq('foo:')
|
137
|
-
end
|
138
|
-
|
139
|
-
it 'can output a feature that has only a name' do
|
140
|
-
feature.name = 'a name'
|
141
|
-
|
142
|
-
expect { feature.to_s }.to_not raise_error
|
143
|
-
end
|
144
|
-
|
145
|
-
it 'can output a feature that has only a description' do
|
146
|
-
feature.description = 'a description'
|
147
|
-
|
148
|
-
expect { feature.to_s }.to_not raise_error
|
149
|
-
end
|
150
|
-
|
151
|
-
end
|
152
|
-
|
153
|
-
end
|
154
|
-
|
155
|
-
end
|
156
|
-
|
157
|
-
end
|