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,303 +5,319 @@ SimpleCov.command_name('Example') unless RUBY_VERSION.to_s < '1.9.0'
5
5
  describe 'Example, Unit' do
6
6
 
7
7
  let(:clazz) { CukeModeler::Example }
8
+ let(:example) { clazz.new }
8
9
 
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'
10
+ describe 'common behavior' do
17
11
 
12
+ it_should_behave_like 'a feature element'
13
+ it_should_behave_like 'a nested element'
14
+ it_should_behave_like 'a tagged element'
15
+ it_should_behave_like 'a bare bones element'
16
+ it_should_behave_like 'a prepopulated element'
17
+ it_should_behave_like 'a sourced element'
18
+ it_should_behave_like 'a containing element'
19
+ it_should_behave_like 'a raw element'
18
20
 
19
- it 'can be parsed from stand alone text' do
20
- source = ['Examples: test example',
21
- '|param| ',
22
- '|value|']
21
+ end
23
22
 
24
- source = source.join("\n")
25
23
 
26
- expect { @element = clazz.new(source) }.to_not raise_error
24
+ describe 'unique behavior' do
27
25
 
28
- # Sanity check in case instantiation failed in a non-explosive manner
29
- @element.name.should == 'test example'
30
- end
26
+ it 'can be parsed from stand alone text' do
27
+ source = ['Examples: test example',
28
+ '|param| ',
29
+ '|value|']
31
30
 
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")
31
+ source = source.join("\n")
36
32
 
37
- expect { @element = clazz.new(source) }.to_not raise_error
38
- end
33
+ expect { @element = clazz.new(source) }.to_not raise_error
39
34
 
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")
35
+ # Sanity check in case instantiation failed in a non-explosive manner
36
+ @element.name.should == 'test example'
37
+ end
46
38
 
47
- expect { @element = clazz.new(source) }.to_not raise_error
48
- end
39
+ # todo - add more tests like this to the 'barebones' test set
40
+ it 'can be instantiated with the minimum viable Gherkin', :gherkin4 => true do
41
+ source = ['Examples:']
42
+ source = source.join("\n")
49
43
 
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")
44
+ expect { @element = clazz.new(source) }.to_not raise_error
45
+ end
55
46
 
56
- expect { @element = clazz.new(source) }.to_not raise_error
57
- end
47
+ # todo - add more tests like this to the 'barebones' test set
48
+ it 'can be instantiated with the minimum viable Gherkin', :gherkin3 => true do
49
+ source = ['Examples:',
50
+ '|param|',
51
+ '|value|']
52
+ source = source.join("\n")
58
53
 
59
- it 'provides a descriptive filename when being parsed from stand alone text' do
60
- source = 'bad example text'
54
+ expect { @element = clazz.new(source) }.to_not raise_error
55
+ end
61
56
 
62
- expect { clazz.new(source) }.to raise_error(/'cuke_modeler_stand_alone_example\.feature'/)
63
- end
57
+ # todo - add more tests like this to the 'barebones' test set
58
+ it 'can be instantiated with the minimum viable Gherkin', :gherkin2 => true do
59
+ source = ['Examples:',
60
+ '|param|']
61
+ source = source.join("\n")
64
62
 
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
63
+ expect { @element = clazz.new(source) }.to_not raise_error
64
+ end
68
65
 
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
66
+ it 'provides a descriptive filename when being parsed from stand alone text' do
67
+ source = 'bad example text'
72
68
 
73
- it 'stores the original data generated by the parsing adapter', :gherkin3 => true do
74
- example = clazz.new("Examples: test example\n|param|\n|value|")
75
- raw_data = example.raw_element
69
+ expect { clazz.new(source) }.to raise_error(/'cuke_modeler_stand_alone_example\.feature'/)
70
+ end
76
71
 
