12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/greenpepper/factory/ruleforexamplefactory.rb', line 12
def create_example(table)
return nil unless support? table
= /\s*(.*)\?\s*\Z/
example = RuleForExample.new table[0][1]
args_cells_size = table[0][2..-1].size
2.step(args_cells_size, 2) do |i|
example.add_fixture_argument table[0][i + 1]
end
table[1].each do ||
example.
end
table[2..-1].each_with_index {|row, index|
example.add_row row
if row.size != table[1].size
message = "Missing at least one cell on line #{index+1}: Header has #{table[1].size} cells while current row has #{row.size}"
raise GreenPepperMalformedTableError.new(message)
end
}
return example
end
|