cuke_modeler 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -120,124 +120,117 @@ describe 'Table, Integration' do
|
|
120
120
|
describe 'getting ancestors' do
|
121
121
|
|
122
122
|
before(:each) do
|
123
|
-
|
123
|
+
CukeModeler::FileHelper.create_feature_file(:text => source_gherkin, :name => 'table_test_file', :directory => test_directory)
|
124
|
+
end
|
124
125
|
|
125
|
-
#{@scenario_keyword}: Test test
|
126
|
-
#{@step_keyword} a step:
|
127
|
-
| a | table |"
|
128
126
|
|
129
|
-
|
130
|
-
|
131
|
-
end
|
127
|
+
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
128
|
+
let(:source_gherkin) { "#{@feature_keyword}: Test feature
|
132
129
|
|
133
|
-
|
134
|
-
|
130
|
+
#{@scenario_keyword}: Test test
|
131
|
+
#{@step_keyword} a step:
|
132
|
+
| a | table |"
|
133
|
+
}
|
134
|
+
|
135
|
+
let(:directory_model) { CukeModeler::Directory.new(test_directory) }
|
136
|
+
let(:table_model) { directory_model.feature_files.first.feature.tests.first.steps.first.block }
|
135
137
|
|
136
138
|
|
137
139
|
it 'can get its directory' do
|
138
|
-
ancestor =
|
140
|
+
ancestor = table_model.get_ancestor(:directory)
|
139
141
|
|
140
|
-
expect(ancestor).to equal(
|
142
|
+
expect(ancestor).to equal(directory_model)
|
141
143
|
end
|
142
144
|
|
143
145
|
it 'can get its feature file' do
|
144
|
-
ancestor =
|
146
|
+
ancestor = table_model.get_ancestor(:feature_file)
|
145
147
|
|
146
|
-
expect(ancestor).to equal(
|
148
|
+
expect(ancestor).to equal(directory_model.feature_files.first)
|
147
149
|
end
|
148
150
|
|
149
151
|
it 'can get its feature' do
|
150
|
-
ancestor =
|
152
|
+
ancestor = table_model.get_ancestor(:feature)
|
151
153
|
|
152
|
-
expect(ancestor).to equal(
|
154
|
+
expect(ancestor).to equal(directory_model.feature_files.first.feature)
|
153
155
|
end
|
154
156
|
|
155
157
|
context 'a table that is part of a scenario' do
|
156
158
|
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
#{@scenario_keyword}: Test test
|
161
|
-
#{@step_keyword} a step:
|
162
|
-
| a | table |"
|
159
|
+
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
160
|
+
let(:source_gherkin) { "#{@feature_keyword}: Test feature
|
163
161
|
|
164
|
-
|
165
|
-
|
166
|
-
|
162
|
+
#{@scenario_keyword}: Test test
|
163
|
+
#{@step_keyword} a step:
|
164
|
+
| a | table |"
|
165
|
+
}
|
167
166
|
|
168
|
-
let(:
|
169
|
-
let(:
|
167
|
+
let(:directory_model) { CukeModeler::Directory.new(test_directory) }
|
168
|
+
let(:table_model) { directory_model.feature_files.first.feature.tests.first.steps.first.block }
|
170
169
|
|
171
170
|
|
172
171
|
it 'can get its scenario' do
|
173
|
-
ancestor =
|
172
|
+
ancestor = table_model.get_ancestor(:scenario)
|
174
173
|
|
175
|
-
expect(ancestor).to equal(
|
174
|
+
expect(ancestor).to equal(directory_model.feature_files.first.feature.tests.first)
|
176
175
|
end
|
177
176
|
|
178
177
|
end
|
179
178
|
|
180
179
|
context 'a table that is part of an outline' do
|
181
180
|
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
file_path = "#{@default_file_directory}/table_test_file.feature"
|
193
|
-
File.open(file_path, 'w') { |file| file.write(source) }
|
194
|
-
end
|
181
|
+
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
182
|
+
let(:source_gherkin) { "#{@feature_keyword}: Test feature
|
183
|
+
|
184
|
+
#{@outline_keyword}: Test outline
|
185
|
+
#{@step_keyword} a step:
|
186
|
+
| a | table |
|
187
|
+
#{@example_keyword}:
|
188
|
+
| param |
|
189
|
+
| value |"
|
190
|
+
}
|
195
191
|
|
196
|
-
let(:
|
197
|
-
let(:
|
192
|
+
let(:directory_model) { CukeModeler::Directory.new(test_directory) }
|
193
|
+
let(:table_model) { directory_model.feature_files.first.feature.tests.first.steps.first.block }
|
198
194
|
|
199
195
|
|
200
196
|
it 'can get its outline' do
|
201
|
-
ancestor =
|
197
|
+
ancestor = table_model.get_ancestor(:outline)
|
202
198
|
|
203
|
-
expect(ancestor).to equal(
|
199
|
+
expect(ancestor).to equal(directory_model.feature_files.first.feature.tests.first)
|
204
200
|
end
|
205
201
|
|
206
202
|
end
|
207
203
|
|
208
204
|
context 'a table that is part of a background' do
|
209
205
|
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
#{@background_keyword}: Test background
|
214
|
-
#{@step_keyword} a step:
|
215
|
-
| a | table |"
|
206
|
+
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
207
|
+
let(:source_gherkin) { "#{@feature_keyword}: Test feature
|
216
208
|
|
217
|
-
|
218
|
-
|
219
|
-
|
209
|
+
#{@background_keyword}: Test background
|
210
|
+
#{@step_keyword} a step:
|
211
|
+
| a | table |"
|
212
|
+
}
|
220
213
|
|
221
|
-
let(:
|
222
|
-
let(:
|
214
|
+
let(:directory_model) { CukeModeler::Directory.new(test_directory) }
|
215
|
+
let(:table_model) { directory_model.feature_files.first.feature.background.steps.first.block }
|
223
216
|
|
224
217
|
|
225
218
|
it 'can get its background' do
|
226
|
-
ancestor =
|
219
|
+
ancestor = table_model.get_ancestor(:background)
|
227
220
|
|
228
|
-
expect(ancestor).to equal(
|
221
|
+
expect(ancestor).to equal(directory_model.feature_files.first.feature.background)
|
229
222
|
end
|
230
223
|
|
231
224
|
end
|
232
225
|
|
233
226
|
it 'can get its step' do
|
234
|
-
ancestor =
|
227
|
+
ancestor = table_model.get_ancestor(:step)
|
235
228
|
|
236
|
-
expect(ancestor).to equal(
|
229
|
+
expect(ancestor).to equal(directory_model.feature_files.first.feature.tests.first.steps.first)
|
237
230
|
end
|
238
231
|
|
239
232
|
it 'returns nil if it does not have the requested type of ancestor' do
|
240
|
-
ancestor =
|
233
|
+
ancestor = table_model.get_ancestor(:example)
|
241
234
|
|
242
235
|
expect(ancestor).to be_nil
|
243
236
|
end
|
@@ -71,126 +71,120 @@ describe 'Tag, Integration' do
|
|
71
71
|
describe 'getting ancestors' do
|
72
72
|
|
73
73
|
before(:each) do
|
74
|
-
|
75
|
-
|
74
|
+
CukeModeler::FileHelper.create_feature_file(:text => source_gherkin, :name => 'tag_test_file', :directory => test_directory)
|
75
|
+
end
|
76
76
|
|
77
|
-
#{@outline_keyword}: Test test
|
78
|
-
#{@step_keyword} a step
|
79
77
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
| a value |"
|
78
|
+
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
79
|
+
let(:source_gherkin) { "@feature_tag
|
80
|
+
#{@feature_keyword}: Test feature
|
84
81
|
|
85
|
-
|
86
|
-
|
87
|
-
end
|
82
|
+
#{@outline_keyword}: Test test
|
83
|
+
#{@step_keyword} a step
|
88
84
|
|
89
|
-
|
90
|
-
|
91
|
-
|
85
|
+
@example_tag
|
86
|
+
#{@example_keyword}: Test example
|
87
|
+
| a param |
|
88
|
+
| a value |"
|
89
|
+
}
|
90
|
+
|
91
|
+
let(:directory_model) { CukeModeler::Directory.new(test_directory) }
|
92
|
+
let(:tag_model) { directory_model.feature_files.first.feature.tests.first.examples.first.tags.first }
|
93
|
+
let(:high_level_tag_model) { directory_model.feature_files.first.feature.tags.first }
|
92
94
|
|
93
95
|
|
94
96
|
it 'can get its directory' do
|
95
|
-
ancestor =
|
97
|
+
ancestor = tag_model.get_ancestor(:directory)
|
96
98
|
|
97
|
-
expect(ancestor).to equal(
|
99
|
+
expect(ancestor).to equal(directory_model)
|
98
100
|
end
|
99
101
|
|
100
102
|
it 'can get its feature file' do
|
101
|
-
ancestor =
|
103
|
+
ancestor = tag_model.get_ancestor(:feature_file)
|
102
104
|
|
103
|
-
expect(ancestor).to equal(
|
105
|
+
expect(ancestor).to equal(directory_model.feature_files.first)
|
104
106
|
end
|
105
107
|
|
106
108
|
it 'can get its feature' do
|
107
|
-
ancestor =
|
109
|
+
ancestor = tag_model.get_ancestor(:feature)
|
108
110
|
|
109
|
-
expect(ancestor).to equal(
|
111
|
+
expect(ancestor).to equal(directory_model.feature_files.first.feature)
|
110
112
|
end
|
111
113
|
|
112
114
|
context 'a tag that is part of a scenario' do
|
113
115
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
@a_tag
|
118
|
-
#{@scenario_keyword}: Test scenario
|
119
|
-
#{@step_keyword} a step"
|
116
|
+
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
117
|
+
let(:source_gherkin) { "#{@feature_keyword}: Test feature
|
120
118
|
|
121
|
-
|
122
|
-
|
123
|
-
|
119
|
+
@a_tag
|
120
|
+
#{@scenario_keyword}: Test scenario
|
121
|
+
#{@step_keyword} a step"
|
122
|
+
}
|
124
123
|
|
125
|
-
let(:
|
126
|
-
let(:
|
124
|
+
let(:directory_model) { CukeModeler::Directory.new(test_directory) }
|
125
|
+
let(:tag_model) { directory_model.feature_files.first.feature.tests.first.tags.first }
|
127
126
|
|
128
127
|
|
129
128
|
it 'can get its scenario' do
|
130
|
-
ancestor =
|
129
|
+
ancestor = tag_model.get_ancestor(:scenario)
|
131
130
|
|
132
|
-
expect(ancestor).to equal(
|
131
|
+
expect(ancestor).to equal(directory_model.feature_files.first.feature.tests.first)
|
133
132
|
end
|
134
133
|
|
135
134
|
end
|
136
135
|
|
137
136
|
context 'a tag that is part of an outline' do
|
138
137
|
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
file_path = "#{@default_file_directory}/tag_test_file.feature"
|
150
|
-
File.open(file_path, 'w') { |file| file.write(source) }
|
151
|
-
end
|
138
|
+
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
139
|
+
let(:source_gherkin) { "#{@feature_keyword}: Test feature
|
140
|
+
|
141
|
+
@a_tag
|
142
|
+
#{@outline_keyword}: Test outline
|
143
|
+
#{@step_keyword} a step
|
144
|
+
#{@example_keyword}:
|
145
|
+
| param |
|
146
|
+
| value |"
|
147
|
+
}
|
152
148
|
|
153
|
-
let(:
|
154
|
-
let(:
|
149
|
+
let(:directory_model) { CukeModeler::Directory.new(test_directory) }
|
150
|
+
let(:tag_model) { directory_model.feature_files.first.feature.tests.first.tags.first }
|
155
151
|
|
156
152
|
|
157
153
|
it 'can get its outline' do
|
158
|
-
ancestor =
|
154
|
+
ancestor = tag_model.get_ancestor(:outline)
|
159
155
|
|
160
|
-
expect(ancestor).to equal(
|
156
|
+
expect(ancestor).to equal(directory_model.feature_files.first.feature.tests.first)
|
161
157
|
end
|
162
158
|
|
163
159
|
end
|
164
160
|
|
165
161
|
context 'a tag that is part of an example' do
|
166
162
|
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
File.open(file_path, 'w') { |file| file.write(source) }
|
178
|
-
end
|
163
|
+
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
164
|
+
let(:source_gherkin) { "#{@feature_keyword}: Test feature
|
165
|
+
|
166
|
+
#{@outline_keyword}: Test outline
|
167
|
+
#{@step_keyword} a step
|
168
|
+
@a_tag
|
169
|
+
#{@example_keyword}:
|
170
|
+
| param |
|
171
|
+
| value |"
|
172
|
+
}
|
179
173
|
|
180
|
-
let(:
|
181
|
-
let(:
|
174
|
+
let(:directory_model) { CukeModeler::Directory.new(test_directory) }
|
175
|
+
let(:tag_model) { directory_model.feature_files.first.feature.tests.first.examples.first.tags.first }
|
182
176
|
|
183
177
|
|
184
178
|
it 'can get its example' do
|
185
|
-
ancestor =
|
179
|
+
ancestor = tag_model.get_ancestor(:example)
|
186
180
|
|
187
|
-
expect(ancestor).to equal(
|
181
|
+
expect(ancestor).to equal(directory_model.feature_files.first.feature.tests.first.examples.first)
|
188
182
|
end
|
189
183
|
|
190
184
|
end
|
191
185
|
|
192
186
|
it 'returns nil if it does not have the requested type of ancestor' do
|
193
|
-
ancestor =
|
187
|
+
ancestor = high_level_tag_model.get_ancestor(:example)
|
194
188
|
|
195
189
|
expect(ancestor).to be_nil
|
196
190
|
end
|
@@ -24,7 +24,7 @@ require "#{this_dir}/unit/shared/parsed_models_unit_specs"
|
|
24
24
|
require "#{this_dir}/unit/shared/keyworded_models_unit_specs"
|
25
25
|
|
26
26
|
require "#{this_dir}/../../dialect_helper"
|
27
|
-
|
27
|
+
require "#{this_dir}/../../file_helper"
|
28
28
|
|
29
29
|
# Use a fake dialect for testing in order to avoid hard coded language assumptions in the
|
30
30
|
# implementation. Only possible with newer versions of Gherkin.
|
@@ -59,7 +59,7 @@ end
|
|
59
59
|
|
60
60
|
RSpec.configure do |config|
|
61
61
|
case Gem.loaded_specs['gherkin'].version.version
|
62
|
-
when /^
|
62
|
+
when /^[54]\./
|
63
63
|
config.filter_run_excluding :gherkin2 => true,
|
64
64
|
:gherkin3 => true,
|
65
65
|
:gherkin4 => false
|
@@ -82,22 +82,11 @@ RSpec.configure do |config|
|
|
82
82
|
@step_keyword = CukeModeler::DialectHelper.step_keyword
|
83
83
|
@given_keyword = CukeModeler::DialectHelper.given_keyword
|
84
84
|
@then_keyword = CukeModeler::DialectHelper.then_keyword
|
85
|
-
|
86
|
-
@default_file_directory = "#{this_dir}/temp_files"
|
87
|
-
@default_feature_file_name = 'test_feature.feature'
|
88
|
-
end
|
89
|
-
|
90
|
-
config.before(:each) do |spec|
|
91
|
-
unless spec.metadata[:unit_test]
|
92
|
-
FileUtils.remove_dir(@default_file_directory, true) if File.exists?(@default_file_directory)
|
93
|
-
|
94
|
-
FileUtils.mkdir(@default_file_directory)
|
95
|
-
end
|
96
85
|
end
|
97
86
|
|
98
|
-
config.after(:
|
99
|
-
|
100
|
-
FileUtils.
|
87
|
+
config.after(:all) do
|
88
|
+
CukeModeler::FileHelper.created_directories.each do |dir_path|
|
89
|
+
FileUtils.remove_entry(dir_path, true)
|
101
90
|
end
|
102
91
|
end
|
103
92
|
|
@@ -52,12 +52,6 @@ describe 'Comment, Unit', :unit_test => true do
|
|
52
52
|
|
53
53
|
describe 'comment output' do
|
54
54
|
|
55
|
-
# todo - remove these tests because they are covered by the stringifiable tests
|
56
|
-
it 'is a String' do
|
57
|
-
expect(model.to_s).to be_a(String)
|
58
|
-
end
|
59
|
-
|
60
|
-
|
61
55
|
context 'from abstract instantiation' do
|
62
56
|
|
63
57
|
let(:comment) { clazz.new }
|