diff --git a/app/controllers/rb_sprints_controller.rb b/app/controllers/rb_sprints_controller.rb index 695210914..fbbb13aeb 100644 --- a/app/controllers/rb_sprints_controller.rb +++ b/app/controllers/rb_sprints_controller.rb @@ -7,6 +7,9 @@ class RbSprintsController < RbApplicationController unloadable + # Accept download as API request as Redmine redirects XML format to this type + accept_api_auth :download + def create attribs = params.select{|k,v| k != 'id' and RbSprint.column_names.include? k } attribs = Hash[*attribs.flatten] @@ -59,10 +62,10 @@ def download bold = {:font => {:bold => true}} dump = BacklogsSpreadsheet::WorkBook.new ws = dump[@sprint.name] - ws << [nil, @sprint.id, nil, nil, {:value => @sprint.name, :style => bold}, {:value => 'Start', :style => bold}] + @sprint.days(:all).collect{|d| {:value => d, :style => bold} } + ws << [nil, @sprint.id, nil, nil, {:value => @sprint.name, :style => bold}, {:value => 'Start', :style => bold}] + @sprint.days.collect{|d| {:value => d, :style => bold} } bd = @sprint.burndown bd.series(false).sort{|a, b| l("label_#{a}") <=> l("label_#{b}")}.each{ |k| - ws << [ nil, nil, nil, nil, l("label_#{k}") ] + bd[k] + ws << [ nil, nil, nil, nil, l("label_#{k}") ] + bd.data[k.to_sym] } @sprint.stories.each{|s| @@ -75,7 +78,7 @@ def download ws << [nil, nil, nil, nil, label ] + bd[k] } s.tasks.each {|t| - ws << [nil, nil, t.tracker.name, t.id, {:value => t.subject, :style => bold}] + t.burndown + ws << [nil, nil, t.tracker.name, t.id, {:value => t.subject, :style => bold}] + t.becomes(RbTask).burndown } } diff --git a/features/scrum_master.feature b/features/scrum_master.feature index 8112cf322..91ef49c12 100644 --- a/features/scrum_master.feature +++ b/features/scrum_master.feature @@ -26,6 +26,9 @@ Feature: Scrum Master And I have defined the following impediments: | subject | sprint | blocks | | Impediment 1 | Sprint 001 | Story A | + And I have defined the following tasks: + | subject | story | assigned_to | + | Task 1 | Story A | | Scenario: Create an impediment Given I am viewing the taskboard for Sprint 001 @@ -196,3 +199,9 @@ Feature: Scrum Master When I update the sprint Then the server should return an update error And the error message should say "Sprint cannot end before it starts" + + Scenario: Download sprint as XML spreadsheet + Given I am viewing the master backlog + And I have set my API access key + When I try to download the XML sheet for Sprint 001 + Then the request should complete successfully diff --git a/features/step_definitions/_when_steps.rb b/features/step_definitions/_when_steps.rb index 81f5b22cb..eb2db1bd0 100644 --- a/features/step_definitions/_when_steps.rb +++ b/features/step_definitions/_when_steps.rb @@ -204,6 +204,12 @@ visit url_for({ :key => @api_key, :controller => 'rb_calendars', :action => 'ical', :project_id => @project, :format => 'xml', :only_path => true}) end +When /^I try to download the XML sheet for (.+)$/ do |sprint_name| + sprint = RbSprint.find(:first, :conditions => ["name=?", sprint_name]) + visit url_for({:key => @api_key, :controller => :rb_sprints, :action => :download, + :sprint_id => sprint, :format => :xml, :only_path => true}) +end + When /^I view the master backlog$/ do visit url_for(:controller => :projects, :action => :show, :id => @project, :only_path => true) click_link("Backlogs")