77
- expect(raw_data.keys).to match_array([:type, :tags, :location, :keyword, :name, :tableHeader, :tableBody])
78
- expect(raw_data[:type]).to eq(:Examples)
79
- end
72
+ it 'stores the original data generated by the parsing adapter', :gherkin4 => true do
73
+ example = clazz.new("Examples: test example\n|param|\n|value|")
74
+ raw_data = example.raw_element
80
75
 
81
- it 'stores the original data generated by the parsing adapter', :gherkin2 => true do
82
- example = clazz.new("Examples: test example\n|param|\n|value|")
83
- raw_data = example.raw_element
76
+ expect(raw_data.keys).to match_array([:type, :tags, :location, :keyword, :name, :tableHeader, :tableBody])
77
+ expect(raw_data[:type]).to eq(:Examples)
78
+ end
84
79
 
85
- expect(raw_data.keys).to match_array(['keyword', 'name', 'line', 'description', 'id', 'rows'])
86
- expect(raw_data['keyword']).to eq('Examples')
87
- end
80
+ it 'stores the original data generated by the parsing adapter', :gherkin3 => true do
81
+ example = clazz.new("Examples: test example\n|param|\n|value|")
82
+ raw_data = example.raw_element
88
83
 
84
+ expect(raw_data.keys).to match_array([:type, :tags, :location, :keyword, :name, :tableHeader, :tableBody])
85
+ expect(raw_data[:type]).to eq(:Examples)
86
+ end
89
87
 
90
- before(:each) do
91
- @example = clazz.new
92
- end
88
+ it 'stores the original data generated by the parsing adapter', :gherkin2 => true do
89
+ example = clazz.new("Examples: test example\n|param|\n|value|")
90
+ raw_data = example.raw_element
93
91
 
92
+ expect(raw_data.keys).to match_array(['keyword', 'name', 'line', 'description', 'id', 'rows'])
93
+ expect(raw_data['keyword']).to eq('Examples')
94
+ end
94
95
 
95
- it 'has parameters - #parameters' do
96
- @example.should respond_to(:parameters)
97
- end
96
+ it 'has parameters' do
97
+ example.should respond_to(:parameters)
98
+ end
98
99
 
99
- it 'can get and set its parameters - #parameters, #parameters=' do
100
- @example.parameters = :some_parameters
101
- @example.parameters.should == :some_parameters
102
- @example.parameters = :some_other_parameters
103
- @example.parameters.should == :some_other_parameters
104
- end
100
+ it 'can change its parameters' do
101
+ expect(example).to respond_to(:parameters=)
105
102
 
106
- it 'starts with no parameters' do
107
- @example.parameters.should == []
108
- end
103
+ example.parameters = :some_parameters
104
+ example.parameters.should == :some_parameters
105
+ example.parameters = :some_other_parameters
106
+ example.parameters.should == :some_other_parameters
107
+ end
109
108
 
110
- it 'has rows - #rows' do
111
- @example.should respond_to(:rows)
112
- end
109
+ it 'starts with no parameters' do
110
+ example.parameters.should == []
111
+ end
113
112
 
114
- #todo - remove once Hash rows are no longer supported
115
- it 'can get and set its rows - #rows, #rows=' do
116
- @example.rows = :some_rows
117
- @example.rows.should == :some_rows
118
- @example.rows = :some_other_rows
119
- @example.rows.should == :some_other_rows
120
- end
113
+ it 'has rows' do
114
+ example.should respond_to(:rows)
115
+ end
121
116
 
122
- #todo - remove once Hash rows are no longer supported
123
- it 'starts with no rows' do
124
- @example.rows.should == []
125
- end
117
+ #todo - remove once Hash rows are no longer supported
118
+ it 'can change its rows' do
119
+ expect(example).to respond_to(:rows=)
126
120
 
127
- #todo - remove once Hash rows are no longer supported
128
- it 'stores its rows as an nested array of hashes' do
129
- source = "Examples:\n|param1|param2|\n|value1|value2|"
130
- example = CukeModeler::Example.new(source)
121
+ example.rows = :some_rows
122
+ example.rows.should == :some_rows
123
+ example.rows = :some_other_rows
124
+ example.rows.should == :some_other_rows
125
+ end
131
126
 
