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
@@ -5,80 +5,96 @@ SimpleCov.command_name('TableRow') unless RUBY_VERSION.to_s < '1.9.0'
|
|
5
5
|
describe 'TableRow, Unit' do
|
6
6
|
|
7
7
|
let(:clazz) { CukeModeler::TableRow }
|
8
|
+
let(:row) { clazz.new }
|
8
9
|
|
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 sourced element'
|
13
|
-
it_should_behave_like 'a raw element'
|
14
10
|
|
15
|
-
|
16
|
-
source = '| a | row |'
|
11
|
+
describe 'common behavior' do
|
17
12
|
|
18
|
-
|
13
|
+
it_should_behave_like 'a nested element'
|
14
|
+
it_should_behave_like 'a bare bones element'
|
15
|
+
it_should_behave_like 'a prepopulated element'
|
16
|
+
it_should_behave_like 'a sourced element'
|
17
|
+
it_should_behave_like 'a raw element'
|
19
18
|
|
20
|
-
# Sanity check in case instantiation failed in a non-explosive manner
|
21
|
-
@element.cells.should == ['a', 'row']
|
22
19
|
end
|
23
20
|
|
24
|
-
it 'provides a descriptive filename when being parsed from stand alone text' do
|
25
|
-
source = 'bad table row text'
|
26
21
|
|
27
|
-
|
28
|
-
end
|
22
|
+
describe 'unique behavior' do
|
29
23
|
|
30
|
-
|
31
|
-
|
32
|
-
raw_data = table_row.raw_element
|
24
|
+
it 'can be parsed from stand alone text' do
|
25
|
+
source = '| a | row |'
|
33
26
|
|
34
|
-
|
35
|
-
expect(raw_data[:type]).to eq(:TableRow)
|
36
|
-
end
|
27
|
+
expect { @element = clazz.new(source) }.to_not raise_error
|
37
28
|
|
38
|
-
|
39
|
-
|
40
|
-
|
29
|
+
# Sanity check in case instantiation failed in a non-explosive manner
|
30
|
+
@element.cells.should == ['a', 'row']
|
31
|
+
end
|
41
32
|
|
42
|
-
|
43
|
-
|
44
|
-
end
|
33
|
+
it 'provides a descriptive filename when being parsed from stand alone text' do
|
34
|
+
source = 'bad table row text'
|
45
35
|
|
46
|
-
|
47
|
-
|
48
|
-
raw_data = table_row.raw_element
|
36
|
+
expect { clazz.new(source) }.to raise_error(/'cuke_modeler_stand_alone_table_row\.feature'/)
|
37
|
+
end
|
49
38
|
|
50
|
-
|
51
|
-
|
52
|
-
|
39
|
+
it 'stores the original data generated by the parsing adapter', :gherkin4 => true do
|
40
|
+
table_row = clazz.new("| a | row |")
|
41
|
+
raw_data = table_row.raw_element
|
53
42
|
|
43
|
+
expect(raw_data.keys).to match_array([:type, :location, :cells])
|
44
|
+
expect(raw_data[:type]).to eq(:TableRow)
|
45
|
+
end
|
54
46
|
|
55
|
-
|
56
|
-
|
57
|
-
|
47
|
+
it 'stores the original data generated by the parsing adapter', :gherkin3 => true do
|
48
|
+
table_row = clazz.new("| a | row |")
|
49
|
+
raw_data = table_row.raw_element
|
58
50
|
|
59
|
-
|
60
|
-
|
61
|
-
|
51
|
+
expect(raw_data.keys).to match_array([:type, :location, :cells])
|
52
|
+
expect(raw_data[:type]).to eq('TableRow')
|
53
|
+
end
|
62
54
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
@row.cells = :some_other_cells
|
67
|
-
@row.cells.should == :some_other_cells
|
68
|
-
end
|
55
|
+
it 'stores the original data generated by the parsing adapter', :gherkin2 => true do
|
56
|
+
table_row = clazz.new("| a | row |")
|
57
|
+
raw_data = table_row.raw_element
|
69
58
|
|
70
|
-
|
71
|
-
|
72
|
-
|
59
|
+
expect(raw_data.keys).to match_array(['cells', 'line'])
|
60
|
+
expect(raw_data['cells']).to eq(['a', 'row'])
|
61
|
+
end
|
73
62
|
|
74
|
-
|
63
|
+
it 'has cells' do
|
64
|
+
row.should respond_to(:cells)
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'can get and set its cells' do
|
68
|
+
expect(row).to respond_to(:cells=)
|
69
|
+
|
70
|
+
row.cells = :some_cells
|
71
|
+
row.cells.should == :some_cells
|
72
|
+
row.cells = :some_other_cells
|
73
|
+
row.cells.should == :some_other_cells
|
74
|
+
end
|
75
75
|
|
76
|
-
it '
|
77
|
-
|
76
|
+
it 'starts with no cells' do
|
77
|
+
row.cells.should == []
|
78
78
|
end
|
79
79
|
|
80
|
-
|
81
|
-
|
80
|
+
describe 'table row output edge cases' do
|
81
|
+
|
82
|
+
it 'is a String' do
|
83
|
+
row.to_s.should be_a(String)
|
84
|
+
end
|
85
|
+
|
86
|
+
|
87
|
+
context 'a new row object' do
|
88
|
+
|
89
|
+
let(:row) { clazz.new }
|
90
|
+
|
91
|
+
|
92
|
+
it 'can output an empty table row' do
|
93
|
+
expect { row.to_s }.to_not raise_error
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
97
|
+
|
82
98
|
end
|
83
99
|
|
84
100
|
end
|
@@ -5,120 +5,138 @@ SimpleCov.command_name('Table') unless RUBY_VERSION.to_s < '1.9.0'
|
|
5
5
|
describe 'Table, Unit' do
|
6
6
|
|
7
7
|
let(:clazz) { CukeModeler::Table }
|
8
|
+
let(:table) { clazz.new }
|
8
9
|
|
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
10
|
|
14
|
-
|
15
|
-
source = '| a table |'
|
11
|
+
describe 'common behavior' do
|
16
12
|
|
17
|
-
|
13
|
+
it_should_behave_like 'a nested element'
|
14
|
+
it_should_behave_like 'a bare bones element'
|
15
|
+
it_should_behave_like 'a prepopulated element'
|
16
|
+
it_should_behave_like 'a raw element'
|
18
17
|
|
19
|
-
# Sanity check in case instantiation failed in a non-explosive manner
|
20
|
-
@element.row_elements.collect { |row| row.cells }.should == [['a table']]
|
21
|
-
# todo - remove once #contents is no longer supported
|
22
|
-
@element.contents.should == [['a table']]
|
23
18
|
end
|
24
19
|
|
25
|
-
it 'provides a descriptive filename when being parsed from stand alone text' do
|
26
|
-
source = 'bad table text'
|
27
|
-
|
28
|
-
expect { clazz.new(source) }.to raise_error(/'cuke_modeler_stand_alone_table\.feature'/)
|
29
|
-
end
|
30
20
|
|
31
|
-
|
32
|
-
table = clazz.new("| a table |")
|
33
|
-
raw_data = table.raw_element
|
34
|
-
|
35
|
-
expect(raw_data.keys).to match_array([:type, :location, :rows])
|
36
|
-
expect(raw_data[:type]).to eq(:DataTable)
|
37
|
-
end
|
21
|
+
describe 'unique behavior' do
|
38
22
|
|
39
|
-
|
40
|
-
|
41
|
-
raw_data = table.raw_element
|
23
|
+
it 'can be parsed from stand alone text' do
|
24
|
+
source = '| a table |'
|
42
25
|
|
43
|
-
|
44
|
-
expect(raw_data[:type]).to eq(:DataTable)
|
45
|
-
end
|
26
|
+
expect { @element = clazz.new(source) }.to_not raise_error
|
46
27
|
|
47
|
-
|
48
|
-
|
49
|
-
|
28
|
+
# Sanity check in case instantiation failed in a non-explosive manner
|
29
|
+
@element.row_elements.collect { |row| row.cells }.should == [['a table']]
|
30
|
+
# todo - remove once #contents is no longer supported
|
31
|
+
@element.contents.should == [['a table']]
|
32
|
+
end
|
50
33
|
|
51
|
-
|
52
|
-
|
34
|
+
it 'provides a descriptive filename when being parsed from stand alone text' do
|
35
|
+
source = 'bad table text'
|
53
36
|
|
37
|
+
expect { clazz.new(source) }.to raise_error(/'cuke_modeler_stand_alone_table\.feature'/)
|
38
|
+
end
|
54
39
|
|
55
|
-
|
56
|
-
|
57
|
-
|
40
|
+
it 'stores the original data generated by the parsing adapter', :gherkin4 => true do
|
41
|
+
table = clazz.new("| a table |")
|
42
|
+
raw_data = table.raw_element
|
58
43
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
end
|
44
|
+
expect(raw_data.keys).to match_array([:type, :location, :rows])
|
45
|
+
expect(raw_data[:type]).to eq(:DataTable)
|
46
|
+
end
|
63
47
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
@table.contents.should == :some_contents
|
68
|
-
@table.contents = :some_other_contents
|
69
|
-
@table.contents.should == :some_other_contents
|
70
|
-
end
|
48
|
+
it 'stores the original data generated by the parsing adapter', :gherkin3 => true do
|
49
|
+
table = clazz.new("| a table |")
|
50
|
+
raw_data = table.raw_element
|
71
51
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
end
|
52
|
+
expect(raw_data.keys).to match_array([:type, :location, :rows])
|
53
|
+
expect(raw_data[:type]).to eq(:DataTable)
|
54
|
+
end
|
76
55
|
|
77
|
-
|
78
|
-
|
79
|
-
|
56
|
+
it 'stores the original data generated by the parsing adapter', :gherkin2 => true do
|
57
|
+
table = clazz.new("| a table |")
|
58
|
+
raw_data = table.raw_element
|
80
59
|
|
81
|
-
|
82
|
-
|
83
|
-
@table.row_elements.should == :some_row_elements
|
84
|
-
@table.row_elements = :some_other_row_elements
|
85
|
-
@table.row_elements.should == :some_other_row_elements
|
86
|
-
end
|
60
|
+
expect(raw_data).to match_array([{"cells" => ["a table"], "line" => 4}])
|
61
|
+
end
|
87
62
|
|
88
|
-
|
89
|
-
|
90
|
-
|
63
|
+
# todo - remove once #contents is no longer supported
|
64
|
+
it 'has contents' do
|
65
|
+
table.should respond_to(:contents)
|
66
|
+
end
|
91
67
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
table = CukeModeler::Table.new(source)
|
68
|
+
# todo - remove once #contents is no longer supported
|
69
|
+
it 'can change its contents' do
|
70
|
+
expect(table).to respond_to(:contents=)
|
96
71
|
|
97
|
-
|
72
|
+
table.contents = :some_contents
|
73
|
+
table.contents.should == :some_contents
|
74
|
+
table.contents = :some_other_contents
|
75
|
+
table.contents.should == :some_other_contents
|
76
|
+
end
|
98
77
|
|
99
|
-
contents
|
78
|
+
# todo - remove once #contents is no longer supported
|
79
|
+
it 'starts with no contents' do
|
80
|
+
table.contents.should == []
|
81
|
+
end
|
100
82
|
|
101
|
-
|
102
|
-
|
103
|
-
row.each { |cell| cell.is_a?(String).should be_true }
|
83
|
+
it 'has row elements' do
|
84
|
+
table.should respond_to(:row_elements)
|
104
85
|
end
|
105
|
-
end
|
106
86
|
|
107
|
-
|
87
|
+
it 'can get and set its row elements' do
|
88
|
+
expect(table).to respond_to(:row_elements=)
|
108
89
|
|
109
|
-
|
110
|
-
|
90
|
+
table.row_elements = :some_row_elements
|
91
|
+
table.row_elements.should == :some_row_elements
|
92
|
+
table.row_elements = :some_other_row_elements
|
93
|
+
table.row_elements.should == :some_other_row_elements
|
111
94
|
end
|
112
95
|
|
113
|
-
it '
|
114
|
-
|
96
|
+
it 'starts with no row elements' do
|
97
|
+
table.row_elements.should == []
|
115
98
|
end
|
116
99
|
|
117
100
|
# todo - remove once #contents is no longer supported
|
118
|
-
it '
|
119
|
-
|
101
|
+
it 'stores its contents as a nested array of strings' do
|
102
|
+
source = "| cell 1 | cell 2 |\n| cell 3 | cell 4 |"
|
103
|
+
table = clazz.new(source)
|
104
|
+
|
105
|
+
contents = table.contents
|
106
|
+
|
107
|
+
contents.is_a?(Array).should be_true
|
108
|
+
|
109
|
+
contents.each do |row|
|
110
|
+
row.is_a?(Array).should be_true
|
111
|
+
row.each { |cell| cell.is_a?(String).should be_true }
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
describe 'table output edge cases' do
|
116
|
+
|
117
|
+
it 'is a String' do
|
118
|
+
table.to_s.should be_a(String)
|
119
|
+
end
|
120
|
+
|
121
|
+
|
122
|
+
context 'a new table object' do
|
123
|
+
|
124
|
+
let(:table) { clazz.new }
|
125
|
+
|
126
|
+
|
127
|
+
it 'can output an empty table' do
|
128
|
+
expect { table.to_s }.to_not raise_error
|
129
|
+
end
|
130
|
+
|
131
|
+
# todo - remove once #contents is no longer supported
|
132
|
+
it 'can output a table that only has contents' do
|
133
|
+
table.contents = ['some contents']
|
134
|
+
|
135
|
+
expect { table.to_s }.to_not raise_error
|
136
|
+
end
|
137
|
+
|
138
|
+
end
|
120
139
|
|
121
|
-
expect { @table.to_s }.to_not raise_error
|
122
140
|
end
|
123
141
|
|
124
142
|
end
|
data/spec/unit/tag_unit_spec.rb
CHANGED
@@ -5,76 +5,90 @@ SimpleCov.command_name('Tag') unless RUBY_VERSION.to_s < '1.9.0'
|
|
5
5
|
describe 'Tag, Unit' do
|
6
6
|
|
7
7
|
let(:clazz) { CukeModeler::Tag }
|
8
|
+
let(:element) { clazz.new }
|
8
9
|
|
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 sourced element'
|
13
|
-
it_should_behave_like 'a raw element'
|
14
10
|
|
11
|
+
describe 'common behavior' do
|
15
12
|
|
16
|
-
|
17
|
-
|
13
|
+
it_should_behave_like 'a nested element'
|
14
|
+
it_should_behave_like 'a bare bones element'
|
15
|
+
it_should_behave_like 'a prepopulated element'
|
16
|
+
it_should_behave_like 'a sourced element'
|
17
|
+
it_should_behave_like 'a raw element'
|
18
18
|
|
19
|
-
expect { @element = clazz.new(source) }.to_not raise_error
|
20
|
-
@element.name.should == '@a_tag'
|
21
19
|
end
|
22
20
|
|
23
|
-
it 'provides a descriptive filename when being parsed from stand alone text' do
|
24
|
-
source = 'bad tag text'
|
25
21
|
|
26
|
-
|
27
|
-
end
|
22
|
+
describe 'unique behavior' do
|
28
23
|
|
29
|
-
|
30
|
-
|
31
|
-
raw_data = tag.raw_element
|
24
|
+
it 'can be parsed from stand alone text' do
|
25
|
+
source = '@a_tag'
|
32
26
|
|
33
|
-
|
34
|
-
|
35
|
-
|
27
|
+
expect { @element = clazz.new(source) }.to_not raise_error
|
28
|
+
@element.name.should == '@a_tag'
|
29
|
+
end
|
36
30
|
|
37
|
-
|
38
|
-
|
39
|
-
raw_data = tag.raw_element
|
31
|
+
it 'provides a descriptive filename when being parsed from stand alone text' do
|
32
|
+
source = 'bad tag text'
|
40
33
|
|
41
|
-
|
42
|
-
|
43
|
-
end
|
34
|
+
expect { clazz.new(source) }.to raise_error(/'cuke_modeler_stand_alone_tag\.feature'/)
|
35
|
+
end
|
44
36
|
|
45
|
-
|
46
|
-
|
47
|
-
|
37
|
+
it 'stores the original data generated by the parsing adapter', :gherkin4 => true do
|
38
|
+
tag = clazz.new('@a_tag')
|
39
|
+
raw_data = tag.raw_element
|
48
40
|
|
49
|
-
|
50
|
-
|
51
|
-
|
41
|
+
expect(raw_data.keys).to match_array([:type, :location, :name])
|
42
|
+
expect(raw_data[:type]).to eq(:Tag)
|
43
|
+
end
|
52
44
|
|
45
|
+
it 'stores the original data generated by the parsing adapter', :gherkin3 => true do
|
46
|
+
tag = clazz.new('@a_tag')
|
47
|
+
raw_data = tag.raw_element
|
53
48
|
|
54
|
-
|
55
|
-
|
56
|
-
|
49
|
+
expect(raw_data.keys).to match_array([:type, :location, :name])
|
50
|
+
expect(raw_data[:type]).to eq('Tag')
|
51
|
+
end
|
57
52
|
|
53
|
+
it 'stores the original data generated by the parsing adapter', :gherkin2 => true do
|
54
|
+
tag = clazz.new('@a_tag')
|
55
|
+
raw_data = tag.raw_element
|
58
56
|
|
59
|
-
|
60
|
-
|
61
|
-
|
57
|
+
expect(raw_data.keys).to match_array(['name', 'line'])
|
58
|
+
expect(raw_data['name']).to eq('@a_tag')
|
59
|
+
end
|
62
60
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
@element.name = :some_other_name
|
67
|
-
@element.name.should == :some_other_name
|
68
|
-
end
|
61
|
+
it 'has a name' do
|
62
|
+
element.should respond_to(:name)
|
63
|
+
end
|
69
64
|
|
70
|
-
|
65
|
+
it 'can get and set its name' do
|
66
|
+
expect(element).to respond_to(:name=)
|
71
67
|
|
72
|
-
|
73
|
-
|
68
|
+
element.name = :some_name
|
69
|
+
element.name.should == :some_name
|
70
|
+
element.name = :some_other_name
|
71
|
+
element.name.should == :some_other_name
|
74
72
|
end
|
75
73
|
|
76
|
-
|
77
|
-
|
74
|
+
describe 'tag output edge cases' do
|
75
|
+
|
76
|
+
it 'is a String' do
|
77
|
+
element.to_s.should be_a(String)
|
78
|
+
end
|
79
|
+
|
80
|
+
|
81
|
+
context 'a new tag object' do
|
82
|
+
|
83
|
+
let(:tag) { clazz.new }
|
84
|
+
|
85
|
+
|
86
|
+
it 'can output an empty tag' do
|
87
|
+
expect { tag.to_s }.to_not raise_error
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
|
78
92
|
end
|
79
93
|
|
80
94
|
end
|