OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/features/step_definitions/planning_element_steps.rb

20 lines
917 B

Given (/^there are the following planning elements(?: in project "([^"]*)")?:$/) do |project_name, table|
project = get_project(project_name)
table.map_headers! { |header| header.underscore.gsub(' ', '_') }
table.hashes.each do |type_attributes|
status = PlanningElementStatus.find_by_name(type_attributes.delete("status_name"))
responsible = User.find_by_login(type_attributes.delete("responsible"))
planning_element_type = PlanningElementType.find_by_name(type_attributes.delete("planning_element_type"));
factory = FactoryGirl.create(:planning_element, type_attributes.merge(:project_id => project.id))
factory.reload
factory.planning_element_status = status unless status.nil?
factory.responsible = responsible unless responsible.nil?
factory.planning_element_type = planning_element_type unless planning_element_type.nil?
factory.save! if factory.changed?
end
end