Allow a mix of with and table for model creation
Reported by TMaYaD | August 24th, 2010 @ 06:44 AM
Given an invoice exists
And the following items exist with invoice: the invoice :
| product | quantity | rate |
this should be equal to
Given an invoice exists
And the following items exist:
| invoice | product | quantity | rate |
| the invoice | ........ |
| the invoice | ........ |
| the invoice | ........ |
| the invoice | ........ |
Comments and changes to this ticket
-
TMaYaD August 24th, 2010 @ 07:17 AM
this might work haven't tested exhaustively
Given(/^the following #{capture_plural_factory} exists? with #{capture_fields} :?$/) do |plural_factory, fields, table| field_names = [] field_values = [] fields.split(/,/).each {|field| a = field.split /:/ field_names.append a[0].strip field_value.append a[1].strip } table_raw = table.raw table_raw[0] += field_names table_raw[1..table_raw.size].each {|row| row += field_values} Given "the following #{plural_factory} exists:", table(table_raw) end
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
Assign tickets to <b>Ian White</b>, so I get notified