132
- rows = example.rows
127
+ #todo - remove once Hash rows are no longer supported
128
+ it 'starts with no rows' do
129
+ example.rows.should == []
130
+ end
133
131
 
134
- rows.is_a?(Array).should be_true
135
- rows.empty?.should be_false
136
- rows.each { |row| row.is_a?(Hash).should be_true }
137
- end
132
+ #todo - remove once Hash rows are no longer supported
133
+ it 'stores its rows as an nested array of hashes' do
134
+ source = "Examples:\n|param1|param2|\n|value1|value2|"
135
+ example = clazz.new(source)
138
136
 
139
- it 'does not include the parameter row as a row' do
140
- source = "Examples:\n|param1|param2|\n|value1|value2|\n|value3|value4|"
141
- example = CukeModeler::Example.new(source)
137
+ rows = example.rows
142
138
 
143
- rows = example.rows
139
+ rows.is_a?(Array).should be_true
140
+ rows.empty?.should be_false
141
+ rows.each { |row| row.is_a?(Hash).should be_true }
142
+ end
144
143
 
145
- rows.should == [{'param1' => 'value1', 'param2' => 'value2'}, {'param1' => 'value3', 'param2' => 'value4'}]
146
- end
144
+ it 'does not include the parameter row as a row' do
145
+ source = "Examples:\n|param1|param2|\n|value1|value2|\n|value3|value4|"
146
+ example = clazz.new(source)
147
147
 
148
- it 'has row elements - #row_elements' do
149
- @example.should respond_to(:row_elements)
150
- end
148
+ rows = example.rows
151
149
 
152
- it 'can get and set its row elements - #row_elements, #row_elements=' do
153
- @example.row_elements = :some_row_elements
154
- @example.row_elements.should == :some_row_elements
155
- @example.row_elements = :some_other_row_elements
156
- @example.row_elements.should == :some_other_row_elements
157
- end
150
+ rows.should == [{'param1' => 'value1', 'param2' => 'value2'}, {'param1' => 'value3', 'param2' => 'value4'}]
151
+ end
158
152
 
159
- it 'starts with no row elements' do
160
- @example.row_elements.should == []
161
- end
153
+ it 'has row elements' do
154
+ example.should respond_to(:row_elements)
155
+ end
162
156
 
163
- context '#add_row' do
157
+ it 'can change its row elements' do
158
+ expect(example).to respond_to(:row_elements=)
164
159
 
165
- it 'can add a new example row' do
166
- clazz.new.should respond_to(:add_row)
160
+ example.row_elements = :some_row_elements
161
+ example.row_elements.should == :some_row_elements
162
+ example.row_elements = :some_other_row_elements
163
+ example.row_elements.should == :some_other_row_elements
167
164
  end
168
165
 
169
- it 'can add a new row as a hash' do
170
- source = "Examples:\n|param1|param2|\n|value1|value2|"
171
- example = CukeModeler::Example.new(source)
166
+ it 'starts with no row elements' do
167
+ example.row_elements.should == []
168
+ end
172
169
 
173
- new_row = {'param1' => 'value3', 'param2' => 'value4'}
174
- example.add_row(new_row)
170
+ describe '#add_row' do
175
171
 
176
- #todo - remove once Hash rows are no longer supported
177
- example.rows.should == [{'param1' => 'value1', 'param2' => 'value2'}, {'param1' => 'value3', 'param2' => 'value4'}]
178
- example.row_elements.collect { |row| row.cells }[1..example.row_elements.count].should == [['value1', 'value2'], ['value3', 'value4']]
179
- end
172
+ it 'can add a new example row' do
173
+ clazz.new.should respond_to(:add_row)
174
+ end
180
175
 
