nando/mundo-pepino

Filling fields of nested attributes

Closed this issue · 0 comments

R&R (Raul & Rai ;) says:

"And I fill email with "donpinpon@sessamestreet.com" for student with name "Roland Moore""

When /^I replace (.+) (?:with|as) ['"](.*)["'] for #{model_names} with (.+) ['"](.*)["']$/i do |field_to_save, value_to_save, model_name, field_to_search, value_to_search|
  resource = model_name.to_model.send("find_by_#{field_to_search}", value_to_search)
  fill_in "#{model_name.to_model.name.underscore}_#{resource.id}_#{field_to_save}", 
          :with => value_to_save
end