cuke_modeler 0.2.0 → 0.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 +7 -0
- data/.travis.yml +3 -0
- data/Gemfile +2 -1
- data/History.rdoc +9 -2
- data/Rakefile +10 -1
- data/cuke_modeler.gemspec +1 -1
- data/features/modeling/gherkin4/background_modeling.feature +64 -0
- data/features/modeling/gherkin4/background_output.feature +131 -0
- data/features/modeling/gherkin4/directory_modeling.feature +110 -0
- data/features/modeling/gherkin4/directory_output.feature +14 -0
- data/features/modeling/gherkin4/doc_string_modeling.feature +53 -0
- data/features/modeling/gherkin4/doc_string_output.feature +72 -0
- data/features/modeling/gherkin4/example_modeling.feature +100 -0
- data/features/modeling/gherkin4/example_output.feature +193 -0
- data/features/modeling/gherkin4/feature_file_modeling.feature +54 -0
- data/features/modeling/gherkin4/feature_file_output.feature +14 -0
- data/features/modeling/gherkin4/feature_modeling.feature +153 -0
- data/features/modeling/gherkin4/feature_output.feature +245 -0
- data/features/modeling/gherkin4/outline_modeling.feature +89 -0
- data/features/modeling/gherkin4/outline_output.feature +198 -0
- data/features/modeling/gherkin4/row_modeling.feature +68 -0
- data/features/modeling/gherkin4/row_output.feature +28 -0
- data/features/modeling/gherkin4/scenario_modeling.feature +78 -0
- data/features/modeling/gherkin4/scenario_output.feature +148 -0
- data/features/modeling/gherkin4/step_modeling.feature +75 -0
- data/features/modeling/gherkin4/step_output.feature +53 -0
- data/features/modeling/gherkin4/table_modeling.feature +42 -0
- data/features/modeling/gherkin4/table_output.feature +43 -0
- data/features/modeling/gherkin4/table_row_modeling.feature +57 -0
- data/features/modeling/gherkin4/table_row_output.feature +28 -0
- data/features/modeling/gherkin4/tag_modeling.feature +48 -0
- data/features/modeling/gherkin4/tag_output.feature +17 -0
- data/features/step_definitions/background_steps.rb +1 -1
- data/features/step_definitions/doc_string_steps.rb +1 -1
- data/features/step_definitions/feature_steps.rb +7 -4
- data/features/step_definitions/outline_steps.rb +2 -2
- data/features/step_definitions/step_steps.rb +2 -2
- data/features/step_definitions/table_steps.rb +1 -1
- data/features/step_definitions/tag_steps.rb +3 -3
- data/features/step_definitions/test_steps.rb +1 -1
- data/gemfiles/gherkin.gemfile +1 -0
- data/gemfiles/gherkin3.gemfile +2 -1
- data/gemfiles/gherkin4.gemfile +16 -0
- data/lib/cuke_modeler/adapters/gherkin_4_adapter.rb +220 -0
- data/lib/cuke_modeler/example.rb +1 -1
- data/lib/cuke_modeler/parsing.rb +73 -44
- data/lib/cuke_modeler/version.rb +1 -1
- data/spec/spec_helper.rb +10 -4
- data/spec/unit/background_unit_spec.rb +17 -9
- data/spec/unit/bare_bones_unit_specs.rb +3 -1
- data/spec/unit/containing_element_unit_specs.rb +3 -1
- data/spec/unit/directory_unit_spec.rb +5 -5
- data/spec/unit/doc_string_unit_spec.rb +13 -5
- data/spec/unit/example_unit_spec.rb +44 -9
- data/spec/unit/feature_element_unit_spec.rb +5 -5
- data/spec/unit/feature_element_unit_specs.rb +3 -1
- data/spec/unit/feature_file_unit_spec.rb +5 -5
- data/spec/unit/feature_unit_spec.rb +17 -9
- data/spec/unit/nested_element_unit_specs.rb +3 -1
- data/spec/unit/outline_unit_spec.rb +18 -10
- data/spec/unit/parsing_unit_spec.rb +2 -2
- data/spec/unit/prepopulated_unit_specs.rb +3 -1
- data/spec/unit/raw_element_unit_specs.rb +3 -1
- data/spec/unit/row_unit_spec.rb +15 -8
- data/spec/unit/scenario_unit_spec.rb +19 -11
- data/spec/unit/sourced_element_unit_specs.rb +3 -1
- data/spec/unit/step_unit_spec.rb +14 -6
- data/spec/unit/table_row_unit_spec.rb +15 -8
- data/spec/unit/table_unit_spec.rb +13 -5
- data/spec/unit/tag_unit_spec.rb +14 -6
- data/spec/unit/tagged_element_unit_specs.rb +3 -1
- data/spec/unit/test_element_unit_spec.rb +6 -6
- data/spec/unit/test_element_unit_specs.rb +3 -1
- metadata +86 -55
data/lib/cuke_modeler/example.rb
CHANGED
data/lib/cuke_modeler/parsing.rb
CHANGED
|
@@ -6,79 +6,108 @@ rescue LoadError => e
|
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
# Parsing will be with an 'adapter' appropriate to the version of the 'gherkin' gem that has been activated
|
|
9
|
-
|
|
9
|
+
case
|
|
10
|
+
when Gem.loaded_specs['gherkin'].version.version[/^4/]
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
require 'gherkin/parser'
|
|
13
|
+
require 'cuke_modeler/adapters/gherkin_4_adapter'
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
module CukeModeler
|
|
13
17
|
|
|
18
|
+
module Parsing
|
|
19
|
+
class << self
|
|
14
20
|
|
|
15
|
-
|
|
21
|
+
def parse_text(source_text, filename = 'cuke_modeler_fake_file.feature')
|
|
22
|
+
raise(ArgumentError, "Cannot parse #{source_text.class} objects. Strings only.") unless source_text.is_a?(String)
|
|
16
23
|
|
|
17
|
-
|
|
18
|
-
|
|
24
|
+
begin
|
|
25
|
+
parsed_result = Gherkin::Parser.new.parse(source_text)
|
|
26
|
+
rescue => e
|
|
27
|
+
raise(ArgumentError, "Error encountered while parsing '#{filename}'\n#{e.class} - #{e.message}")
|
|
28
|
+
end
|
|
19
29
|
|
|
20
|
-
|
|
21
|
-
raise(ArgumentError, "Cannot parse #{source_text.class} objects. Strings only.") unless source_text.is_a?(String)
|
|
30
|
+
adapted_result = CukeModeler::Gherkin4Adapter.new.adapt(parsed_result)
|
|
22
31
|
|
|
23
|
-
|
|
24
|
-
parsed_result = Gherkin::Parser.new.parse(source_text)
|
|
25
|
-
rescue => e
|
|
26
|
-
raise(ArgumentError, "Error encountered while parsing '#{filename}'\n#{e.class} - #{e.message}")
|
|
32
|
+
adapted_result
|
|
27
33
|
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
when Gem.loaded_specs['gherkin'].version.version[/^3/]
|
|
39
|
+
|
|
40
|
+
require 'gherkin/parser'
|
|
41
|
+
require 'cuke_modeler/adapters/gherkin_3_adapter'
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
module CukeModeler
|
|
28
45
|
|
|
29
|
-
|
|
46
|
+
module Parsing
|
|
47
|
+
class << self
|
|
30
48
|
|
|
31
|
-
|
|
49
|
+
def parse_text(source_text, filename = 'cuke_modeler_fake_file.feature')
|
|
50
|
+
raise(ArgumentError, "Cannot parse #{source_text.class} objects. Strings only.") unless source_text.is_a?(String)
|
|
51
|
+
|
|
52
|
+
begin
|
|
53
|
+
parsed_result = Gherkin::Parser.new.parse(source_text)
|
|
54
|
+
rescue => e
|
|
55
|
+
raise(ArgumentError, "Error encountered while parsing '#{filename}'\n#{e.class} - #{e.message}")
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
adapted_result = CukeModeler::Gherkin3Adapter.new.adapt(parsed_result)
|
|
59
|
+
|
|
60
|
+
adapted_result
|
|
61
|
+
end
|
|
32
62
|
end
|
|
33
63
|
end
|
|
34
64
|
end
|
|
35
|
-
end
|
|
36
65
|
|
|
37
|
-
else
|
|
66
|
+
else
|
|
38
67
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
68
|
+
require 'stringio'
|
|
69
|
+
require 'gherkin/formatter/json_formatter'
|
|
70
|
+
require 'gherkin'
|
|
71
|
+
require 'json'
|
|
72
|
+
require 'multi_json'
|
|
73
|
+
require 'cuke_modeler/adapters/gherkin_2_adapter'
|
|
45
74
|
|
|
46
75
|
|
|
47
|
-
|
|
76
|
+
module CukeModeler
|
|
48
77
|
|
|
49
|
-
|
|
78
|
+
# A module providing source text parsing functionality.
|
|
50
79
|
|
|
51
|
-
|
|
80
|
+
module Parsing
|
|
52
81
|
|
|
53
|
-
|
|
82
|
+
class << self
|
|
54
83
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
84
|
+
# Parses the Cucumber feature given in *source_text* and returns an array
|
|
85
|
+
# containing the hash representation of its logical structure.
|
|
86
|
+
def parse_text(source_text, filename = 'cuke_modeler_fake_file.feature')
|
|
87
|
+
raise(ArgumentError, "Cannot parse #{source_text.class} objects. Strings only.") unless source_text.is_a?(String)
|
|
59
88
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
89
|
+
io = StringIO.new
|
|
90
|
+
formatter = Gherkin::Formatter::JSONFormatter.new(io)
|
|
91
|
+
parser = Gherkin::Parser::Parser.new(formatter)
|
|
63
92
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
93
|
+
begin
|
|
94
|
+
parser.parse(source_text, filename, 0)
|
|
95
|
+
rescue => e
|
|
96
|
+
raise(ArgumentError, "Error encountered while parsing '#{filename}'\n#{e.class} - #{e.message}")
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
formatter.done
|
|
69
100
|
|
|
70
|
-
formatter.done
|
|
71
101
|
|
|
102
|
+
parsed_result = MultiJson.load(io.string)
|
|
103
|
+
adapted_result = CukeModeler::Gherkin2Adapter.new.adapt(parsed_result)
|
|
72
104
|
|
|
73
|
-
|
|
74
|
-
|
|
105
|
+
adapted_result
|
|
106
|
+
end
|
|
75
107
|
|
|
76
|
-
adapted_result
|
|
77
108
|
end
|
|
78
109
|
|
|
79
110
|
end
|
|
80
|
-
|
|
81
111
|
end
|
|
82
|
-
end
|
|
83
112
|
|
|
84
113
|
end
|
data/lib/cuke_modeler/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
|
@@ -14,10 +14,16 @@ require "#{File.dirname(__FILE__)}/unit/sourced_element_unit_specs"
|
|
|
14
14
|
require "#{File.dirname(__FILE__)}/unit/raw_element_unit_specs"
|
|
15
15
|
|
|
16
16
|
RSpec.configure do |config|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
case
|
|
18
|
+
when Gem.loaded_specs['gherkin'].version.version[/^4/]
|
|
19
|
+
config.filter_run_excluding :gherkin2 => true,
|
|
20
|
+
:gherkin3 => true
|
|
21
|
+
when Gem.loaded_specs['gherkin'].version.version[/^3/]
|
|
22
|
+
config.filter_run_excluding :gherkin2 => true,
|
|
23
|
+
:gherkin4 => true
|
|
24
|
+
else
|
|
25
|
+
config.filter_run_excluding :gherkin3 => true,
|
|
26
|
+
:gherkin4 => true
|
|
21
27
|
end
|
|
22
28
|
|
|
23
29
|
config.before(:all) do
|
|
@@ -4,16 +4,16 @@ SimpleCov.command_name('Background') unless RUBY_VERSION.to_s < '1.9.0'
|
|
|
4
4
|
|
|
5
5
|
describe 'Background, Unit' do
|
|
6
6
|
|
|
7
|
-
clazz
|
|
7
|
+
let(:clazz) { CukeModeler::Background }
|
|
8
8
|
|
|
9
|
-
it_should_behave_like 'a feature element'
|
|
10
|
-
it_should_behave_like 'a nested element'
|
|
11
|
-
it_should_behave_like 'a containing element'
|
|
12
|
-
it_should_behave_like 'a bare bones element'
|
|
13
|
-
it_should_behave_like 'a prepopulated element'
|
|
14
|
-
it_should_behave_like 'a test element'
|
|
15
|
-
it_should_behave_like 'a sourced element'
|
|
16
|
-
it_should_behave_like 'a raw element'
|
|
9
|
+
it_should_behave_like 'a feature element'
|
|
10
|
+
it_should_behave_like 'a nested element'
|
|
11
|
+
it_should_behave_like 'a containing element'
|
|
12
|
+
it_should_behave_like 'a bare bones element'
|
|
13
|
+
it_should_behave_like 'a prepopulated element'
|
|
14
|
+
it_should_behave_like 'a test element'
|
|
15
|
+
it_should_behave_like 'a sourced element'
|
|
16
|
+
it_should_behave_like 'a raw element'
|
|
17
17
|
|
|
18
18
|
it 'can be parsed from stand alone text' do
|
|
19
19
|
source = 'Background: test background'
|
|
@@ -30,6 +30,14 @@ describe 'Background, Unit' do
|
|
|
30
30
|
expect { clazz.new(source) }.to raise_error(/'cuke_modeler_stand_alone_background\.feature'/)
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
+
it 'stores the original data generated by the parsing adapter', :gherkin4 => true do
|
|
34
|
+
background = clazz.new('Background: test background')
|
|
35
|
+
raw_data = background.raw_element
|
|
36
|
+
|
|
37
|
+
expect(raw_data.keys).to match_array([:type, :location, :keyword, :name, :steps])
|
|
38
|
+
expect(raw_data[:type]).to eq(:Background)
|
|
39
|
+
end
|
|
40
|
+
|
|
33
41
|
it 'stores the original data generated by the parsing adapter', :gherkin3 => true do
|
|
34
42
|
background = clazz.new('Background: test background')
|
|
35
43
|
raw_data = background.raw_element
|
|
@@ -4,12 +4,12 @@ SimpleCov.command_name('Directory') unless RUBY_VERSION.to_s < '1.9.0'
|
|
|
4
4
|
|
|
5
5
|
describe 'Directory, Unit' do
|
|
6
6
|
|
|
7
|
-
clazz
|
|
7
|
+
let(:clazz) { CukeModeler::Directory }
|
|
8
8
|
|
|
9
|
-
it_should_behave_like 'a nested element'
|
|
10
|
-
it_should_behave_like 'a containing element'
|
|
11
|
-
it_should_behave_like 'a bare bones element'
|
|
12
|
-
it_should_behave_like 'a prepopulated element'
|
|
9
|
+
it_should_behave_like 'a nested element'
|
|
10
|
+
it_should_behave_like 'a containing element'
|
|
11
|
+
it_should_behave_like 'a bare bones element'
|
|
12
|
+
it_should_behave_like 'a prepopulated element'
|
|
13
13
|
|
|
14
14
|
before(:each) do
|
|
15
15
|
@directory = clazz.new
|
|
@@ -4,12 +4,12 @@ SimpleCov.command_name('DocString') unless RUBY_VERSION.to_s < '1.9.0'
|
|
|
4
4
|
|
|
5
5
|
describe 'DocString, Unit' do
|
|
6
6
|
|
|
7
|
-
clazz
|
|
7
|
+
let(:clazz) { CukeModeler::DocString }
|
|
8
8
|
|
|
9
|
-
it_should_behave_like 'a nested element'
|
|
10
|
-
it_should_behave_like 'a bare bones element'
|
|
11
|
-
it_should_behave_like 'a prepopulated element'
|
|
12
|
-
it_should_behave_like 'a raw element'
|
|
9
|
+
it_should_behave_like 'a nested element'
|
|
10
|
+
it_should_behave_like 'a bare bones element'
|
|
11
|
+
it_should_behave_like 'a prepopulated element'
|
|
12
|
+
it_should_behave_like 'a raw element'
|
|
13
13
|
|
|
14
14
|
it 'can be parsed from stand alone text' do
|
|
15
15
|
source = "\"\"\"\nsome doc string\n\"\"\""
|
|
@@ -28,6 +28,14 @@ describe 'DocString, Unit' do
|
|
|
28
28
|
expect { clazz.new(source) }.to raise_error(/'cuke_modeler_stand_alone_doc_string\.feature'/)
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
+
it 'stores the original data generated by the parsing adapter', :gherkin4 => true do
|
|
32
|
+
doc_string = clazz.new("\"\"\"\nsome doc string\n\"\"\"")
|
|
33
|
+
raw_data = doc_string.raw_element
|
|
34
|
+
|
|
35
|
+
expect(raw_data.keys).to match_array([:type, :location, :content])
|
|
36
|
+
expect(raw_data[:type]).to eq(:DocString)
|
|
37
|
+
end
|
|
38
|
+
|
|
31
39
|
it 'stores the original data generated by the parsing adapter', :gherkin3 => true do
|
|
32
40
|
doc_string = clazz.new("\"\"\"\nsome doc string\n\"\"\"")
|
|
33
41
|
raw_data = doc_string.raw_element
|
|
@@ -4,16 +4,16 @@ SimpleCov.command_name('Example') unless RUBY_VERSION.to_s < '1.9.0'
|
|
|
4
4
|
|
|
5
5
|
describe 'Example, Unit' do
|
|
6
6
|
|
|
7
|
-
clazz
|
|
7
|
+
let(:clazz) { CukeModeler::Example }
|
|
8
8
|
|
|
9
|
-
it_should_behave_like 'a feature element'
|
|
10
|
-
it_should_behave_like 'a nested element'
|
|
11
|
-
it_should_behave_like 'a tagged element'
|
|
12
|
-
it_should_behave_like 'a bare bones element'
|
|
13
|
-
it_should_behave_like 'a prepopulated element'
|
|
14
|
-
it_should_behave_like 'a sourced element'
|
|
15
|
-
it_should_behave_like 'a containing element'
|
|
16
|
-
it_should_behave_like 'a raw element'
|
|
9
|
+
it_should_behave_like 'a feature element'
|
|
10
|
+
it_should_behave_like 'a nested element'
|
|
11
|
+
it_should_behave_like 'a tagged element'
|
|
12
|
+
it_should_behave_like 'a bare bones element'
|
|
13
|
+
it_should_behave_like 'a prepopulated element'
|
|
14
|
+
it_should_behave_like 'a sourced element'
|
|
15
|
+
it_should_behave_like 'a containing element'
|
|
16
|
+
it_should_behave_like 'a raw element'
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
it 'can be parsed from stand alone text' do
|
|
@@ -29,12 +29,47 @@ describe 'Example, Unit' do
|
|
|
29
29
|
@element.name.should == 'test example'
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
+
# todo - add more tests like this to the 'barebones' test set
|
|
33
|
+
it 'can be instantiated with the minimum viable Gherkin', :gherkin4 => true do
|
|
34
|
+
source = ['Examples:']
|
|
35
|
+
source = source.join("\n")
|
|
36
|
+
|
|
37
|
+
expect { @element = clazz.new(source) }.to_not raise_error
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# todo - add more tests like this to the 'barebones' test set
|
|
41
|
+
it 'can be instantiated with the minimum viable Gherkin', :gherkin3 => true do
|
|
42
|
+
source = ['Examples:',
|
|
43
|
+
'|param|',
|
|
44
|
+
'|value|']
|
|
45
|
+
source = source.join("\n")
|
|
46
|
+
|
|
47
|
+
expect { @element = clazz.new(source) }.to_not raise_error
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# todo - add more tests like this to the 'barebones' test set
|
|
51
|
+
it 'can be instantiated with the minimum viable Gherkin', :gherkin2 => true do
|
|
52
|
+
source = ['Examples:',
|
|
53
|
+
'|param|']
|
|
54
|
+
source = source.join("\n")
|
|
55
|
+
|
|
56
|
+
expect { @element = clazz.new(source) }.to_not raise_error
|
|
57
|
+
end
|
|
58
|
+
|
|
32
59
|
it 'provides a descriptive filename when being parsed from stand alone text' do
|
|
33
60
|
source = 'bad example text'
|
|
34
61
|
|
|
35
62
|
expect { clazz.new(source) }.to raise_error(/'cuke_modeler_stand_alone_example\.feature'/)
|
|
36
63
|
end
|
|
37
64
|
|
|
65
|
+
it 'stores the original data generated by the parsing adapter', :gherkin4 => true do
|
|
66
|
+
example = clazz.new("Examples: test example\n|param|\n|value|")
|
|
67
|
+
raw_data = example.raw_element
|
|
68
|
+
|
|
69
|
+
expect(raw_data.keys).to match_array([:type, :tags, :location, :keyword, :name, :tableHeader, :tableBody])
|
|
70
|
+
expect(raw_data[:type]).to eq(:Examples)
|
|
71
|
+
end
|
|
72
|
+
|
|
38
73
|
it 'stores the original data generated by the parsing adapter', :gherkin3 => true do
|
|
39
74
|
example = clazz.new("Examples: test example\n|param|\n|value|")
|
|
40
75
|
raw_data = example.raw_element
|
|
@@ -4,12 +4,12 @@ SimpleCov.command_name('FeatureElement') unless RUBY_VERSION.to_s < '1.9.0'
|
|
|
4
4
|
|
|
5
5
|
describe 'FeatureElement, Unit' do
|
|
6
6
|
|
|
7
|
-
clazz
|
|
7
|
+
let(:clazz) { CukeModeler::FeatureElement }
|
|
8
8
|
|
|
9
|
-
it_should_behave_like 'a feature element'
|
|
10
|
-
it_should_behave_like 'a nested element'
|
|
11
|
-
it_should_behave_like 'a prepopulated element'
|
|
12
|
-
it_should_behave_like 'a bare bones element'
|
|
9
|
+
it_should_behave_like 'a feature element'
|
|
10
|
+
it_should_behave_like 'a nested element'
|
|
11
|
+
it_should_behave_like 'a prepopulated element'
|
|
12
|
+
it_should_behave_like 'a bare bones element'
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
before(:each) do
|
|
@@ -4,12 +4,12 @@ SimpleCov.command_name('FeatureFile') unless RUBY_VERSION.to_s < '1.9.0'
|
|
|
4
4
|
|
|
5
5
|
describe 'FeatureFile, Unit' do
|
|
6
6
|
|
|
7
|
-
clazz
|
|
7
|
+
let(:clazz) { CukeModeler::FeatureFile }
|
|
8
8
|
|
|
9
|
-
it_should_behave_like 'a nested element'
|
|
10
|
-
it_should_behave_like 'a containing element'
|
|
11
|
-
it_should_behave_like 'a bare bones element'
|
|
12
|
-
it_should_behave_like 'a prepopulated element'
|
|
9
|
+
it_should_behave_like 'a nested element'
|
|
10
|
+
it_should_behave_like 'a containing element'
|
|
11
|
+
it_should_behave_like 'a bare bones element'
|
|
12
|
+
it_should_behave_like 'a prepopulated element'
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
before(:each) do
|
|
@@ -4,16 +4,16 @@ SimpleCov.command_name('Feature') unless RUBY_VERSION.to_s < '1.9.0'
|
|
|
4
4
|
|
|
5
5
|
describe 'Feature, Unit' do
|
|
6
6
|
|
|
7
|
-
clazz
|
|
7
|
+
let(:clazz) { CukeModeler::Feature }
|
|
8
8
|
|
|
9
|
-
it_should_behave_like 'a feature element'
|
|
10
|
-
it_should_behave_like 'a nested element'
|
|
11
|
-
it_should_behave_like 'a containing element'
|
|
12
|
-
it_should_behave_like 'a tagged element'
|
|
13
|
-
it_should_behave_like 'a bare bones element'
|
|
14
|
-
it_should_behave_like 'a prepopulated element'
|
|
15
|
-
it_should_behave_like 'a sourced element'
|
|
16
|
-
it_should_behave_like 'a raw element'
|
|
9
|
+
it_should_behave_like 'a feature element'
|
|
10
|
+
it_should_behave_like 'a nested element'
|
|
11
|
+
it_should_behave_like 'a containing element'
|
|
12
|
+
it_should_behave_like 'a tagged element'
|
|
13
|
+
it_should_behave_like 'a bare bones element'
|
|
14
|
+
it_should_behave_like 'a prepopulated element'
|
|
15
|
+
it_should_behave_like 'a sourced element'
|
|
16
|
+
it_should_behave_like 'a raw element'
|
|
17
17
|
|
|
18
18
|
before(:each) do
|
|
19
19
|
@feature = clazz.new
|
|
@@ -34,6 +34,14 @@ describe 'Feature, Unit' do
|
|
|
34
34
|
expect { clazz.new(source) }.to raise_error(/'cuke_modeler_stand_alone_feature\.feature'/)
|
|
35
35
|
end
|
|
36
36
|
|
|
37
|
+
it 'stores the original data generated by the parsing adapter', :gherkin4 => true do
|
|
38
|
+
feature = clazz.new('Feature: test feature')
|
|
39
|
+
raw_data = feature.raw_element
|
|
40
|
+
|
|
41
|
+
expect(raw_data.keys).to match_array([:type, :tags, :location, :language, :keyword, :name, :children])
|
|
42
|
+
expect(raw_data[:type]).to eq(:Feature)
|
|
43
|
+
end
|
|
44
|
+
|
|
37
45
|
it 'stores the original data generated by the parsing adapter', :gherkin3 => true do
|
|
38
46
|
feature = clazz.new('Feature: test feature')
|
|
39
47
|
raw_data = feature.raw_element
|