181
- it 'can add a new row as an array' do
182
- source = "Examples:\n|param1|param2|\n|value1|value2|"
183
- example = CukeModeler::Example.new(source)
176
+ it 'can add a new row as a hash' do
177
+ source = "Examples:\n|param1|param2|\n|value1|value2|"
178
+ example = clazz.new(source)
184
179
 
185
- new_row = ['value3', 'value4']
186
- example.add_row(new_row)
180
+ new_row = {'param1' => 'value3', 'param2' => 'value4'}
181
+ example.add_row(new_row)
187
182
 
188
- #todo - remove once Hash rows are no longer supported
189
- example.rows.should == [{'param1' => 'value1', 'param2' => 'value2'}, {'param1' => 'value3', 'param2' => 'value4'}]
190
- example.row_elements.collect { |row| row.cells }[1..example.row_elements.count].should == [['value1', 'value2'], ['value3', 'value4']]
191
- end
183
+ #todo - remove once Hash rows are no longer supported
184
+ example.rows.should == [{'param1' => 'value1', 'param2' => 'value2'}, {'param1' => 'value3', 'param2' => 'value4'}]
185
+ example.row_elements.collect { |row| row.cells }[1..example.row_elements.count].should == [['value1', 'value2'], ['value3', 'value4']]
186
+ end
192
187
 
193
- it 'can only use a Hash or an Array to add a new row' do
194
- expect { @example.add_row({}) }.to_not raise_error
195
- expect { @example.add_row([]) }.to_not raise_error
196
- expect { @example.add_row(:a_row) }.to raise_error(ArgumentError)
197
- end
188
+ it 'can add a new row as an array' do
189
+ source = "Examples:\n|param1|param2|\n|value1|value2|"
190
+ example = clazz.new(source)
198
191
 
199
- it 'trims whitespace from added rows' do
200
- source = "Examples:\n|param1|param2|\n|value1|value2|"
201
- example = CukeModeler::Example.new(source)
192
+ new_row = ['value3', 'value4']
193
+ example.add_row(new_row)
202
194
 
203
- hash_row = {'param1' => 'value3 ', 'param2' => ' value4'}
204
- array_row = ['value5', ' value6 ']
205
- example.add_row(hash_row)
206
- example.add_row(array_row)
195
+ #todo - remove once Hash rows are no longer supported
196
+ example.rows.should == [{'param1' => 'value1', 'param2' => 'value2'}, {'param1' => 'value3', 'param2' => 'value4'}]
197
+ example.row_elements.collect { |row| row.cells }[1..example.row_elements.count].should == [['value1', 'value2'], ['value3', 'value4']]
198
+ end
207
199
 
208
- #todo - remove once Hash rows are no longer supported
209
- example.rows.should == [{'param1' => 'value1', 'param2' => 'value2'}, {'param1' => 'value3', 'param2' => 'value4'}, {'param1' => 'value5', 'param2' => 'value6'}]
210
- example.row_elements.collect { |row| row.cells }[1..example.row_elements.count].should == [['value1', 'value2'], ['value3', 'value4'], ['value5', 'value6']]
211
- end
212
- end
200
+ it 'can only use a Hash or an Array to add a new row' do
201
+ expect { example.add_row({}) }.to_not raise_error
202
+ expect { example.add_row([]) }.to_not raise_error
203
+ expect { example.add_row(:a_row) }.to raise_error(ArgumentError)
204
+ end
213
205
 
214
- context '#remove_row' do
206
+ it 'trims whitespace from added rows' do
207
+ source = "Examples:\n|param1|param2|\n|value1|value2|"
208
+ example = clazz.new(source)
215
209
 
