added the filtering to the cuke

pull/1215/head
Stefan Frank 11 years ago
parent aee88da594
commit e3ff807796
  1. 4
      features/planning_elements/filter.feature
  2. 10
      features/step_definitions/api_steps.rb

@ -227,8 +227,8 @@ Feature: Filtering work packages via the api
| type | Story |
| responsible | bob |
Given the date is "2010/03/01"
And I call the work_package-api on project "sample_project" with compare-date "2010/01/03"
Then the json-response should include 3 work package
And I call the work_package-api on project "sample_project" with compare-date "2010/01/03" and filter for types "Story"
Then the json-response should include 1 work package
And the json-response for work_package "work_package#3" should have the type "Task"
And the json-response for work_package "work_package#3" should have the responsible "Pamela Anderson"

@ -112,10 +112,14 @@ When(/^I call the work_package\-api on project "(.*?)" requesting format "(.*?)"
end
And(/^I call the work_package\-api on project "(.*?)" with compare\-date "(.*?)"$/) do |project_name, compare_date|
puts "looking up historical data at #{compare_date} for project #{project_name}"
And(/^I call the work_package\-api on project "(.*?)" with compare\-date "(.*?)" and filter for types "(.*?)"$/) do |project_name, compare_date, type_names|
types = Project.find_by_identifier(project_name).types.where(name: type_names.split(','))
get_filtered_json(project_name: project_name,
format: "json",
format: 'json',
filters: [:type_id],
operators: {type_id: '='},
values: {type_id: types.map(&:id)},
compare_date: compare_date)
end

Loading…
Cancel
Save