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.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/History.rdoc +8 -0
  3. data/features/step_definitions/feature_steps.rb +1 -1
  4. data/features/step_definitions/test_steps.rb +6 -2
  5. data/lib/cuke_modeler/directory.rb +7 -10
  6. data/lib/cuke_modeler/version.rb +1 -1
  7. data/spec/integration/background_integration_spec.rb +53 -40
  8. data/spec/integration/directory_integration_spec.rb +39 -26
  9. data/spec/integration/doc_string_integration_spec.rb +51 -43
  10. data/spec/integration/example_integration_spec.rb +71 -60
  11. data/spec/integration/feature_file_integration_spec.rb +36 -22
  12. data/spec/integration/feature_integration_spec.rb +113 -104
  13. data/spec/integration/outline_integration_spec.rb +71 -56
  14. data/spec/integration/row_integration_spec.rb +72 -0
  15. data/spec/integration/scenario_integration_spec.rb +61 -46
  16. data/spec/integration/step_integration_spec.rb +126 -117
  17. data/spec/integration/table_integration_spec.rb +67 -52
  18. data/spec/integration/table_row_integration_spec.rb +48 -40
  19. data/spec/integration/tag_integration_spec.rb +53 -45
  20. data/spec/integration/world_integration_spec.rb +2 -1
  21. data/spec/spec_helper.rb +15 -12
  22. data/spec/unit/background_unit_spec.rb +65 -50
  23. data/spec/unit/bare_bones_unit_specs.rb +2 -3
  24. data/spec/unit/containing_element_unit_specs.rb +6 -7
  25. data/spec/unit/directory_unit_spec.rb +103 -64
  26. data/spec/unit/doc_string_unit_spec.rb +113 -95
  27. data/spec/unit/example_unit_spec.rb +235 -219
  28. data/spec/unit/feature_element_unit_spec.rb +6 -6
  29. data/spec/unit/feature_element_unit_specs.rb +28 -24
  30. data/spec/unit/feature_file_unit_spec.rb +73 -63
  31. data/spec/unit/feature_unit_spec.rb +145 -111
  32. data/spec/unit/nested_element_unit_specs.rb +14 -13
  33. data/spec/unit/nested_unit_spec.rb +24 -21
  34. data/spec/unit/outline_unit_spec.rb +92 -78
  35. data/spec/unit/parsing_unit_spec.rb +55 -51
  36. data/spec/unit/prepopulated_unit_specs.rb +2 -3
  37. data/spec/unit/raw_element_unit_specs.rb +12 -11
  38. data/spec/unit/raw_unit_spec.rb +15 -12
  39. data/spec/unit/row_unit_spec.rb +68 -52
  40. data/spec/unit/scenario_unit_spec.rb +76 -62
  41. data/spec/unit/sourceable_unit_spec.rb +8 -6
  42. data/spec/unit/sourced_element_unit_specs.rb +4 -6
  43. data/spec/unit/step_unit_spec.rb +231 -203
  44. data/spec/unit/table_row_unit_spec.rb +68 -52
  45. data/spec/unit/table_unit_spec.rb +100 -82
  46. data/spec/unit/tag_unit_spec.rb +62 -48
  47. data/spec/unit/taggable_unit_spec.rb +58 -51
  48. data/spec/unit/tagged_element_unit_specs.rb +28 -26
  49. data/spec/unit/test_element_unit_spec.rb +33 -27
  50. data/spec/unit/test_element_unit_specs.rb +15 -14
  51. data/spec/unit/world_unit_spec.rb +94 -84
  52. 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
- it 'can be parsed from stand alone text' do
16
- source = '| a | row |'
11
+ describe 'common behavior' do
17
12
 
18
- expect { @element = clazz.new(source) }.to_not raise_error
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
- expect { clazz.new(source) }.to raise_error(/'cuke_modeler_stand_alone_table_row\.feature'/)
28
- end
22
+ describe 'unique behavior' do
29
23
 
30
- it 'stores the original data generated by the parsing adapter', :gherkin4 => true do
31
- table_row = clazz.new("| a | row |")
32
- raw_data = table_row.raw_element
24
+ it 'can be parsed from stand alone text' do
25
+ source = '| a | row |'
33
26
 
34
- expect(raw_data.keys).to match_array([:type, :location, :cells])
35
- expect(raw_data[:type]).to eq(:TableRow)
36
- end
27
+ expect { @element = clazz.new(source) }.to_not raise_error
37
28
 
38
- it 'stores the original data generated by the parsing adapter', :gherkin3 => true do
39
- table_row = clazz.new("| a | row |")
40
- raw_data = table_row.raw_element
29
+ # Sanity check in case instantiation failed in a non-explosive manner
30
+ @element.cells.should == ['a', 'row']
31
+ end
41
32
 
42
- expect(raw_data.keys).to match_array([:type, :location, :cells])
43
- expect(raw_data[:type]).to eq('TableRow')
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
- it 'stores the original data generated by the parsing adapter', :gherkin2 => true do
47
- table_row = clazz.new("| a | row |")
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
- expect(raw_data.keys).to match_array(['cells', 'line'])
51
- expect(raw_data['cells']).to eq(['a', 'row'])
52
- end
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
- before(:each) do
56
- @row = clazz.new
57
- end
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
- it 'has cells' do
60
- @row.should respond_to(:cells)
61
- end
51
+ expect(raw_data.keys).to match_array([:type, :location, :cells])
52
+ expect(raw_data[:type]).to eq('TableRow')
53
+ end
62
54
 