216
- it 'can remove an existing example row' do
217
- clazz.new.should respond_to(:remove_row)
210
+ hash_row = {'param1' => 'value3 ', 'param2' => ' value4'}
211
+ array_row = ['value5', ' value6 ']
212
+ example.add_row(hash_row)
213
+ example.add_row(array_row)
214
+
215
+ #todo - remove once Hash rows are no longer supported
216
+ example.rows.should == [{'param1' => 'value1', 'param2' => 'value2'}, {'param1' => 'value3', 'param2' => 'value4'}, {'param1' => 'value5', 'param2' => 'value6'}]
217
+ example.row_elements.collect { |row| row.cells }[1..example.row_elements.count].should == [['value1', 'value2'], ['value3', 'value4'], ['value5', 'value6']]
218
+ end
218
219
  end
219
220
 
220
- it 'can remove an existing row as a hash' do
221
- source = "Examples:\n|param1|param2|\n|value1|value2|\n|value3|value4|"
222
- example = CukeModeler::Example.new(source)
221
+ describe '#remove_row' do
223
222
 
224
- old_row = {'param1' => 'value3', 'param2' => 'value4'}
225
- example.remove_row(old_row)
223
+ it 'can remove an existing example row' do
224
+ clazz.new.should respond_to(:remove_row)
225
+ end
226
226
 
227
- #todo - remove once Hash rows are no longer supported
228
- example.rows.should == [{'param1' => 'value1', 'param2' => 'value2'}]
229
- example.row_elements.collect { |row| row.cells }[1..example.row_elements.count].should == [['value1', 'value2']]
230
- end
227
+ it 'can remove an existing row as a hash' do
228
+ source = "Examples:\n|param1|param2|\n|value1|value2|\n|value3|value4|"
229
+ example = clazz.new(source)
231
230
 
232
- it 'can remove an existing row as an array' do
233
- source = "Examples:\n|param1|param2|\n|value1|value2|\n|value3|value4|"
234
- example = CukeModeler::Example.new(source)
231
+ old_row = {'param1' => 'value3', 'param2' => 'value4'}
232
+ example.remove_row(old_row)
235
233
 
236
- old_row = ['value3', 'value4']
237
- example.remove_row(old_row)
234
+ #todo - remove once Hash rows are no longer supported
235
+ example.rows.should == [{'param1' => 'value1', 'param2' => 'value2'}]
236
+ example.row_elements.collect { |row| row.cells }[1..example.row_elements.count].should == [['value1', 'value2']]
237
+ end
238
238
 
239
- #todo - remove once Hash rows are no longer supported
240
- example.rows.should == [{'param1' => 'value1', 'param2' => 'value2'}]
241
- example.row_elements.collect { |row| row.cells }[1..example.row_elements.count].should == [['value1', 'value2']]
242
- end
239
+ it 'can remove an existing row as an array' do
240
+ source = "Examples:\n|param1|param2|\n|value1|value2|\n|value3|value4|"
241
+ example = clazz.new(source)
243
242
 
244
- it 'can only use a Hash or an Array to remove an existing row' do
245
- expect { @example.remove_row({}) }.to_not raise_error
246
- expect { @example.remove_row([]) }.to_not raise_error
247
- expect { @example.remove_row(:a_row) }.to raise_error(ArgumentError)
248
- end
243
+ old_row = ['value3', 'value4']
244
+ example.remove_row(old_row)
249
245
 
250
- it 'trims whitespace from removed rows' do
251
- source = "Examples:\n|param1|param2|\n|value1|value2|\n|value3|value4|\n|value5|value6|"
252
- example = CukeModeler::Example.new(source)
246
+ #todo - remove once Hash rows are no longer supported
247
+ example.rows.should == [{'param1' => 'value1', 'param2' => 'value2'}]
248
+ example.row_elements.collect { |row| row.cells }[1..example.row_elements.count].should == [['value1', 'value2']]
249
+ end
253
250
 
254
- hash_row = {'param1' => 'value3 ', 'param2' => ' value4'}
255
- array_row = ['value5', ' value6 ']
256
- example.remove_row(hash_row)
257
- example.remove_row(array_row)
251
+ it 'can only use a Hash or an Array to remove an existing row' do
252
+ expect { example.remove_row({}) }.to_not raise_error
253
+ expect { example.remove_row([]) }.to_not raise_error
254
+ expect { example.remove_row(:a_row) }.to raise_error(ArgumentError)
255
+ end
258
256
 
