cuke_modeler 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.simplecov +1 -2
- data/.travis.yml +4 -3
- data/Gemfile +1 -1
- data/History.md +5 -0
- data/README.md +2 -1
- data/Rakefile +19 -0
- data/appveyor.yml +19 -18
- data/cuke_modeler.gemspec +1 -1
- data/lib/cuke_modeler/adapters/gherkin_4_adapter.rb +1 -1
- data/lib/cuke_modeler/parsing.rb +1 -1
- data/lib/cuke_modeler/version.rb +1 -1
- data/testing/cucumber/features/analysis/test_comparison.feature +1 -4
- data/testing/cucumber/features/modeling/background_modeling.feature +1 -2
- data/testing/cucumber/features/modeling/background_output.feature +1 -2
- data/testing/cucumber/features/modeling/cell_modeling.feature +1 -2
- data/testing/cucumber/features/modeling/comment_modeling.feature +1 -2
- data/testing/cucumber/features/modeling/comment_output.feature +1 -2
- data/testing/cucumber/features/modeling/directory_modeling.feature +1 -4
- data/testing/cucumber/features/modeling/directory_output.feature +1 -2
- data/testing/cucumber/features/modeling/doc_string_modeling.feature +1 -3
- data/testing/cucumber/features/modeling/doc_string_output.feature +1 -2
- data/testing/cucumber/features/modeling/example_modeling.feature +1 -3
- data/testing/cucumber/features/modeling/example_output.feature +1 -2
- data/testing/cucumber/features/modeling/feature_file_modeling.feature +1 -3
- data/testing/cucumber/features/modeling/feature_file_output.feature +1 -2
- data/testing/cucumber/features/modeling/feature_modeling.feature +2 -5
- data/testing/cucumber/features/modeling/feature_output.feature +1 -2
- data/testing/cucumber/features/modeling/model_output.feature +1 -3
- data/testing/cucumber/features/modeling/model_structure.feature +3 -9
- data/testing/cucumber/features/modeling/outline_modeling.feature +1 -2
- data/testing/cucumber/features/modeling/outline_output.feature +1 -2
- data/testing/cucumber/features/modeling/row_modeling.feature +1 -2
- data/testing/cucumber/features/modeling/row_output.feature +1 -2
- data/testing/cucumber/features/modeling/scenario_modeling.feature +1 -2
- data/testing/cucumber/features/modeling/scenario_output.feature +1 -2
- data/testing/cucumber/features/modeling/step_modeling.feature +1 -2
- data/testing/cucumber/features/modeling/step_output.feature +1 -2
- data/testing/cucumber/features/modeling/table_modeling.feature +1 -2
- data/testing/cucumber/features/modeling/table_output.feature +1 -2
- data/testing/cucumber/features/modeling/tag_modeling.feature +1 -2
- data/testing/cucumber/features/modeling/tag_output.feature +1 -2
- data/testing/cucumber/step_definitions/directory_steps.rb +1 -1
- data/testing/cucumber/step_definitions/feature_file_steps.rb +1 -1
- data/testing/cucumber/step_definitions/modeling_steps.rb +1 -1
- data/testing/cucumber/step_definitions/setup_steps.rb +4 -6
- data/testing/cucumber/step_definitions/verification_steps.rb +3 -3
- data/testing/cucumber/support/env.rb +7 -14
- data/testing/file_helper.rb +44 -0
- data/testing/gemfiles/gherkin5.gemfile +20 -0
- data/testing/rspec/spec/integration/background_integration_spec.rb +17 -15
- data/testing/rspec/spec/integration/cell_integration_spec.rb +69 -79
- data/testing/rspec/spec/integration/comment_integration_spec.rb +16 -15
- data/testing/rspec/spec/integration/directory_integration_spec.rb +46 -55
- data/testing/rspec/spec/integration/doc_string_integration_spec.rb +73 -80
- data/testing/rspec/spec/integration/example_integration_spec.rb +53 -36
- data/testing/rspec/spec/integration/feature_file_integration_spec.rb +27 -42
- data/testing/rspec/spec/integration/feature_integration_spec.rb +12 -11
- data/testing/rspec/spec/integration/gherkin_2_adapter_spec.rb +14 -16
- data/testing/rspec/spec/integration/gherkin_3_adapter_spec.rb +14 -16
- data/testing/rspec/spec/integration/gherkin_4_adapter_spec.rb +14 -16
- data/testing/rspec/spec/integration/outline_integration_spec.rb +20 -18
- data/testing/rspec/spec/integration/parsing_integration_spec.rb +1 -1
- data/testing/rspec/spec/integration/row_integration_spec.rb +57 -64
- data/testing/rspec/spec/integration/scenario_integration_spec.rb +17 -15
- data/testing/rspec/spec/integration/step_integration_spec.rb +48 -55
- data/testing/rspec/spec/integration/table_integration_spec.rb +54 -61
- data/testing/rspec/spec/integration/tag_integration_spec.rb +61 -67
- data/testing/rspec/spec/spec_helper.rb +5 -16
- data/testing/rspec/spec/unit/background_unit_spec.rb +0 -5
- data/testing/rspec/spec/unit/cell_unit_spec.rb +0 -5
- data/testing/rspec/spec/unit/comment_unit_spec.rb +0 -6
- data/testing/rspec/spec/unit/directory_unit_spec.rb +0 -5
- data/testing/rspec/spec/unit/doc_string_unit_spec.rb +0 -5
- data/testing/rspec/spec/unit/example_unit_spec.rb +0 -5
- data/testing/rspec/spec/unit/feature_file_unit_spec.rb +0 -5
- data/testing/rspec/spec/unit/feature_unit_spec.rb +0 -5
- data/testing/rspec/spec/unit/outline_unit_spec.rb +0 -5
- data/testing/rspec/spec/unit/row_unit_spec.rb +0 -5
- data/testing/rspec/spec/unit/scenario_unit_spec.rb +0 -5
- data/testing/rspec/spec/unit/shared/stringifiable_models_unit_specs.rb +1 -1
- data/testing/rspec/spec/unit/step_unit_spec.rb +0 -5
- data/testing/rspec/spec/unit/table_unit_spec.rb +0 -5
- data/testing/rspec/spec/unit/tag_unit_spec.rb +0 -5
- data/todo.txt +0 -4
- metadata +6 -4
@@ -67,42 +67,40 @@ describe 'Gherkin4Adapter, Integration', :gherkin4 => true do
|
|
67
67
|
| param |
|
68
68
|
| value |
|
69
69
|
# final comment" }
|
70
|
-
let(:
|
71
|
-
|
72
|
-
|
73
|
-
CukeModeler::FeatureFile.new(path) }
|
74
|
-
let(:feature) { feature_file.feature }
|
70
|
+
let(:feature_file_model) { test_file_path = CukeModeler::FileHelper.create_feature_file(:text => source_text, :name => 'adapter_test_file')
|
71
|
+
CukeModeler::FeatureFile.new(test_file_path) }
|
72
|
+
let(:feature_model) { feature_file_model.feature }
|
75
73
|
|
76
74
|
|
77
75
|
it "does not store parsing data for a feature file's children" do
|
78
|
-
model =
|
76
|
+
model = feature_file_model
|
79
77
|
|
80
78
|
expect(model.parsing_data[:comments]).to be_nil
|
81
79
|
expect(model.parsing_data[:feature]).to be_nil
|
82
80
|
end
|
83
81
|
|
84
82
|
it "does not store parsing data for a feature's children" do
|
85
|
-
model =
|
83
|
+
model = feature_model
|
86
84
|
|
87
85
|
expect(model.parsing_data[:tags]).to be_nil
|
88
86
|
expect(model.parsing_data[:children]).to be_nil
|
89
87
|
end
|
90
88
|
|
91
89
|
it "does not store parsing data for a background's children" do
|
92
|
-
model =
|
90
|
+
model = feature_model.background
|
93
91
|
|
94
92
|
expect(model.parsing_data[:steps]).to be_nil
|
95
93
|
end
|
96
94
|
|
97
95
|
it "does not store parsing data for a scenario's children" do
|
98
|
-
model =
|
96
|
+
model = feature_model.scenarios.first
|
99
97
|
|
100
98
|
expect(model.parsing_data[:tags]).to be_nil
|
101
99
|
expect(model.parsing_data[:steps]).to be_nil
|
102
100
|
end
|
103
101
|
|
104
102
|
it "does not store parsing data for an outline's children" do
|
105
|
-
model =
|
103
|
+
model = feature_model.outlines.first
|
106
104
|
|
107
105
|
expect(model.parsing_data[:tags]).to be_nil
|
108
106
|
expect(model.parsing_data[:steps]).to be_nil
|
@@ -110,7 +108,7 @@ describe 'Gherkin4Adapter, Integration', :gherkin4 => true do
|
|
110
108
|
end
|
111
109
|
|
112
110
|
it "does not store parsing data for an example's children" do
|
113
|
-
model =
|
111
|
+
model = feature_model.outlines.first.examples.first
|
114
112
|
|
115
113
|
expect(model.parsing_data[:tags]).to be_nil
|
116
114
|
expect(model.parsing_data[:tableHeader]).to be_nil
|
@@ -118,31 +116,31 @@ describe 'Gherkin4Adapter, Integration', :gherkin4 => true do
|
|
118
116
|
end
|
119
117
|
|
120
118
|
it "does not store parsing data for an example row's children" do
|
121
|
-
model =
|
119
|
+
model = feature_model.outlines.first.examples.first.rows.first
|
122
120
|
|
123
121
|
expect(model.parsing_data[:cells]).to be_nil
|
124
122
|
end
|
125
123
|
|
126
124
|
it "does not store parsing data for a step's children, table" do
|
127
|
-
model =
|
125
|
+
model = feature_model.outlines.first.steps.first
|
128
126
|
|
129
127
|
expect(model.parsing_data[:argument]).to be_nil
|
130
128
|
end
|
131
129
|
|
132
130
|
it "does not store parsing data for a step's children, doc string" do
|
133
|
-
model =
|
131
|
+
model = feature_model.outlines.first.steps.last
|
134
132
|
|
135
133
|
expect(model.parsing_data[:argument]).to be_nil
|
136
134
|
end
|
137
135
|
|
138
136
|
it "does not store parsing data for a table's children" do
|
139
|
-
model =
|
137
|
+
model = feature_model.outlines.first.steps.first.block
|
140
138
|
|
141
139
|
expect(model.parsing_data[:rows]).to be_nil
|
142
140
|
end
|
143
141
|
|
144
142
|
it "does not store parsing data for a table row's children" do
|
145
|
-
model =
|
143
|
+
model = feature_model.outlines.first.steps.first.block.rows.first
|
146
144
|
|
147
145
|
expect(model.parsing_data[:cells]).to be_nil
|
148
146
|
end
|
@@ -108,42 +108,44 @@ describe 'Outline, Integration' do
|
|
108
108
|
describe 'getting ancestors' do
|
109
109
|
|
110
110
|
before(:each) do
|
111
|
-
|
111
|
+
CukeModeler::FileHelper.create_feature_file(:text => source_gherkin, :name => 'outline_test_file', :directory => test_directory)
|
112
|
+
end
|
112
113
|
|
113
|
-
#{@outline_keyword}: Test test
|
114
|
-
#{@step_keyword} a step
|
115
|
-
#{@example_keyword}: Test example
|
116
|
-
| a param |
|
117
|
-
| a value |"
|
118
114
|
|
119
|
-
|
120
|
-
|
121
|
-
|
115
|
+
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
116
|
+
let(:source_gherkin) { "#{@feature_keyword}: Test feature
|
117
|
+
|
118
|
+
#{@outline_keyword}: Test test
|
119
|
+
#{@step_keyword} a step
|
120
|
+
#{@example_keyword}: Test example
|
121
|
+
| a param |
|
122
|
+
| a value |"
|
123
|
+
}
|
122
124
|
|
123
|
-
let(:
|
124
|
-
let(:
|
125
|
+
let(:directory_model) { CukeModeler::Directory.new(test_directory) }
|
126
|
+
let(:outline_model) { directory_model.feature_files.first.feature.tests.first }
|
125
127
|
|
126
128
|
|
127
129
|
it 'can get its directory' do
|
128
|
-
ancestor =
|
130
|
+
ancestor = outline_model.get_ancestor(:directory)
|
129
131
|
|
130
|
-
expect(ancestor).to equal(
|
132
|
+
expect(ancestor).to equal(directory_model)
|
131
133
|
end
|
132
134
|
|
133
135
|
it 'can get its feature file' do
|
134
|
-
ancestor =
|
136
|
+
ancestor = outline_model.get_ancestor(:feature_file)
|
135
137
|
|
136
|
-
expect(ancestor).to equal(
|
138
|
+
expect(ancestor).to equal(directory_model.feature_files.first)
|
137
139
|
end
|
138
140
|
|
139
141
|
it 'can get its feature' do
|
140
|
-
ancestor =
|
142
|
+
ancestor = outline_model.get_ancestor(:feature)
|
141
143
|
|
142
|
-
expect(ancestor).to equal(
|
144
|
+
expect(ancestor).to equal(directory_model.feature_files.first.feature)
|
143
145
|
end
|
144
146
|
|
145
147
|
it 'returns nil if it does not have the requested type of ancestor' do
|
146
|
-
ancestor =
|
148
|
+
ancestor = outline_model.get_ancestor(:test)
|
147
149
|
|
148
150
|
expect(ancestor).to be_nil
|
149
151
|
end
|
@@ -46,7 +46,7 @@ describe 'Parsing, Integration' do
|
|
46
46
|
expect { nodule.parse_text(:not_a_string) }.to raise_error(ArgumentError, /Symbol/)
|
47
47
|
end
|
48
48
|
|
49
|
-
# todo - Stop doing this. Just return a feature file rooted AST.
|
49
|
+
# todo - Stop doing this. Just return a feature file rooted AST. (Will require major version number change)
|
50
50
|
it 'returns an Array' do
|
51
51
|
result = nodule.parse_text("#{@feature_keyword}:")
|
52
52
|
expect(result).to be_a(Array)
|
@@ -83,71 +83,70 @@ describe 'Row, Integration' do
|
|
83
83
|
describe 'getting ancestors' do
|
84
84
|
|
85
85
|
before(:each) do
|
86
|
-
|
86
|
+
CukeModeler::FileHelper.create_feature_file(:text => source_gherkin, :name => 'row_test_file', :directory => test_directory)
|
87
|
+
end
|
87
88
|
|
88
|
-
#{@scenario_keyword}: Test test
|
89
|
-
#{@step_keyword} a step:
|
90
|
-
| a | table |"
|
91
89
|
|
92
|
-
|
93
|
-
|
94
|
-
|
90
|
+
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
91
|
+
let(:source_gherkin) { "#{@feature_keyword}: Test feature
|
92
|
+
|
93
|
+
#{@scenario_keyword}: Test test
|
94
|
+
#{@step_keyword} a step:
|
95
|
+
| a | table |"
|
96
|
+
}
|
95
97
|
|
96
|
-
let(:
|
97
|
-
let(:
|
98
|
+
let(:directory_model) { CukeModeler::Directory.new(test_directory) }
|
99
|
+
let(:row_model) { directory_model.feature_files.first.feature.tests.first.steps.first.block.rows.first }
|
98
100
|
|
99
101
|
|
100
102
|
it 'can get its directory' do
|
101
|
-
ancestor =
|
103
|
+
ancestor = row_model.get_ancestor(:directory)
|
102
104
|
|
103
|
-
expect(ancestor).to equal(
|
105
|
+
expect(ancestor).to equal(directory_model)
|
104
106
|
end
|
105
107
|
|
106
108
|
it 'can get its feature file' do
|
107
|
-
ancestor =
|
109
|
+
ancestor = row_model.get_ancestor(:feature_file)
|
108
110
|
|
109
|
-
expect(ancestor).to equal(
|
111
|
+
expect(ancestor).to equal(directory_model.feature_files.first)
|
110
112
|
end
|
111
113
|
|
112
114
|
it 'can get its feature' do
|
113
|
-
ancestor =
|
115
|
+
ancestor = row_model.get_ancestor(:feature)
|
114
116
|
|
115
|
-
expect(ancestor).to equal(
|
117
|
+
expect(ancestor).to equal(directory_model.feature_files.first.feature)
|
116
118
|
end
|
117
119
|
|
118
120
|
it 'can get its step' do
|
119
|
-
ancestor =
|
121
|
+
ancestor = row_model.get_ancestor(:step)
|
120
122
|
|
121
|
-
expect(ancestor).to equal(
|
123
|
+
expect(ancestor).to equal(directory_model.feature_files.first.feature.tests.first.steps.first)
|
122
124
|
end
|
123
125
|
|
124
126
|
it 'can get its table' do
|
125
|
-
ancestor =
|
127
|
+
ancestor = row_model.get_ancestor(:table)
|
126
128
|
|
127
|
-
expect(ancestor).to equal(
|
129
|
+
expect(ancestor).to equal(directory_model.feature_files.first.feature.tests.first.steps.first.block)
|
128
130
|
end
|
129
131
|
|
130
132
|
context 'a row that is part of a scenario' do
|
131
133
|
|
132
|
-
|
133
|
-
|
134
|
+
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
135
|
+
let(:source_gherkin) { "#{@feature_keyword}: Test feature
|
134
136
|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
file_path = "#{@default_file_directory}/row_test_file.feature"
|
140
|
-
File.open(file_path, 'w') { |file| file.write(source) }
|
141
|
-
end
|
137
|
+
#{@scenario_keyword}: Test test
|
138
|
+
#{@step_keyword} a step:
|
139
|
+
| a | table |"
|
140
|
+
}
|
142
141
|
|
143
|
-
let(:
|
144
|
-
let(:
|
142
|
+
let(:directory_model) { CukeModeler::Directory.new(test_directory) }
|
143
|
+
let(:row_model) { directory_model.feature_files.first.feature.tests.first.steps.first.block.rows.first }
|
145
144
|
|
146
145
|
|
147
146
|
it 'can get its scenario' do
|
148
|
-
ancestor =
|
147
|
+
ancestor = row_model.get_ancestor(:scenario)
|
149
148
|
|
150
|
-
expect(ancestor).to equal(
|
149
|
+
expect(ancestor).to equal(directory_model.feature_files.first.feature.tests.first)
|
151
150
|
end
|
152
151
|
|
153
152
|
end
|
@@ -155,64 +154,58 @@ describe 'Row, Integration' do
|
|
155
154
|
|
156
155
|
context 'a row that is part of a background' do
|
157
156
|
|
158
|
-
|
159
|
-
|
157
|
+
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
158
|
+
let(:source_gherkin) { "#{@feature_keyword}: Test feature
|
160
159
|
|
161
|
-
|
162
|
-
|
163
|
-
|
160
|
+
#{@background_keyword}: Test background
|
161
|
+
#{@step_keyword} a step:
|
162
|
+
| a | table |"
|
163
|
+
}
|
164
164
|
|
165
|
-
|
166
|
-
|
167
|
-
end
|
168
|
-
|
169
|
-
let(:directory) { CukeModeler::Directory.new(@default_file_directory) }
|
170
|
-
let(:row) { directory.feature_files.first.feature.background.steps.first.block.rows.first }
|
165
|
+
let(:directory_model) { CukeModeler::Directory.new(test_directory) }
|
166
|
+
let(:row_model) { directory_model.feature_files.first.feature.background.steps.first.block.rows.first }
|
171
167
|
|
172
168
|
|
173
169
|
it 'can get its background' do
|
174
|
-
ancestor =
|
170
|
+
ancestor = row_model.get_ancestor(:background)
|
175
171
|
|
176
|
-
expect(ancestor).to equal(
|
172
|
+
expect(ancestor).to equal(directory_model.feature_files.first.feature.background)
|
177
173
|
end
|
178
174
|
|
179
175
|
end
|
180
176
|
|
181
177
|
context 'a row that is part of an outline' do
|
182
178
|
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
file_path = "#{@default_file_directory}/row_test_file.feature"
|
193
|
-
File.open(file_path, 'w') { |file| file.write(source) }
|
194
|
-
end
|
179
|
+
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
180
|
+
let(:source_gherkin) { "#{@feature_keyword}: Test feature
|
181
|
+
|
182
|
+
#{@outline_keyword}: Test outline
|
183
|
+
#{@step_keyword} a step
|
184
|
+
#{@example_keyword}:
|
185
|
+
| param |
|
186
|
+
| value |"
|
187
|
+
}
|
195
188
|
|
196
|
-
let(:
|
197
|
-
let(:
|
189
|
+
let(:directory_model) { CukeModeler::Directory.new(test_directory) }
|
190
|
+
let(:row_model) { directory_model.feature_files.first.feature.tests.first.examples.first.rows.first }
|
198
191
|
|
199
192
|
|
200
193
|
it 'can get its outline' do
|
201
|
-
ancestor =
|
194
|
+
ancestor = row_model.get_ancestor(:outline)
|
202
195
|
|
203
|
-
expect(ancestor).to equal(
|
196
|
+
expect(ancestor).to equal(directory_model.feature_files.first.feature.tests.first)
|
204
197
|
end
|
205
198
|
|
206
199
|
it 'can get its example' do
|
207
|
-
ancestor =
|
200
|
+
ancestor = row_model.get_ancestor(:example)
|
208
201
|
|
209
|
-
expect(ancestor).to equal(
|
202
|
+
expect(ancestor).to equal(directory_model.feature_files.first.feature.tests.first.examples.first)
|
210
203
|
end
|
211
204
|
|
212
205
|
end
|
213
206
|
|
214
207
|
it 'returns nil if it does not have the requested type of ancestor' do
|
215
|
-
ancestor =
|
208
|
+
ancestor = row_model.get_ancestor(:outline)
|
216
209
|
|
217
210
|
expect(ancestor).to be_nil
|
218
211
|
end
|
@@ -106,39 +106,41 @@ describe 'Scenario, Integration' do
|
|
106
106
|
describe 'getting ancestors' do
|
107
107
|
|
108
108
|
before(:each) do
|
109
|
-
|
109
|
+
CukeModeler::FileHelper.create_feature_file(:text => source_gherkin, :name => 'scenario_test_file', :directory => test_directory)
|
110
|
+
end
|
110
111
|
|
111
|
-
#{@scenario_keyword}: Test test
|
112
|
-
#{@step_keyword} a step"
|
113
112
|
|
114
|
-
|
115
|
-
|
116
|
-
|
113
|
+
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
114
|
+
let(:source_gherkin) { "#{@feature_keyword}: Test feature
|
115
|
+
|
116
|
+
#{@scenario_keyword}: Test test
|
117
|
+
#{@step_keyword} a step"
|
118
|
+
}
|
117
119
|
|
118
|
-
let(:
|
119
|
-
let(:
|
120
|
+
let(:directory_model) { CukeModeler::Directory.new(test_directory) }
|
121
|
+
let(:scenario_model) { directory_model.feature_files.first.feature.tests.first }
|
120
122
|
|
121
123
|
|
122
124
|
it 'can get its directory' do
|
123
|
-
ancestor =
|
125
|
+
ancestor = scenario_model.get_ancestor(:directory)
|
124
126
|
|
125
|
-
expect(ancestor).to equal(
|
127
|
+
expect(ancestor).to equal(directory_model)
|
126
128
|
end
|
127
129
|
|
128
130
|
it 'can get its feature file' do
|
129
|
-
ancestor =
|
131
|
+
ancestor = scenario_model.get_ancestor(:feature_file)
|
130
132
|
|
131
|
-
expect(ancestor).to equal(
|
133
|
+
expect(ancestor).to equal(directory_model.feature_files.first)
|
132
134
|
end
|
133
135
|
|
134
136
|
it 'can get its feature' do
|
135
|
-
ancestor =
|
137
|
+
ancestor = scenario_model.get_ancestor(:feature)
|
136
138
|
|
137
|
-
expect(ancestor).to equal(
|
139
|
+
expect(ancestor).to equal(directory_model.feature_files.first.feature)
|
138
140
|
end
|
139
141
|
|
140
142
|
it 'returns nil if it does not have the requested type of ancestor' do
|
141
|
-
ancestor =
|
143
|
+
ancestor = scenario_model.get_ancestor(:test)
|
142
144
|
|
143
145
|
expect(ancestor).to be_nil
|
144
146
|
end
|
@@ -244,115 +244,108 @@ describe 'Step, Integration' do
|
|
244
244
|
describe 'getting ancestors' do
|
245
245
|
|
246
246
|
before(:each) do
|
247
|
-
|
247
|
+
CukeModeler::FileHelper.create_feature_file(:text => source_gherkin, :name => 'step_test_file', :directory => test_directory)
|
248
|
+
end
|
248
249
|
|
249
|
-
#{@scenario_keyword}: Test test
|
250
|
-
#{@step_keyword} a step:"
|
251
250
|
|
252
|
-
|
253
|
-
|
254
|
-
end
|
251
|
+
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
252
|
+
let(:source_gherkin) { "#{@feature_keyword}: Test feature
|
255
253
|
|
256
|
-
|
257
|
-
|
254
|
+
#{@scenario_keyword}: Test test
|
255
|
+
#{@step_keyword} a step:"
|
256
|
+
}
|
257
|
+
|
258
|
+
let(:directory_model) { CukeModeler::Directory.new(test_directory) }
|
259
|
+
let(:step_model) { directory_model.feature_files.first.feature.tests.first.steps.first }
|
258
260
|
|
259
261
|
|
260
262
|
it 'can get its directory' do
|
261
|
-
ancestor =
|
263
|
+
ancestor = step_model.get_ancestor(:directory)
|
262
264
|
|
263
|
-
expect(ancestor).to equal(
|
265
|
+
expect(ancestor).to equal(directory_model)
|
264
266
|
end
|
265
267
|
|
266
268
|
it 'can get its feature file' do
|
267
|
-
ancestor =
|
269
|
+
ancestor = step_model.get_ancestor(:feature_file)
|
268
270
|
|
269
|
-
expect(ancestor).to equal(
|
271
|
+
expect(ancestor).to equal(directory_model.feature_files.first)
|
270
272
|
end
|
271
273
|
|
272
274
|
it 'can get its feature' do
|
273
|
-
ancestor =
|
275
|
+
ancestor = step_model.get_ancestor(:feature)
|
274
276
|
|
275
|
-
expect(ancestor).to equal(
|
277
|
+
expect(ancestor).to equal(directory_model.feature_files.first.feature)
|
276
278
|
end
|
277
279
|
|
278
280
|
|
279
281
|
context 'a step that is part of a scenario' do
|
280
282
|
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
#{@scenario_keyword}: Test scenario
|
285
|
-
#{@step_keyword} a step"
|
283
|
+
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
284
|
+
let(:source_gherkin) { "#{@feature_keyword}: Test feature
|
286
285
|
|
287
|
-
|
288
|
-
|
289
|
-
|
286
|
+
#{@scenario_keyword}: Test scenario
|
287
|
+
#{@step_keyword} a step"
|
288
|
+
}
|
290
289
|
|
291
|
-
let(:
|
292
|
-
let(:
|
290
|
+
let(:directory_model) { CukeModeler::Directory.new(test_directory) }
|
291
|
+
let(:step_model) { directory_model.feature_files.first.feature.tests.first.steps.first }
|
293
292
|
|
294
293
|
|
295
294
|
it 'can get its scenario' do
|
296
|
-
ancestor =
|
295
|
+
ancestor = step_model.get_ancestor(:scenario)
|
297
296
|
|
298
|
-
expect(ancestor).to equal(
|
297
|
+
expect(ancestor).to equal(directory_model.feature_files.first.feature.tests.first)
|
299
298
|
end
|
300
299
|
|
301
300
|
end
|
302
301
|
|
303
302
|
context 'a step that is part of an outline' do
|
304
303
|
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
file_path = "#{@default_file_directory}/step_test_file.feature"
|
315
|
-
File.open(file_path, 'w') { |file| file.write(source) }
|
316
|
-
end
|
304
|
+
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
305
|
+
let(:source_gherkin) { "#{@feature_keyword}: Test feature
|
306
|
+
|
307
|
+
#{@outline_keyword}: Test outline
|
308
|
+
#{@step_keyword} a step
|
309
|
+
#{@example_keyword}:
|
310
|
+
| param |
|
311
|
+
| value |"
|
312
|
+
}
|
317
313
|
|
318
|
-
let(:
|
319
|
-
let(:
|
314
|
+
let(:directory_model) { CukeModeler::Directory.new(test_directory) }
|
315
|
+
let(:step_model) { directory_model.feature_files.first.feature.tests.first.steps.first }
|
320
316
|
|
321
317
|
|
322
318
|
it 'can get its outline' do
|
323
|
-
ancestor =
|
319
|
+
ancestor = step_model.get_ancestor(:outline)
|
324
320
|
|
325
|
-
expect(ancestor).to equal(
|
321
|
+
expect(ancestor).to equal(directory_model.feature_files.first.feature.tests.first)
|
326
322
|
end
|
327
323
|
|
328
324
|
end
|
329
325
|
|
330
326
|
context 'a step that is part of a background' do
|
331
327
|
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
#{@background_keyword}: Test background
|
336
|
-
#{@step_keyword} a step"
|
328
|
+
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
329
|
+
let(:source_gherkin) { "#{@feature_keyword}: Test feature
|
337
330
|
|
338
|
-
|
339
|
-
|
340
|
-
|
331
|
+
#{@background_keyword}: Test background
|
332
|
+
#{@step_keyword} a step"
|
333
|
+
}
|
341
334
|
|
342
|
-
let(:
|
343
|
-
let(:
|
335
|
+
let(:directory_model) { CukeModeler::Directory.new(test_directory) }
|
336
|
+
let(:step_model) { directory_model.feature_files.first.feature.background.steps.first }
|
344
337
|
|
345
338
|
|
346
339
|
it 'can get its background' do
|
347
|
-
ancestor =
|
340
|
+
ancestor = step_model.get_ancestor(:background)
|
348
341
|
|
349
|
-
expect(ancestor).to equal(
|
342
|
+
expect(ancestor).to equal(directory_model.feature_files.first.feature.background)
|
350
343
|
end
|
351
344
|
|
352
345
|
end
|
353
346
|
|
354
347
|
it 'returns nil if it does not have the requested type of ancestor' do
|
355
|
-
ancestor =
|
348
|
+
ancestor = step_model.get_ancestor(:example)
|
356
349
|
|
357
350
|
expect(ancestor).to be_nil
|
358
351
|
end
|