63
- it 'can get and set its cells' do
64
- @row.cells = :some_cells
65
- @row.cells.should == :some_cells
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
- it 'starts with no cells' do
71
- @row.cells.should == []
72
- end
59
+ expect(raw_data.keys).to match_array(['cells', 'line'])
60
+ expect(raw_data['cells']).to eq(['a', 'row'])
61
+ end
73
62
 
74
- context 'table row output edge cases' do
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 'is a String' do
77
- @row.to_s.should be_a(String)
76
+ it 'starts with no cells' do
77
+ row.cells.should == []
78
78
  end
79
79
 
80
- it 'can output an empty table row' do
81
- expect { @row.to_s }.to_not raise_error
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
- it 'can be parsed from stand alone text' do
15
- source = '| a table |'
11
+ describe 'common behavior' do
16
12
 
17
- expect { @element = clazz.new(source) }.to_not raise_error
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
- it 'stores the original data generated by the parsing adapter', :gherkin4 => true do
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
- it 'stores the original data generated by the parsing adapter', :gherkin3 => true do
40
- table = clazz.new("| a table |")
41
- raw_data = table.raw_element
23
+ it 'can be parsed from stand alone text' do
24
+ source = '| a table |'
42
25
 
43
- expect(raw_data.keys).to match_array([:type, :location, :rows])
44
- expect(raw_data[:type]).to eq(:DataTable)
45
- end
26
+ expect { @element = clazz.new(source) }.to_not raise_error
46
27
 
47
- it 'stores the original data generated by the parsing adapter', :gherkin2 => true do
48
- table = clazz.new("| a table |")
49
- raw_data = table.raw_element
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
- expect(raw_data).to match_array([{"cells" => ["a table"], "line" => 4}])
52
- end
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
- before(:each) do
56
- @table = clazz.new
57
- end
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
- # todo - remove once #contents is no longer supported
60
- it 'has contents - #contents' do
61
- @table.should respond_to(:contents)
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
- # todo - remove once #contents is no longer supported
65
- it 'can get and set its contents - #contents, #contents=' do
66
- @table.contents = :some_contents
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
- # todo - remove once #contents is no longer supported
73
- it 'starts with no contents' do
74
- @table.contents.should == []
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
- it 'has row elements' do
78
- @table.should respond_to(:row_elements)
79
- end
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
- it 'can get and set its row elements' do
82
- @table.row_elements = :some_row_elements
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
- it 'starts with no row elements' do
89
- @table.row_elements.should == []
90
- end
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
- # todo - remove once #contents is no longer supported
93
- it 'stores its contents as a nested array of strings' do
94
- source = "| cell 1 | cell 2 |\n| cell 3 | cell 4 |"
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
- contents = table.contents
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.is_a?(Array).should be_true
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
- contents.each do |row|
102
- row.is_a?(Array).should be_true
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
- context 'table output edge cases' do
87
+ it 'can get and set its row elements' do
88
+ expect(table).to respond_to(:row_elements=)
108
89
 
109
- it 'is a String' do
110
- @table.to_s.should be_a(String)
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 'can output an empty table' do
114
- expect { @table.to_s }.to_not raise_error
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 'can output a table that only has contents' do
119
- @table.contents = ['some contents']
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
@@ -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
- it 'can be parsed from stand alone text' do
17
- source = '@a_tag'
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
- expect { clazz.new(source) }.to raise_error(/'cuke_modeler_stand_alone_tag\.feature'/)
27
- end
22
+ describe 'unique behavior' do
28
23
 
29
- it 'stores the original data generated by the parsing adapter', :gherkin4 => true do
30
- tag = clazz.new('@a_tag')
31
- raw_data = tag.raw_element
24
+ it 'can be parsed from stand alone text' do
25
+ source = '@a_tag'
32
26
 
33
- expect(raw_data.keys).to match_array([:type, :location, :name])
34
- expect(raw_data[:type]).to eq(:Tag)
35
- end
27
+ expect { @element = clazz.new(source) }.to_not raise_error
28
+ @element.name.should == '@a_tag'
29
+ end
36
30
 
37
- it 'stores the original data generated by the parsing adapter', :gherkin3 => true do
38
- tag = clazz.new('@a_tag')
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
- expect(raw_data.keys).to match_array([:type, :location, :name])
42
- expect(raw_data[:type]).to eq('Tag')
43
- end
34
+ expect { clazz.new(source) }.to raise_error(/'cuke_modeler_stand_alone_tag\.feature'/)
35
+ end
44
36
 
45
- it 'stores the original data generated by the parsing adapter', :gherkin2 => true do
46
- tag = clazz.new('@a_tag')
47
- raw_data = tag.raw_element
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
- expect(raw_data.keys).to match_array(['name', 'line'])
50
- expect(raw_data['name']).to eq('@a_tag')
51
- end
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
- before(:each) do
55
- @element = clazz.new
56
- end
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
- it 'has a name' do
60
- @element.should respond_to(:name)
61
- end
57
+ expect(raw_data.keys).to match_array(['name', 'line'])
58
+ expect(raw_data['name']).to eq('@a_tag')
59
+ end
62
60
 
63
- it 'can get and set its name' do
64
- @element.name = :some_name
65
- @element.name.should == :some_name
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
- context 'tag output edge cases' do
65
+ it 'can get and set its name' do
66
+ expect(element).to respond_to(:name=)
71
67
 
72
- it 'is a String' do
73
- @element.to_s.should be_a(String)
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
- it 'can output an empty tag' do
77
- expect { @element.to_s }.to_not raise_error
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