259
- #todo - remove once Hash rows are no longer supported
260
- example.rows.should == [{'param1' => 'value1', 'param2' => 'value2'}]
261
- example.row_elements.collect { |row| row.cells }[1..example.row_elements.count].should == [['value1', 'value2']]
262
- end
263
- end
257
+ it 'trims whitespace from removed rows' do
258
+ source = "Examples:\n|param1|param2|\n|value1|value2|\n|value3|value4|\n|value5|value6|"
259
+ example = clazz.new(source)
264
260
 
265
- context 'example output edge cases' do
261
+ hash_row = {'param1' => 'value3 ', 'param2' => ' value4'}
262
+ array_row = ['value5', ' value6 ']
263
+ example.remove_row(hash_row)
264
+ example.remove_row(array_row)
266
265
 
267
- it 'is a String' do
268
- @example.to_s.should be_a(String)
266
+ #todo - remove once Hash rows are no longer supported
267
+ example.rows.should == [{'param1' => 'value1', 'param2' => 'value2'}]
268
+ example.row_elements.collect { |row| row.cells }[1..example.row_elements.count].should == [['value1', 'value2']]
269
+ end
269
270
  end
270
271
 
271
- it 'can output an empty example' do
272
- expect { @example.to_s }.to_not raise_error
273
- end
272
+ describe 'example output edge cases' do
274
273
 
275
- it 'can output an example that has only a name' do
276
- @example.name = 'a name'
274
+ it 'is a String' do
275
+ example.to_s.should be_a(String)
276
+ end
277
277
 
278
- expect { @example.to_s }.to_not raise_error
279
- end
278
+ context 'a new example object' do
280
279
 
281
- it 'can output an example that has only a description' do
282
- @example.description_text = 'a description'
280
+ let(:example) { clazz.new }
283
281
 
284
- expect { @example.to_s }.to_not raise_error
285
- end
286
282
 
287
- it 'can output an example that has only a tags' do
288
- @example.tags = ['a tag']
283
+ it 'can output an empty example' do
284
+ expect { example.to_s }.to_not raise_error
285
+ end
289
286
 
290
- expect { @example.to_s }.to_not raise_error
291
- end
287
+ it 'can output an example that has only a name' do
288
+ example.name = 'a name'
292
289
 
293
- #todo - remove once Hash rows are no longer supported
294
- it 'can output an example that only has parameters' do
295
- @example.parameters = ['param1']
290
+ expect { example.to_s }.to_not raise_error
291
+ end
296
292
 
297
- expect { @example.to_s }.to_not raise_error
298
- end
293
+ it 'can output an example that has only a description' do
294
+ example.description_text = 'a description'
299
295
 
300
- #todo - remove once Hash rows are no longer supported
301
- it 'can output an example that only has rows' do
302
- @example.rows = [{:param1 => 'row1'}]
296
+ expect { example.to_s }.to_not raise_error
297
+ end
298
+
299
+ it 'can output an example that has only tags' do
300
+ example.tags = ['a tag']
301
+
302
+ expect { example.to_s }.to_not raise_error
303
+ end
304
+
305
+ #todo - remove once Hash rows are no longer supported
306
+ it 'can output an example that only has parameters' do
307
+ example.parameters = ['param1']
308
+
309
+ expect { example.to_s }.to_not raise_error
310
+ end
311
+
312
+ #todo - remove once Hash rows are no longer supported
313
+ it 'can output an example that only has rows' do
314
+ example.rows = [{:param1 => 'row1'}]
315
+
316
+ expect { example.to_s }.to_not raise_error
317
+ end
318
+
319
+ end
303
320
 
304
- expect { @example.to_s }.to_not raise_error
305
321
  end
306
322
 
307
323
  end