Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Allow a mix of with and table for model creation

#30

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 | ........                  |

Reported by TMaYaD · August 24th, 2010 @ 06:44 AM

State: new
Milestone: none
Assigned to: Ian White Ian White

Activity

  1. TMaYaD
    TMaYaD

    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
    

    August 24th, 2010 @ 07:17 AM

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.