cuke_modeler 1.5.1 → 3.2.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 +60 -1
- data/LICENSE.txt +1 -1
- data/README.md +13 -15
- data/cuke_modeler.gemspec +12 -9
- data/lib/cuke_modeler.rb +1 -0
- 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_14_adapter.rb +12 -0
- data/lib/cuke_modeler/adapters/{gherkin_6_adapter.rb → gherkin_9_adapter.rb} +105 -69
- data/lib/cuke_modeler/containing.rb +16 -5
- 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 +16 -5
- 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/rule.rb +99 -0
- 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 +89 -102
- 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
- data/testing/cucumber/features/modeling/feature_modeling.feature +28 -7
- data/testing/cucumber/features/modeling/feature_output.feature +45 -23
- data/testing/cucumber/features/modeling/rule_modeling.feature +108 -0
- data/testing/cucumber/features/modeling/rule_output.feature +111 -0
- metadata +39 -140
- data/.gitignore +0 -18
- data/.simplecov +0 -7
- data/.travis.yml +0 -60
- data/Gemfile +0 -37
- data/Rakefile +0 -73
- data/appveyor.yml +0 -61
- 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 -33
- data/testing/gemfiles/gherkin3.gemfile +0 -26
- data/testing/gemfiles/gherkin4.gemfile +0 -27
- data/testing/gemfiles/gherkin5.gemfile +0 -27
- data/testing/gemfiles/gherkin6.gemfile +0 -10
- data/testing/rspec/spec/integration/adapters/gherkin_2_adapter_spec.rb +0 -166
- data/testing/rspec/spec/integration/adapters/gherkin_3_adapter_spec.rb +0 -166
- data/testing/rspec/spec/integration/adapters/gherkin_4_adapter_spec.rb +0 -165
- data/testing/rspec/spec/integration/adapters/gherkin_6_adapter_spec.rb +0 -166
- data/testing/rspec/spec/integration/models/background_integration_spec.rb +0 -442
- data/testing/rspec/spec/integration/models/cell_integration_spec.rb +0 -335
- data/testing/rspec/spec/integration/models/comment_integration_spec.rb +0 -177
- data/testing/rspec/spec/integration/models/directory_integration_spec.rb +0 -218
- data/testing/rspec/spec/integration/models/doc_string_integration_spec.rb +0 -402
- data/testing/rspec/spec/integration/models/example_integration_spec.rb +0 -741
- data/testing/rspec/spec/integration/models/feature_file_integration_spec.rb +0 -272
- data/testing/rspec/spec/integration/models/feature_integration_spec.rb +0 -650
- data/testing/rspec/spec/integration/models/model_integration_spec.rb +0 -15
- data/testing/rspec/spec/integration/models/outline_integration_spec.rb +0 -624
- data/testing/rspec/spec/integration/models/row_integration_spec.rb +0 -291
- data/testing/rspec/spec/integration/models/scenario_integration_spec.rb +0 -479
- data/testing/rspec/spec/integration/models/step_integration_spec.rb +0 -475
- data/testing/rspec/spec/integration/models/table_integration_spec.rb +0 -337
- data/testing/rspec/spec/integration/models/tag_integration_spec.rb +0 -259
- data/testing/rspec/spec/integration/nested_integration_spec.rb +0 -91
- data/testing/rspec/spec/integration/parsing_integration_spec.rb +0 -122
- data/testing/rspec/spec/integration/shared/models_integration_specs.rb +0 -18
- data/testing/rspec/spec/spec_helper.rb +0 -125
- data/testing/rspec/spec/unit/cuke_modeler_unit_spec.rb +0 -25
- data/testing/rspec/spec/unit/described_unit_spec.rb +0 -23
- data/testing/rspec/spec/unit/models/background_unit_spec.rb +0 -83
- data/testing/rspec/spec/unit/models/cell_unit_spec.rb +0 -68
- data/testing/rspec/spec/unit/models/comment_unit_spec.rb +0 -68
- data/testing/rspec/spec/unit/models/directory_unit_spec.rb +0 -127
- data/testing/rspec/spec/unit/models/doc_string_unit_spec.rb +0 -100
- data/testing/rspec/spec/unit/models/example_unit_spec.rb +0 -133
- data/testing/rspec/spec/unit/models/feature_file_unit_spec.rb +0 -125
- data/testing/rspec/spec/unit/models/feature_unit_spec.rb +0 -157
- data/testing/rspec/spec/unit/models/model_unit_spec.rb +0 -15
- data/testing/rspec/spec/unit/models/outline_unit_spec.rb +0 -117
- data/testing/rspec/spec/unit/models/row_unit_spec.rb +0 -68
- data/testing/rspec/spec/unit/models/scenario_unit_spec.rb +0 -86
- data/testing/rspec/spec/unit/models/step_unit_spec.rb +0 -109
- data/testing/rspec/spec/unit/models/table_unit_spec.rb +0 -77
- data/testing/rspec/spec/unit/models/tag_unit_spec.rb +0 -68
- 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/parsed_unit_spec.rb +0 -27
- data/testing/rspec/spec/unit/parsing_unit_spec.rb +0 -54
- 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 -127
- 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/stepped_unit_spec.rb +0 -23
- data/testing/rspec/spec/unit/taggable_unit_spec.rb +0 -69
- data/testing/test_languages.json +0 -45
- data/todo.txt +0 -24
@@ -1,173 +0,0 @@
|
|
1
|
-
Then(/^all of them can be output as text appropriate to the model type$/) do |code_text|
|
2
|
-
original_text = code_text
|
3
|
-
|
4
|
-
@available_model_classes.each do |clazz|
|
5
|
-
code_text = original_text.gsub('<model_class>', clazz.to_s)
|
6
|
-
|
7
|
-
expect(clazz.instance_method(:to_s).owner).to equal(clazz), "#{clazz} does not override #to_s"
|
8
|
-
|
9
|
-
# Make sure that the example code is valid
|
10
|
-
expect { eval(code_text) }.to_not raise_error
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
Then(/^the following text is provided:$/) do |expected_text|
|
15
|
-
expected_text = expected_text.sub('<path_to>', @root_test_directory)
|
16
|
-
|
17
|
-
expect(@output).to eq(expected_text)
|
18
|
-
end
|
19
|
-
|
20
|
-
Then(/^all of them can be contained inside of another model$/) do |code_text|
|
21
|
-
original_text = code_text
|
22
|
-
|
23
|
-
@available_model_classes.each do |clazz|
|
24
|
-
code_text = original_text.gsub('<model_class>', clazz.to_s)
|
25
|
-
|
26
|
-
expect(clazz.new).to respond_to(:parent_model)
|
27
|
-
|
28
|
-
# Make sure that the example code is valid
|
29
|
-
expect { eval(code_text) }.to_not raise_error
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
And(/^all of them can contain other models$/) do |code_text|
|
34
|
-
original_text = code_text
|
35
|
-
|
36
|
-
@available_model_classes.each do |clazz|
|
37
|
-
code_text = original_text.gsub('<model_class>', clazz.to_s)
|
38
|
-
|
39
|
-
expect(clazz.new).to respond_to(:children)
|
40
|
-
|
41
|
-
# Make sure that the example code is valid
|
42
|
-
expect { eval(code_text) }.to_not raise_error
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
Then(/^all of them can be created without further context$/) do |code_text|
|
47
|
-
original_text = code_text
|
48
|
-
|
49
|
-
@available_model_classes.each do |clazz|
|
50
|
-
code_text = original_text.gsub('<model_class>', clazz.to_s)
|
51
|
-
|
52
|
-
expect { clazz.new }.to_not raise_error
|
53
|
-
|
54
|
-
# Make sure that the example code is valid
|
55
|
-
expect { eval(code_text) }.to_not raise_error
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
Then(/^the model returns "([^"]*)"$/) do |value|
|
60
|
-
value.gsub!('path_to', @root_test_directory) if value.is_a?(String)
|
61
|
-
value = value.to_i if value =~ /^\d+$/
|
62
|
-
|
63
|
-
expect(@result).to eq(value)
|
64
|
-
end
|
65
|
-
|
66
|
-
Then(/^the model returns$/) do |value|
|
67
|
-
value = value.gsub('path_to', @root_test_directory) if value.is_a?(String)
|
68
|
-
|
69
|
-
expect(@result).to eq(value)
|
70
|
-
end
|
71
|
-
|
72
|
-
Then(/^the model returns models for the following feature files:$/) do |file_names|
|
73
|
-
file_names = file_names.raw.flatten
|
74
|
-
|
75
|
-
expect(@result.collect { |file_model| file_model.name }).to match_array(file_names)
|
76
|
-
end
|
77
|
-
|
78
|
-
Then(/^the model returns models for the following directories:$/) do |directory_names|
|
79
|
-
directory_names = directory_names.raw.flatten
|
80
|
-
|
81
|
-
expect(@result.collect { |directory_model| directory_model.name }).to match_array(directory_names)
|
82
|
-
end
|
83
|
-
|
84
|
-
And(/^the output can be used to make an equivalent model$/) do |code_text|
|
85
|
-
clazz = @model.class
|
86
|
-
|
87
|
-
base_output = @model.to_s
|
88
|
-
remodeled_output = clazz.new(base_output).to_s
|
89
|
-
|
90
|
-
expect(remodeled_output).to eq(base_output)
|
91
|
-
|
92
|
-
# Make sure that the example code is valid
|
93
|
-
expect { eval(code_text) }.to_not raise_error
|
94
|
-
end
|
95
|
-
|
96
|
-
Then(/^all of them provide access to the parsing data that was used to create them$/) do |code_text|
|
97
|
-
original_text = code_text
|
98
|
-
unparsed_models = [CukeModeler::Model, CukeModeler::Directory]
|
99
|
-
|
100
|
-
@available_model_classes.each do |clazz|
|
101
|
-
next if unparsed_models.include?(clazz)
|
102
|
-
|
103
|
-
expect(clazz.new).to respond_to(:parsing_data)
|
104
|
-
|
105
|
-
# Make sure that the example code is valid
|
106
|
-
code_text = original_text.gsub('<model_class>', clazz.to_s)
|
107
|
-
code_text.gsub!('<source_text>', '')
|
108
|
-
|
109
|
-
expect { eval(code_text) }.to_not raise_error
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
Then(/^the model returns models for the following steps:$/) do |step_names|
|
114
|
-
step_names = step_names.raw.flatten
|
115
|
-
|
116
|
-
expect(@result.collect { |step_model| step_model.text }).to eq(step_names)
|
117
|
-
end
|
118
|
-
|
119
|
-
Then(/^the model returns models for the following rows:$/) do |rows|
|
120
|
-
rows = rows.raw
|
121
|
-
|
122
|
-
expect(@result.collect { |row_model| row_model.cells.collect { |cell| cell.value } }).to eq(rows)
|
123
|
-
end
|
124
|
-
|
125
|
-
Then(/^the model returns a model for the following feature:$/) do |feature_name|
|
126
|
-
feature_name = feature_name.raw.flatten.first
|
127
|
-
|
128
|
-
expect(@result.name).to eq(feature_name)
|
129
|
-
end
|
130
|
-
|
131
|
-
Then(/^the model returns a model for the following table:$/) do |table_rows|
|
132
|
-
table_rows = table_rows.raw
|
133
|
-
|
134
|
-
expect(@result.rows.collect { |row| row.cells.collect { |cell| cell.value } }).to eq(table_rows)
|
135
|
-
end
|
136
|
-
|
137
|
-
Then(/^the model returns a model for the following doc string:$/) do |string_text|
|
138
|
-
expect(@result.content).to eq(string_text)
|
139
|
-
end
|
140
|
-
|
141
|
-
Then(/^the model returns a model for the background "([^"]*)"$/) do |background_name|
|
142
|
-
expect(@result.name).to eq(background_name)
|
143
|
-
end
|
144
|
-
|
145
|
-
Then(/^the model returns models for the following (?:scenario|outline|tag|example)s:$/) do |model_names|
|
146
|
-
model_names = model_names.raw.flatten
|
147
|
-
|
148
|
-
expect(@result.collect { |model| model.name }).to eq(model_names)
|
149
|
-
end
|
150
|
-
|
151
|
-
Then(/^the model returns models for the following cells:$/) do |model_values|
|
152
|
-
model_values = model_values.raw.flatten
|
153
|
-
|
154
|
-
expect(@result.collect { |model| model.value }).to eq(model_values)
|
155
|
-
end
|
156
|
-
|
157
|
-
Then(/^all of them are equivalent$/) do
|
158
|
-
expect(@results).to_not include(false)
|
159
|
-
end
|
160
|
-
|
161
|
-
But(/^none of the models are equivalent with a model for the following scenario:$/) do |gherkin_text|
|
162
|
-
model = CukeModeler::Scenario.new(gherkin_text)
|
163
|
-
|
164
|
-
@models.each do |other_model|
|
165
|
-
expect(model == other_model).to_not be true
|
166
|
-
end
|
167
|
-
end
|
168
|
-
|
169
|
-
Then(/^the model returns models for the following comments:$/) do |model_values|
|
170
|
-
model_values = model_values.raw.flatten
|
171
|
-
|
172
|
-
expect(@result.collect { |model| model.text }).to eq(model_values)
|
173
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
unless RUBY_VERSION.to_s < '1.9.0'
|
2
|
-
require 'simplecov'
|
3
|
-
SimpleCov.command_name('cucumber_tests')
|
4
|
-
end
|
5
|
-
|
6
|
-
require 'test/unit/assertions'
|
7
|
-
include Test::Unit::Assertions
|
8
|
-
|
9
|
-
this_dir = File.dirname(__FILE__)
|
10
|
-
|
11
|
-
require "#{this_dir}/../../../lib/cuke_modeler"
|
12
|
-
|
13
|
-
require "#{this_dir}/../../file_helper"
|
14
|
-
|
15
|
-
|
16
|
-
Before do
|
17
|
-
begin
|
18
|
-
@root_test_directory = CukeModeler::FileHelper.create_directory
|
19
|
-
rescue => e
|
20
|
-
$stdout.puts 'Problem caught in Before hook!'
|
21
|
-
$stdout.puts "Type: #{e.class}"
|
22
|
-
$stdout.puts "Message: #{e.message}"
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
at_exit {
|
27
|
-
CukeModeler::FileHelper.created_directories.each do |dir_path|
|
28
|
-
FileUtils.remove_entry(dir_path, true)
|
29
|
-
end
|
30
|
-
}
|
data/testing/dialect_helper.rb
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
module CukeModeler
|
2
|
-
module DialectHelper
|
3
|
-
|
4
|
-
def self.set_dialect(dialect)
|
5
|
-
@dialect = dialect
|
6
|
-
end
|
7
|
-
|
8
|
-
def self.feature_keyword
|
9
|
-
get_word(@dialect['feature'])
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.background_keyword
|
13
|
-
get_word(@dialect['background'])
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.scenario_keyword
|
17
|
-
get_word(@dialect['scenario'])
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.outline_keyword
|
21
|
-
get_word(@dialect['scenarioOutline'] || @dialect['scenario_outline'])
|
22
|
-
end
|
23
|
-
|
24
|
-
def self.example_keyword
|
25
|
-
get_word(@dialect['examples'])
|
26
|
-
end
|
27
|
-
|
28
|
-
def self.step_keyword
|
29
|
-
get_word(@dialect['given']).strip
|
30
|
-
end
|
31
|
-
|
32
|
-
def self.given_keyword
|
33
|
-
get_word(@dialect['given']).strip
|
34
|
-
end
|
35
|
-
|
36
|
-
def self.then_keyword
|
37
|
-
get_word(@dialect['then']).strip
|
38
|
-
end
|
39
|
-
|
40
|
-
def self.get_word(word_set)
|
41
|
-
word_set.is_a?(Array) ? word_set.first : word_set.split('|').first
|
42
|
-
end
|
43
|
-
|
44
|
-
|
45
|
-
private_class_method :get_word
|
46
|
-
|
47
|
-
end
|
48
|
-
end
|
data/testing/file_helper.rb
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
require 'tmpdir'
|
2
|
-
|
3
|
-
|
4
|
-
module CukeModeler
|
5
|
-
module FileHelper
|
6
|
-
|
7
|
-
class << self
|
8
|
-
|
9
|
-
def create_feature_file(options = {})
|
10
|
-
options[:text] ||= 'Feature:'
|
11
|
-
options[:name] ||= 'test_file'
|
12
|
-
|
13
|
-
create_file(:text => options[:text], :name => options[:name], :extension => '.feature', :directory => options[:directory])
|
14
|
-
end
|
15
|
-
|
16
|
-
def create_file(options = {})
|
17
|
-
options[:text] ||= ''
|
18
|
-
options[:name] ||= 'test_file'
|
19
|
-
options[:extension] ||= '.txt'
|
20
|
-
options[:directory] ||= create_directory
|
21
|
-
|
22
|
-
file_path = "#{options[:directory]}/#{options[:name]}#{options[:extension]}"
|
23
|
-
File.open(file_path, 'w') { |file| file.write(options[:text]) }
|
24
|
-
|
25
|
-
file_path
|
26
|
-
end
|
27
|
-
|
28
|
-
def created_directories
|
29
|
-
@created_directories ||= []
|
30
|
-
end
|
31
|
-
|
32
|
-
def create_directory(options = {})
|
33
|
-
options[:name] ||= 'test_directory'
|
34
|
-
options[:directory] ||= Dir.mktmpdir
|
35
|
-
|
36
|
-
path = "#{options[:directory]}/#{options[:name]}"
|
37
|
-
|
38
|
-
Dir::mkdir(path)
|
39
|
-
created_directories << options[:directory]
|
40
|
-
|
41
|
-
path
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|
45
|
-
|
46
|
-
end
|
47
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
gemspec :path => "../../"
|
4
|
-
gem "gherkin", "~> 2.0"
|
5
|
-
|
6
|
-
# cuke_modeler can play with pretty much any version of these but they all play differently with Ruby
|
7
|
-
|
8
|
-
if RUBY_VERSION =~ /^1\./
|
9
|
-
|
10
|
-
if RbConfig::CONFIG['host_os'].downcase =~ /mswin|msys|mingw32/
|
11
|
-
gem 'ffi', '< 1.9.15' # The 'ffi' gem, for Windows, requires Ruby 2.x on/after this version
|
12
|
-
end
|
13
|
-
|
14
|
-
gem 'unf_ext', '< 0.0.7.3' # Requires Ruby 2.x on/after this version
|
15
|
-
gem 'tins', '< 1.7' # The 'tins' gem requires Ruby 2.x on/after this version
|
16
|
-
gem 'json', '< 2.0' # The 'json' gem drops pre-Ruby 2.x support on/after this version
|
17
|
-
gem 'term-ansicolor', '< 1.4' # The 'term-ansicolor' gem requires Ruby 2.x on/after this version
|
18
|
-
|
19
|
-
if RUBY_VERSION =~ /^1\.8/
|
20
|
-
gem 'cucumber', '~> 1.0' # Ruby 1.8.x support dropped after this version
|
21
|
-
gem 'rainbow', '< 2.0' # Ruby 1.8.x support dropped after this version
|
22
|
-
gem 'rake', '< 11.0' # Ruby 1.8.x support dropped after this version
|
23
|
-
else
|
24
|
-
gem 'rake', '< 12.3.0' # Ruby 1.9.x support dropped after this version
|
25
|
-
end
|
26
|
-
|
27
|
-
elsif RUBY_VERSION =~ /^2\./
|
28
|
-
|
29
|
-
if RUBY_VERSION =~ /^2\.[23456789]/
|
30
|
-
gem 'test-unit'
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
gemspec :path => "../../"
|
4
|
-
gem "gherkin", "~> 3.0"
|
5
|
-
|
6
|
-
# cuke_modeler can play with pretty much any version of these but they all play differently with Ruby
|
7
|
-
|
8
|
-
if RUBY_VERSION =~ /^1\./
|
9
|
-
|
10
|
-
if RbConfig::CONFIG['host_os'].downcase =~ /mswin|msys|mingw32/
|
11
|
-
gem 'ffi', '< 1.9.15' # The 'ffi' gem, for Windows, requires Ruby 2.x on/after this version
|
12
|
-
end
|
13
|
-
|
14
|
-
gem 'unf_ext', '< 0.0.7.3' # Requires Ruby 2.x on/after this version
|
15
|
-
gem 'tins', '< 1.7' # The 'tins' gem requires Ruby 2.x on/after this version
|
16
|
-
gem 'json', '< 2.0' # The 'json' gem drops pre-Ruby 2.x support on/after this version
|
17
|
-
gem 'term-ansicolor', '< 1.4' # The 'term-ansicolor' gem requires Ruby 2.x on/after this version
|
18
|
-
gem 'rake', '< 12.3.0' # Ruby 1.9.x support dropped after this version
|
19
|
-
|
20
|
-
elsif RUBY_VERSION =~ /^2\./
|
21
|
-
|
22
|
-
if RUBY_VERSION =~ /^2\.[23456789]/
|
23
|
-
gem 'test-unit'
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
gemspec :path => "../../"
|
4
|
-
gem "gherkin", "~> 4.0"
|
5
|
-
|
6
|
-
# cuke_modeler can play with pretty much any version of these but they all play differently with Ruby
|
7
|
-
|
8
|
-
if RUBY_VERSION =~ /^1\./
|
9
|
-
|
10
|
-
if RbConfig::CONFIG['host_os'].downcase =~ /mswin|msys|mingw32/
|
11
|
-
gem 'ffi', '< 1.9.15' # The 'ffi' gem, for Windows, requires Ruby 2.x on/after this version
|
12
|
-
end
|
13
|
-
|
14
|
-
gem 'unf_ext', '< 0.0.7.3' # Requires Ruby 2.x on/after this version
|
15
|
-
gem 'tins', '< 1.7' # The 'tins' gem requires Ruby 2.x on/after this version
|
16
|
-
gem 'json', '< 2.0' # The 'json' gem drops pre-Ruby 2.x support on/after this version
|
17
|
-
gem 'term-ansicolor', '< 1.4' # The 'term-ansicolor' gem requires Ruby 2.x on/after this version
|
18
|
-
gem 'rake', '< 12.3.0' # Ruby 1.9.x support dropped after this version
|
19
|
-
gem 'cucumber', '< 3.0.0' # Ruby 1.9.x support dropped after this version
|
20
|
-
|
21
|
-
elsif RUBY_VERSION =~ /^2\./
|
22
|
-
|
23
|
-
if RUBY_VERSION =~ /^2\.[23456789]/
|
24
|
-
gem 'test-unit'
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
gemspec :path => "../../"
|
4
|
-
gem "gherkin", "~> 5.0"
|
5
|
-
|
6
|
-
# cuke_modeler can play with pretty much any version of these but they all play differently with Ruby
|
7
|
-
|
8
|
-
if RUBY_VERSION =~ /^1\./
|
9
|
-
|
10
|
-
if RbConfig::CONFIG['host_os'].downcase =~ /mswin|msys|mingw32/
|
11
|
-
gem 'ffi', '< 1.9.15' # The 'ffi' gem, for Windows, requires Ruby 2.x on/after this version
|
12
|
-
end
|
13
|
-
|
14
|
-
gem 'unf_ext', '< 0.0.7.3' # Requires Ruby 2.x on/after this version
|
15
|
-
gem 'tins', '< 1.7' # The 'tins' gem requires Ruby 2.x on/after this version
|
16
|
-
gem 'json', '< 2.0' # The 'json' gem drops pre-Ruby 2.x support on/after this version
|
17
|
-
gem 'term-ansicolor', '< 1.4' # The 'term-ansicolor' gem requires Ruby 2.x on/after this version
|
18
|
-
gem 'rake', '< 12.3.0' # Ruby 1.9.x support dropped after this version
|
19
|
-
gem 'cucumber-core', '< 3.0.0' # Ruby 1.9.x support dropped after this version
|
20
|
-
|
21
|
-
elsif RUBY_VERSION =~ /^2\./
|
22
|
-
|
23
|
-
if RUBY_VERSION =~ /^2\.[23456789]/
|
24
|
-
gem 'test-unit'
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
@@ -1,166 +0,0 @@
|
|
1
|
-
require "#{File.dirname(__FILE__)}/../../spec_helper"
|
2
|
-
|
3
|
-
|
4
|
-
describe 'Gherkin2Adapter, Integration', :gherkin2 => true do
|
5
|
-
|
6
|
-
let(:clazz) { CukeModeler::Gherkin2Adapter }
|
7
|
-
let(:adapter) { clazz.new }
|
8
|
-
let(:source_text) { "# feature comment
|
9
|
-
@tag1 @tag2 @tag3
|
10
|
-
#{FEATURE_KEYWORD}: A feature with everything it could have
|
11
|
-
|
12
|
-
Including a description
|
13
|
-
and then some.
|
14
|
-
|
15
|
-
# background comment
|
16
|
-
#{BACKGROUND_KEYWORD}:
|
17
|
-
|
18
|
-
Background
|
19
|
-
description
|
20
|
-
|
21
|
-
#{STEP_KEYWORD} a step
|
22
|
-
# table comment
|
23
|
-
| value1 |
|
24
|
-
# table row comment
|
25
|
-
| value2 |
|
26
|
-
#{STEP_KEYWORD} another step
|
27
|
-
|
28
|
-
# scenario comment
|
29
|
-
@scenario_tag
|
30
|
-
#{SCENARIO_KEYWORD}:
|
31
|
-
|
32
|
-
Scenario
|
33
|
-
description
|
34
|
-
|
35
|
-
#{STEP_KEYWORD} a step
|
36
|
-
#{STEP_KEYWORD} another step
|
37
|
-
\"\"\"
|
38
|
-
some text
|
39
|
-
\"\"\"
|
40
|
-
|
41
|
-
# outline comment
|
42
|
-
@outline_tag
|
43
|
-
#{OUTLINE_KEYWORD}:
|
44
|
-
|
45
|
-
Outline
|
46
|
-
description
|
47
|
-
|
48
|
-
# step comment
|
49
|
-
#{STEP_KEYWORD} a step
|
50
|
-
# table comment
|
51
|
-
| value2 |
|
52
|
-
# step comment
|
53
|
-
#{STEP_KEYWORD} another step
|
54
|
-
# doc string comment
|
55
|
-
\"\"\"
|
56
|
-
some text
|
57
|
-
\"\"\"
|
58
|
-
|
59
|
-
# example comment
|
60
|
-
@example_tag
|
61
|
-
#{EXAMPLE_KEYWORD}:
|
62
|
-
|
63
|
-
Example
|
64
|
-
description
|
65
|
-
|
66
|
-
# row comment
|
67
|
-
| param |
|
68
|
-
| value |
|
69
|
-
# final comment" }
|
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 }
|
73
|
-
|
74
|
-
|
75
|
-
it "does not store parsing data for a feature file's children" do
|
76
|
-
model = feature_file_model
|
77
|
-
|
78
|
-
expect(model.parsing_data).to eq([])
|
79
|
-
end
|
80
|
-
|
81
|
-
it "does not store parsing data for a feature's children" do
|
82
|
-
model = feature_model
|
83
|
-
|
84
|
-
expect(model.parsing_data['comments']).to be_nil
|
85
|
-
expect(model.parsing_data['tags']).to be_nil
|
86
|
-
expect(model.parsing_data['elements']).to be_nil
|
87
|
-
end
|
88
|
-
|
89
|
-
it "does not store parsing data for a background's children" do
|
90
|
-
model = feature_model.background
|
91
|
-
|
92
|
-
expect(model.parsing_data['comments']).to be_nil
|
93
|
-
expect(model.parsing_data['steps']).to be_nil
|
94
|
-
end
|
95
|
-
|
96
|
-
it "does not store parsing data for a scenario's children" do
|
97
|
-
model = feature_model.scenarios.first
|
98
|
-
|
99
|
-
expect(model.parsing_data['comments']).to be_nil
|
100
|
-
expect(model.parsing_data['tags']).to be_nil
|
101
|
-
expect(model.parsing_data['steps']).to be_nil
|
102
|
-
end
|
103
|
-
|
104
|
-
it "does not store parsing data for an outline's children" do
|
105
|
-
model = feature_model.outlines.first
|
106
|
-
|
107
|
-
expect(model.parsing_data['comments']).to be_nil
|
108
|
-
expect(model.parsing_data['tags']).to be_nil
|
109
|
-
expect(model.parsing_data['steps']).to be_nil
|
110
|
-
expect(model.parsing_data['examples']).to be_nil
|
111
|
-
end
|
112
|
-
|
113
|
-
it "does not store parsing data for an example's children" do
|
114
|
-
model = feature_model.outlines.first.examples.first
|
115
|
-
|
116
|
-
expect(model.parsing_data['comments']).to be_nil
|
117
|
-
expect(model.parsing_data['tags']).to be_nil
|
118
|
-
expect(model.parsing_data['rows']).to be_nil
|
119
|
-
end
|
120
|
-
|
121
|
-
it "does not store parsing data for an example row's children" do
|
122
|
-
model = feature_model.outlines.first.examples.first.rows.first
|
123
|
-
|
124
|
-
expect(model.parsing_data['comments']).to be_nil
|
125
|
-
expect(model.parsing_data['cells']).to be_nil
|
126
|
-
end
|
127
|
-
|
128
|
-
it "does not store parsing data for a step's children, table" do
|
129
|
-
model = feature_model.outlines.first.steps.first
|
130
|
-
|
131
|
-
expect(model.parsing_data['comments']).to be_nil
|
132
|
-
expect(model.parsing_data['rows']).to be_nil
|
133
|
-
end
|
134
|
-
|
135
|
-
it "does not store parsing data for a step's children, doc string" do
|
136
|
-
model = feature_model.outlines.first.steps.last
|
137
|
-
|
138
|
-
expect(model.parsing_data['comments']).to be_nil
|
139
|
-
expect(model.parsing_data['doc_string']).to be_nil
|
140
|
-
end
|
141
|
-
|
142
|
-
it "does not store parsing data for a table's children" do
|
143
|
-
model = feature_model.outlines.first.steps.first.block
|
144
|
-
|
145
|
-
expect(model.parsing_data).to be_empty
|
146
|
-
end
|
147
|
-
|
148
|
-
it "does not store parsing data for a table row's children" do
|
149
|
-
model = feature_model.outlines.first.steps.first.block.rows.first
|
150
|
-
|
151
|
-
expect(model.parsing_data['comments']).to be_nil
|
152
|
-
expect(model.parsing_data['cells']).to be_nil
|
153
|
-
end
|
154
|
-
|
155
|
-
|
156
|
-
describe 'stuff that is in no way part of the public API and entirely subject to change' do
|
157
|
-
|
158
|
-
it 'provides a useful explosion message if it encounters an entirely new type of test' do
|
159
|
-
partial_feature_ast = {"elements" => [{"type" => "some_unknown_type"}]}
|
160
|
-
|
161
|
-
expect { adapter.adapt_feature!(partial_feature_ast, []) }.to raise_error(ArgumentError, /Unknown.*some_unknown_type/)
|
162
|
-
end
|
163
|
-
|
164
|
-
end
|
165
|
-
|
166
|
-
end
|