cuke_modeler 0.3.0 → 0.4.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/History.rdoc +8 -0
- data/features/step_definitions/feature_steps.rb +1 -1
- data/features/step_definitions/test_steps.rb +6 -2
- data/lib/cuke_modeler/directory.rb +7 -10
- data/lib/cuke_modeler/version.rb +1 -1
- data/spec/integration/background_integration_spec.rb +53 -40
- data/spec/integration/directory_integration_spec.rb +39 -26
- data/spec/integration/doc_string_integration_spec.rb +51 -43
- data/spec/integration/example_integration_spec.rb +71 -60
- data/spec/integration/feature_file_integration_spec.rb +36 -22
- data/spec/integration/feature_integration_spec.rb +113 -104
- data/spec/integration/outline_integration_spec.rb +71 -56
- data/spec/integration/row_integration_spec.rb +72 -0
- data/spec/integration/scenario_integration_spec.rb +61 -46
- data/spec/integration/step_integration_spec.rb +126 -117
- data/spec/integration/table_integration_spec.rb +67 -52
- data/spec/integration/table_row_integration_spec.rb +48 -40
- data/spec/integration/tag_integration_spec.rb +53 -45
- data/spec/integration/world_integration_spec.rb +2 -1
- data/spec/spec_helper.rb +15 -12
- data/spec/unit/background_unit_spec.rb +65 -50
- data/spec/unit/bare_bones_unit_specs.rb +2 -3
- data/spec/unit/containing_element_unit_specs.rb +6 -7
- data/spec/unit/directory_unit_spec.rb +103 -64
- data/spec/unit/doc_string_unit_spec.rb +113 -95
- data/spec/unit/example_unit_spec.rb +235 -219
- data/spec/unit/feature_element_unit_spec.rb +6 -6
- data/spec/unit/feature_element_unit_specs.rb +28 -24
- data/spec/unit/feature_file_unit_spec.rb +73 -63
- data/spec/unit/feature_unit_spec.rb +145 -111
- data/spec/unit/nested_element_unit_specs.rb +14 -13
- data/spec/unit/nested_unit_spec.rb +24 -21
- data/spec/unit/outline_unit_spec.rb +92 -78
- data/spec/unit/parsing_unit_spec.rb +55 -51
- data/spec/unit/prepopulated_unit_specs.rb +2 -3
- data/spec/unit/raw_element_unit_specs.rb +12 -11
- data/spec/unit/raw_unit_spec.rb +15 -12
- data/spec/unit/row_unit_spec.rb +68 -52
- data/spec/unit/scenario_unit_spec.rb +76 -62
- data/spec/unit/sourceable_unit_spec.rb +8 -6
- data/spec/unit/sourced_element_unit_specs.rb +4 -6
- data/spec/unit/step_unit_spec.rb +231 -203
- data/spec/unit/table_row_unit_spec.rb +68 -52
- data/spec/unit/table_unit_spec.rb +100 -82
- data/spec/unit/tag_unit_spec.rb +62 -48
- data/spec/unit/taggable_unit_spec.rb +58 -51
- data/spec/unit/tagged_element_unit_specs.rb +28 -26
- data/spec/unit/test_element_unit_spec.rb +33 -27
- data/spec/unit/test_element_unit_specs.rb +15 -14
- data/spec/unit/world_unit_spec.rb +94 -84
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b7765a28c904d7029be528292e466d45658e0d4
|
4
|
+
data.tar.gz: e9348d536a8e54578858e3e3ba1604f62494069b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43e9dafda2fd090bc707e3aa7af7b9522b9a2eb70e8769f00ed88c3b515724473dddcc7e881d31c62c2094ef4af9719faf2f2c5c79925b32647026a32fe5aa1d
|
7
|
+
data.tar.gz: 921be93201b8a2bc6aa4a22a77ce4aa177de988017db9885a802a1c535b02ca5952c972ec874fbb20284251d8cfeb035eb4404b46dd38295f1ed859e0bcc1d2c
|
data/History.rdoc
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
=== Version 0.4.0 / 2016-05-01
|
2
|
+
|
3
|
+
* The path of a Directory object is now a changeable attribute instead of only being populated if the instance was
|
4
|
+
given a diretory to model.
|
5
|
+
* Bug fix - Fixed a bug that occurred if a Directory object was asked for its #name when it was created 'empty'
|
6
|
+
instead of modeling an existing directory.
|
7
|
+
|
8
|
+
|
1
9
|
=== Version 0.3.0 / 2016-04-24
|
2
10
|
|
3
11
|
* Support for version 4.x of the 'gherkin' gem added.
|
@@ -6,7 +6,7 @@ Then /^(?:the )?feature(?: "([^"]*)")? is found to have the following properties
|
|
6
6
|
expected = expected_value
|
7
7
|
actual = @parsed_files[file - 1].feature.send(property.to_sym).to_s
|
8
8
|
|
9
|
-
assert(actual == expected, "Expected: #{expected}\n but was: #{actual}")
|
9
|
+
assert(actual == expected, "Expected #{property} to be: #{expected}\n but was: #{actual}")
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
@@ -5,7 +5,11 @@ Then /^(?:the )?(?:feature "([^"]*)" )?test(?: "([^"]*)")? is found to have the
|
|
5
5
|
properties = properties.rows_hash
|
6
6
|
|
7
7
|
properties.each do |property, value|
|
8
|
-
|
8
|
+
|
9
|
+
actual = @parsed_files[file - 1].feature.tests[test - 1].send(property.to_sym).to_s
|
10
|
+
expected = value
|
11
|
+
|
12
|
+
assert(actual == expected, "Expected #{property} to be: #{expected}\n but was: #{actual}")
|
9
13
|
end
|
10
14
|
end
|
11
15
|
|
@@ -38,7 +42,7 @@ Then /^(?:the )?(?:feature "([^"]*)" )?test(?: "([^"]*)")? steps are as follows:
|
|
38
42
|
end
|
39
43
|
end
|
40
44
|
|
41
|
-
|
45
|
+
expect(actual_steps.flatten).to eq(steps)
|
42
46
|
end
|
43
47
|
|
44
48
|
Then /^(?:the )?(?:feature "([^"]*)" )?test(?: "([^"]*)")? is found to have the following tags:$/ do |file, test, expected_tags|
|
@@ -14,12 +14,14 @@ module CukeModeler
|
|
14
14
|
# The Directory objects contained by the Directory
|
15
15
|
attr_accessor :directories
|
16
16
|
|
17
|
+
# The file path of the Directory
|
18
|
+
attr_accessor :path
|
19
|
+
|
17
20
|
|
18
21
|
# Creates a new Directory object and, if *directory_parsed* is provided,
|
19
22
|
# populates the object.
|
20
23
|
def initialize(directory_parsed = nil)
|
21
|
-
@
|
22
|
-
|
24
|
+
@path = directory_parsed
|
23
25
|
@feature_files = []
|
24
26
|
@directories = []
|
25
27
|
|
@@ -31,12 +33,7 @@ module CukeModeler
|
|
31
33
|
|
32
34
|
# Returns the name of the directory.
|
33
35
|
def name
|
34
|
-
File.basename(@
|
35
|
-
end
|
36
|
-
|
37
|
-
# Returns the path of the directory.
|
38
|
-
def path
|
39
|
-
@directory
|
36
|
+
File.basename(@path.gsub('\\', '/')) if @path
|
40
37
|
end
|
41
38
|
|
42
39
|
# Returns the number of sub-directories contained in the directory.
|
@@ -65,12 +62,12 @@ module CukeModeler
|
|
65
62
|
|
66
63
|
|
67
64
|
def build_directory
|
68
|
-
entries = Dir.entries(@
|
65
|
+
entries = Dir.entries(@path)
|
69
66
|
entries.delete '.'
|
70
67
|
entries.delete '..'
|
71
68
|
|
72
69
|
entries.each do |entry|
|
73
|
-
entry = "#{@
|
70
|
+
entry = "#{@path}/#{entry}"
|
74
71
|
|
75
72
|
case
|
76
73
|
when File.directory?(entry)
|
data/lib/cuke_modeler/version.rb
CHANGED
@@ -4,67 +4,80 @@ SimpleCov.command_name('Background') unless RUBY_VERSION.to_s < '1.9.0'
|
|
4
4
|
|
5
5
|
describe 'Background, Integration' do
|
6
6
|
|
7
|
-
|
8
|
-
source = [' Background: Test background',
|
9
|
-
' * a step']
|
10
|
-
source = source.join("\n")
|
7
|
+
let(:clazz) { CukeModeler::Background }
|
11
8
|
|
12
|
-
background = CukeModeler::Background.new(source)
|
13
|
-
step = background.steps.first
|
14
9
|
|
15
|
-
|
16
|
-
end
|
17
|
-
|
18
|
-
context 'getting stuff' do
|
10
|
+
describe 'unique behavior' do
|
19
11
|
|
20
|
-
|
21
|
-
source = ['
|
22
|
-
''
|
23
|
-
' Background: Test background',
|
24
|
-
' * a step:']
|
12
|
+
it 'properly sets its child elements' do
|
13
|
+
source = [' Background: Test background',
|
14
|
+
' * a step']
|
25
15
|
source = source.join("\n")
|
26
16
|
|
27
|
-
|
28
|
-
|
17
|
+
background = clazz.new(source)
|
18
|
+
step = background.steps.first
|
29
19
|
|
30
|
-
|
31
|
-
@background = @directory.feature_files.first.features.first.background
|
20
|
+
expect(step.parent_element).to equal(background)
|
32
21
|
end
|
33
22
|
|
23
|
+
describe 'getting ancestors' do
|
34
24
|
|
35
|
-
|
36
|
-
|
25
|
+
before(:each) do
|
26
|
+
source = ['Feature: Test feature',
|
27
|
+
'',
|
28
|
+
' Background: Test background',
|
29
|
+
' * a step:']
|
30
|
+
source = source.join("\n")
|
37
31
|
|
38
|
-
|
39
|
-
|
32
|
+
file_path = "#{@default_file_directory}/background_test_file.feature"
|
33
|
+
File.open(file_path, 'w') { |file| file.write(source) }
|
34
|
+
end
|
40
35
|
|
41
|
-
|
42
|
-
|
36
|
+
let(:directory) { CukeModeler::Directory.new(@default_file_directory) }
|
37
|
+
let(:background) { directory.feature_files.first.features.first.background }
|
43
38
|
|
44
|
-
feature_file.should equal @directory.feature_files.first
|
45
|
-
end
|
46
39
|
|
47
|
-
|
48
|
-
|
40
|
+
it 'can get its directory' do
|
41
|
+
ancestor = background.get_ancestor(:directory)
|
49
42
|
|
50
|
-
|
51
|
-
|
43
|
+
expect(ancestor).to equal(directory)
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'can get its feature file' do
|
47
|
+
ancestor = background.get_ancestor(:feature_file)
|
48
|
+
|
49
|
+
expect(ancestor).to equal(directory.feature_files.first)
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'can get its feature' do
|
53
|
+
ancestor = background.get_ancestor(:feature)
|
52
54
|
|
53
|
-
|
54
|
-
|
55
|
+
expect(ancestor).to equal(directory.feature_files.first.features.first)
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'returns nil if it does not have the requested type of ancestor' do
|
59
|
+
ancestor = background.get_ancestor(:example)
|
60
|
+
|
61
|
+
expect(ancestor).to be_nil
|
62
|
+
end
|
55
63
|
|
56
|
-
example.should be_nil
|
57
64
|
end
|
58
65
|
|
59
|
-
|
66
|
+
describe 'background output edge cases' do
|
67
|
+
|
68
|
+
context 'a new background object' do
|
69
|
+
|
70
|
+
let(:background) { clazz.new }
|
71
|
+
|
72
|
+
|
73
|
+
it 'can output a background that has only steps' do
|
74
|
+
background.steps = [CukeModeler::Step.new]
|
60
75
|
|
61
|
-
|
76
|
+
expect { background.to_s }.to_not raise_error
|
77
|
+
end
|
62
78
|
|
63
|
-
|
64
|
-
background = CukeModeler::Background.new
|
65
|
-
background.steps = [CukeModeler::Step.new]
|
79
|
+
end
|
66
80
|
|
67
|
-
expect { background.to_s }.to_not raise_error
|
68
81
|
end
|
69
82
|
|
70
83
|
end
|
@@ -4,45 +4,58 @@ SimpleCov.command_name('Directory') unless RUBY_VERSION.to_s < '1.9.0'
|
|
4
4
|
|
5
5
|
describe 'Directory, Integration' do
|
6
6
|
|
7
|
-
|
8
|
-
nested_directory = "#{@default_file_directory}/nested_directory"
|
9
|
-
file_path = "#{@default_file_directory}/#{@default_feature_file_name}"
|
7
|
+
let(:clazz) { CukeModeler::Directory }
|
10
8
|
|
11
|
-
FileUtils.mkdir(nested_directory)
|
12
|
-
File.open(file_path, "w") { |file|
|
13
|
-
file.puts('Feature: Test feature')
|
14
|
-
}
|
15
9
|
|
16
|
-
|
17
|
-
nested_directory = directory.directories.first
|
18
|
-
file = directory.feature_files.first
|
10
|
+
describe 'unique behavior' do
|
19
11
|
|
20
|
-
|
21
|
-
file.parent_element.should equal directory
|
22
|
-
end
|
23
|
-
|
24
|
-
context 'getting stuff' do
|
25
|
-
|
26
|
-
before(:each) do
|
12
|
+
it 'properly sets its child elements' do
|
27
13
|
nested_directory = "#{@default_file_directory}/nested_directory"
|
14
|
+
file_path = "#{@default_file_directory}/#{@default_feature_file_name}"
|
15
|
+
|
28
16
|
FileUtils.mkdir(nested_directory)
|
17
|
+
File.open(file_path, "w") { |file|
|
18
|
+
file.puts('Feature: Test feature')
|
19
|
+
}
|
29
20
|
|
30
|
-
|
31
|
-
|
32
|
-
|
21
|
+
directory = clazz.new(@default_file_directory)
|
22
|
+
nested_directory = directory.directories.first
|
23
|
+
file = directory.feature_files.first
|
33
24
|
|
25
|
+
expect(nested_directory.parent_element).to equal(directory)
|
26
|
+
expect(file.parent_element).to equal(directory)
|
27
|
+
end
|
34
28
|
|
35
|
-
it '
|
36
|
-
|
29
|
+
it 'cannot model a non-existent directory' do
|
30
|
+
path = "#{@default_file_directory}/missing_directory"
|
37
31
|
|
38
|
-
|
32
|
+
expect { clazz.new(path) }.to raise_error(ArgumentError)
|
39
33
|
end
|
40
34
|
|
41
|
-
|
42
|
-
|
35
|
+
describe 'getting ancestors' do
|
36
|
+
|
37
|
+
before(:each) do
|
38
|
+
FileUtils.mkdir("#{@default_file_directory}/nested_directory")
|
39
|
+
end
|
40
|
+
|
41
|
+
let(:directory) { clazz.new(@default_file_directory) }
|
42
|
+
let(:nested_directory) { directory.directories.first }
|
43
|
+
|
44
|
+
|
45
|
+
it 'can get its directory' do
|
46
|
+
ancestor = nested_directory.get_ancestor(:directory)
|
47
|
+
|
48
|
+
expect(ancestor).to equal(directory)
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'returns nil if it does not have the requested type of ancestor' do
|
52
|
+
ancestor = nested_directory.get_ancestor(:example)
|
53
|
+
|
54
|
+
expect(ancestor).to be_nil
|
55
|
+
end
|
43
56
|
|
44
|
-
example.should be_nil
|
45
57
|
end
|
46
58
|
|
47
59
|
end
|
60
|
+
|
48
61
|
end
|
@@ -4,63 +4,71 @@ SimpleCov.command_name('DocString') unless RUBY_VERSION.to_s < '1.9.0'
|
|
4
4
|
|
5
5
|
describe 'DocString, Integration' do
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
before(:each) do
|
10
|
-
source = ['Feature: Test feature',
|
11
|
-
'',
|
12
|
-
' Scenario: Test test',
|
13
|
-
' * a big step:',
|
14
|
-
' """',
|
15
|
-
' a',
|
16
|
-
' doc',
|
17
|
-
' string',
|
18
|
-
' """']
|
19
|
-
source = source.join("\n")
|
20
|
-
|
21
|
-
file_path = "#{@default_file_directory}/doc_string_test_file.feature"
|
22
|
-
File.open(file_path, 'w') { |file| file.write(source) }
|
23
|
-
|
24
|
-
@directory = CukeModeler::Directory.new(@default_file_directory)
|
25
|
-
@doc_string = @directory.feature_files.first.features.first.tests.first.steps.first.block
|
26
|
-
end
|
7
|
+
let(:clazz) { CukeModeler::DocString }
|
27
8
|
|
28
9
|
|
29
|
-
|
30
|
-
directory = @doc_string.get_ancestor(:directory)
|
10
|
+
describe 'unique behavior' do
|
31
11
|
|
32
|
-
|
33
|
-
end
|
12
|
+
describe 'getting ancestors' do
|
34
13
|
|
35
|
-
|
36
|
-
|
14
|
+
before(:each) do
|
15
|
+
source = ['Feature: Test feature',
|
16
|
+
'',
|
17
|
+
' Scenario: Test test',
|
18
|
+
' * a big step:',
|
19
|
+
' """',
|
20
|
+
' a',
|
21
|
+
' doc',
|
22
|
+
' string',
|
23
|
+
' """']
|
24
|
+
source = source.join("\n")
|
37
25
|
|
38
|
-
|
39
|
-
|
26
|
+
file_path = "#{@default_file_directory}/doc_string_test_file.feature"
|
27
|
+
File.open(file_path, 'w') { |file| file.write(source) }
|
28
|
+
end
|
40
29
|
|
41
|
-
|
42
|
-
|
30
|
+
let(:directory) { CukeModeler::Directory.new(@default_file_directory) }
|
31
|
+
let(:doc_string) { directory.feature_files.first.features.first.tests.first.steps.first.block }
|
43
32
|
|
44
|
-
feature.should equal @directory.feature_files.first.features.first
|
45
|
-
end
|
46
33
|
|
47
|
-
|
48
|
-
|
34
|
+
it 'can get its directory' do
|
35
|
+
ancestor = doc_string.get_ancestor(:directory)
|
49
36
|
|
50
|
-
|
51
|
-
|
37
|
+
expect(ancestor).to equal(directory)
|
38
|
+
end
|
52
39
|
|
53
|
-
|
54
|
-
|
40
|
+
it 'can get its feature file' do
|
41
|
+
ancestor = doc_string.get_ancestor(:feature_file)
|
55
42
|
|
56
|
-
|
57
|
-
|
43
|
+
expect(ancestor).to equal(directory.feature_files.first)
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'can get its feature' do
|
47
|
+
ancestor = doc_string.get_ancestor(:feature)
|
58
48
|
|
59
|
-
|
60
|
-
|
49
|
+
expect(ancestor).to equal(directory.feature_files.first.features.first)
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'can get its test' do
|
53
|
+
ancestor = doc_string.get_ancestor(:test)
|
54
|
+
|
55
|
+
expect(ancestor).to equal(directory.feature_files.first.features.first.tests.first)
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'can get its step' do
|
59
|
+
ancestor = doc_string.get_ancestor(:step)
|
60
|
+
|
61
|
+
expect(ancestor).to equal(directory.feature_files.first.features.first.tests.first.steps.first)
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'returns nil if it does not have the requested type of ancestor' do
|
65
|
+
ancestor = doc_string.get_ancestor(:example)
|
66
|
+
|
67
|
+
expect(ancestor).to be_nil
|
68
|
+
end
|
61
69
|
|
62
|
-
example.should be_nil
|
63
70
|
end
|
64
71
|
|
65
72
|
end
|
73
|
+
|
66
74
|
end
|
@@ -4,92 +4,103 @@ SimpleCov.command_name('Example') unless RUBY_VERSION.to_s < '1.9.0'
|
|
4
4
|
|
5
5
|
describe 'Example, Integration' do
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
'Examples:',
|
10
|
-
' | param |',
|
11
|
-
' | value 1 |']
|
12
|
-
source = source.join("\n")
|
13
|
-
|
14
|
-
example = CukeModeler::Example.new(source)
|
15
|
-
rows = example.row_elements
|
16
|
-
tag = example.tag_elements.first
|
17
|
-
|
18
|
-
rows[0].parent_element.should equal example
|
19
|
-
rows[1].parent_element.should equal example
|
20
|
-
tag.parent_element.should equal example
|
21
|
-
end
|
7
|
+
let(:clazz) { CukeModeler::Example }
|
8
|
+
|
22
9
|
|
23
|
-
|
10
|
+
describe 'unique behavior' do
|
24
11
|
|
25
|
-
|
26
|
-
source = ['
|
27
|
-
'',
|
28
|
-
'
|
29
|
-
'
|
30
|
-
' Examples: Test example',
|
31
|
-
' | a param |',
|
32
|
-
' | a value |']
|
12
|
+
it 'properly sets its child elements' do
|
13
|
+
source = ['@a_tag',
|
14
|
+
'Examples:',
|
15
|
+
' | param |',
|
16
|
+
' | value 1 |']
|
33
17
|
source = source.join("\n")
|
34
18
|
|
35
|
-
|
36
|
-
|
19
|
+
example = clazz.new(source)
|
20
|
+
rows = example.row_elements
|
21
|
+
tag = example.tag_elements.first
|
37
22
|
|
38
|
-
|
39
|
-
|
23
|
+
expect(rows[0].parent_element).to equal(example)
|
24
|
+
expect(rows[1].parent_element).to equal(example)
|
25
|
+
expect(tag.parent_element).to equal(example)
|
40
26
|
end
|
41
27
|
|
28
|
+
describe 'getting ancestors' do
|
42
29
|
|
43
|
-
|
44
|
-
|
30
|
+
before(:each) do
|
31
|
+
source = ['Feature: Test feature',
|
32
|
+
'',
|
33
|
+
' Scenario Outline: Test test',
|
34
|
+
' * a step',
|
35
|
+
' Examples: Test example',
|
36
|
+
' | a param |',
|
37
|
+
' | a value |']
|
38
|
+
source = source.join("\n")
|
45
39
|
|
46
|
-
|
47
|
-
|
40
|
+
file_path = "#{@default_file_directory}/example_test_file.feature"
|
41
|
+
File.open(file_path, 'w') { |file| file.write(source) }
|
42
|
+
end
|
48
43
|
|
49
|
-
|
50
|
-
|
44
|
+
let(:directory) { CukeModeler::Directory.new(@default_file_directory) }
|
45
|
+
let(:example) { directory.feature_files.first.features.first.tests.first.examples.first }
|
51
46
|
|
52
|
-
feature_file.should equal @directory.feature_files.first
|
53
|
-
end
|
54
47
|
|
55
|
-
|
56
|
-
|
48
|
+
it 'can get its directory' do
|
49
|
+
ancestor = example.get_ancestor(:directory)
|
57
50
|
|
58
|
-
|
59
|
-
|
51
|
+
expect(ancestor).to equal(directory)
|
52
|
+
end
|
60
53
|
|
61
|
-
|
62
|
-
|
54
|
+
it 'can get its feature file' do
|
55
|
+
ancestor = example.get_ancestor(:feature_file)
|
63
56
|
|
64
|
-
|
65
|
-
|
57
|
+
expect(ancestor).to equal(directory.feature_files.first)
|
58
|
+
end
|
66
59
|
|
67
|
-
|
68
|
-
|
60
|
+
it 'can get its feature' do
|
61
|
+
ancestor = example.get_ancestor(:feature)
|
69
62
|
|
70
|
-
|
71
|
-
|
63
|
+
expect(ancestor).to equal(directory.feature_files.first.features.first)
|
64
|
+
end
|
72
65
|
|
73
|
-
|
66
|
+
it 'can get its test' do
|
67
|
+
ancestor = example.get_ancestor(:test)
|
74
68
|
|
75
|
-
|
69
|
+
expect(ancestor).to equal(directory.feature_files.first.features.first.tests.first)
|
70
|
+
end
|
76
71
|
|
77
|
-
|
78
|
-
|
79
|
-
end
|
72
|
+
it 'returns nil if it does not have the requested type of ancestor' do
|
73
|
+
ancestor = example.get_ancestor(:example)
|
80
74
|
|
81
|
-
|
82
|
-
|
75
|
+
expect(ancestor).to be_nil
|
76
|
+
end
|
83
77
|
|
84
|
-
expect { @example.to_s }.to_not raise_error
|
85
78
|
end
|
86
79
|
|
87
|
-
|
88
|
-
|
89
|
-
|
80
|
+
describe 'example output edge cases' do
|
81
|
+
|
82
|
+
context 'a new example object' do
|
83
|
+
|
84
|
+
let(:example) { clazz.new }
|
85
|
+
|
86
|
+
|
87
|
+
it 'can output an example that has only tag elements' do
|
88
|
+
example.tag_elements = [CukeModeler::Tag.new]
|
89
|
+
|
90
|
+
expect { example.to_s }.to_not raise_error
|
91
|
+
end
|
92
|
+
|
93
|
+
#todo - remove once Hash rows are no longer supported
|
94
|
+
it 'can output an example that has only row elements' do
|
95
|
+
example.row_elements = [CukeModeler::Row.new]
|
96
|
+
|
97
|
+
expect { example.to_s }.to_not raise_error
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
90
101
|
|
91
|
-
expect { @example.to_s }.to_not raise_error
|
92
102
|
end
|
93
103
|
|
94
104
|
end
|
105
|
+
|
95
106
|
end
|