diff --git a/app/views/backlogs/_backlog.html.erb b/app/views/backlogs/_backlog.html.erb
index a49b11c4c1..d09840de40 100755
--- a/app/views/backlogs/_backlog.html.erb
+++ b/app/views/backlogs/_backlog.html.erb
@@ -35,7 +35,7 @@
:for => :product
},
{
- :item => "#{l(:label_burndown)}",
+ :item => "#{l(:label_burndown)}",
:for => :sprint,
:condition => (backlog.respond_to?(:has_burndown) and backlog.has_burndown)
},
@@ -59,7 +59,7 @@
:controller => 'backlogs',
:action => 'wiki_page',
:project_id => @project.id,
- :sprint_id => backlog.id }),
+ :sprint_id => backlog[:id] }),
:for => :sprint,
:condition => @project.enabled_modules.any? {|m| m.name=="wiki" }
},
diff --git a/config/routes.rb b/config/routes.rb
index ec25a9ac77..48b7e0cdc2 100755
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,4 +1,5 @@
ActionController::Routing::Routes.draw do |map|
+ map.connect 'backlogs/:project_id', :controller => 'backlogs', :action => 'index'
map.connect 'backlogs/:project_id/:sprint_id/burndown', :controller => 'backlogs', :action => 'burndown'
map.connect 'backlogs/:project_id/issues', :controller => 'backlogs', :action => 'select_issues'
map.connect 'backlogs/:project_id/:sprint_id/issues', :controller => 'backlogs', :action => 'select_issues'
diff --git a/features/.autotest b/features/.autotest
index e290489d45..e5ca9da3a3 100644
--- a/features/.autotest
+++ b/features/.autotest
@@ -7,6 +7,6 @@ Autotest.add_hook :initialize do |at|
at.remove_exception 'vendor/plugins'
at.find_directories << 'vendor/plugins/redmine_backlogs'
at.libs << 'vendor/plugins/redmine_backlogs/features'
-
+ at.libs << 'vendor/plugins/redmine_backlogs/lib'
false
end
\ No newline at end of file
diff --git a/features/manage_stories.feature b/features/manage_stories.feature
index 5211dc93b4..c19627b331 100644
--- a/features/manage_stories.feature
+++ b/features/manage_stories.feature
@@ -1,7 +1,7 @@
Feature: Manage stories
- In order to [goal]
- [stakeholder]
- wants [behaviour]
+ In order to track project progress
+ Product Owner, Scrum Master, and Team Members
+ want to manage stories
Scenario: Something
Given I am on the home page
diff --git a/features/product_owner.feature b/features/product_owner.feature
new file mode 100644
index 0000000000..98e512289a
--- /dev/null
+++ b/features/product_owner.feature
@@ -0,0 +1,22 @@
+Feature: Product Owner
+ As a product owner
+ I want to manage stories
+ So that they get done according to my needs
+
+ Background:
+ Given the ecookbook project has the backlogs plugin enabled
+ And I am a product owner of the ecookbook project
+ And the ecookbook project has the following sprints:
+ | name | sprint_start_date | effective_date |
+ | sprint 001 | 2010-01-01 | 2010-01-31 |
+ | sprint 002 | 2010-02-01 | 2010-02-28 |
+ | sprint 003 | 2010-03-01 | 2010-03-31 |
+
+ Scenario: View the product backlog
+ Given I am viewing the ecookbook master backlog
+ Then I should see the product backlog
+
+ Scenario: Move a story to the top
+ Given I am viewing the ecookbook master backlog
+ When I move the 3rd story to the 1st position
+ Then the story should be at the top
\ No newline at end of file
diff --git a/features/step_definitions/global_steps.rb b/features/step_definitions/global_steps.rb
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/features/step_definitions/product_owner_steps.rb b/features/step_definitions/product_owner_steps.rb
new file mode 100644
index 0000000000..91e897bc7a
--- /dev/null
+++ b/features/step_definitions/product_owner_steps.rb
@@ -0,0 +1,53 @@
+Given /^the (.*) project has the backlogs plugin enabled$/ do |project_id|
+ project = get_project(project_id)
+
+ # Clear the project's versions
+ project.versions.delete_all
+
+ # Enable the backlogs plugin
+ project.enabled_modules << EnabledModule.new(:name => 'backlogs')
+
+ # Configure it properly
+ story_trackers = Tracker.find(:all).map{|s| "#{s.id}"}
+ task_tracker = "#{Tracker.create!(:name => 'Task').id}"
+ plugin = Redmine::Plugin.find('redmine_backlogs')
+ Setting["plugin_#{plugin.id}"] = {:story_trackers => story_trackers, :task_tracker => task_tracker }
+end
+
+Given /^I am a product owner of the (.*) project$/ do |project|
+ role = Role.find(:first, :conditions => "name='Manager'")
+ role.permissions << :manage_backlog
+ role.save!
+end
+
+Given /^the (.*) project has the following sprints:$/ do |project, table|
+ @project = get_project(project)
+ table.hashes.each do |version|
+ version['project_id'] = @project.id
+ Version.create! version
+ end
+end
+
+Given /^I am viewing the (.*) master backlog$/ do |project|
+ login_as_product_owner
+ @project = get_project(project)
+ visit url_for(:controller => 'backlogs', :action=>'index', :project_id => project)
+end
+
+When /^I move the (\d+)(?:st|nd|rd|th) story to the (\d+)(?:st|nd|rd|th) position$/ do |old_pos, new_pos|
+ story = page.all(:css, "#product_backlog .stories .story .id")[old_pos.to_i-1]
+ prev = page.all(:css, "#product_backlog .stories .story .id")[new_pos.to_i-2]
+ story.should_not == nil
+ page.submit :post, url_for(:controller => 'stories', :action => 'update', :project_id => @project),
+ {:id => story.text, :prev => (prev.nil? ? '' : prev.text)}
+ response.should be_success
+ @story = Story.find(story.text.to_i)
+end
+
+Then /^I should see the product backlog$/ do
+ page.should have_css('#product_backlog')
+end
+
+Then /^the story should be at the top$/ do
+ @story.position.should == 1
+end
\ No newline at end of file
diff --git a/features/support/env.rb b/features/support/env.rb
index ff483d716f..ea7d764ee0 100644
--- a/features/support/env.rb
+++ b/features/support/env.rb
@@ -6,7 +6,9 @@
require 'rubygems'
require 'spork'
-
+require 'spec/expectations'
+require 'spec/matchers'
+
Spork.prefork do
ENV["RAILS_ENV"] ||= "cucumber"
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
diff --git a/features/support/setup.rb b/features/support/setup.rb
new file mode 100644
index 0000000000..194daa5e7d
--- /dev/null
+++ b/features/support/setup.rb
@@ -0,0 +1,22 @@
+# Sets up the Rails environment for Cucumber
+ENV["RAILS_ENV"] = "test"
+require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
+require 'cucumber/rails/world'
+Cucumber::Rails::World.use_transactional_fixtures
+
+#Seed the DB
+Fixtures.reset_cache
+fixtures_folder = File.join(RAILS_ROOT, 'test', 'fixtures')
+fixtures = Dir[File.join(fixtures_folder, '*.yml')].map {|f| File.basename(f, '.yml') }
+Fixtures.create_fixtures(fixtures_folder, fixtures)
+
+def get_project(identifier)
+ Project.find(:first, :conditions => "identifier='#{identifier}'")
+end
+
+def login_as_product_owner
+ visit url_for(:controller => 'account', :action=>'login')
+ fill_in 'username', :with => 'jsmith'
+ fill_in 'password', :with => 'jsmith'
+ click_button 'Login ยป'
+end
diff --git a/init.rb b/init.rb
index 16d42a8a58..766fff6837 100755
--- a/init.rb
+++ b/init.rb
@@ -35,6 +35,7 @@ Redmine::Plugin.register :redmine_backlogs do
:jsvariables,
:reorder,
:sprint_date,
+ :index,
:update ],
:stories => [
diff --git a/lib/tasks/extract_default_data.rake b/lib/tasks/extract_default_data.rake
new file mode 100644
index 0000000000..800448f1e4
--- /dev/null
+++ b/lib/tasks/extract_default_data.rake
@@ -0,0 +1,25 @@
+desc 'Create YAML files in features/fixtures'
+
+namespace :redmine do
+ namespace :backlogs_plugin do
+ task :extract_fixtures => :environment do
+ ENV["RAILS_ENV"] ||= "development"
+ sql = "SELECT * FROM %s"
+ skip_tables = ['schema_migrations']
+
+ ActiveRecord::Base.establish_connection
+
+ (ActiveRecord::Base.connection.tables - skip_tables).each do |table_name|
+ i = "000"
+ File.open("#{RAILS_ROOT}/vendor/plugins/redmine_backlogs/features/fixtures/#{table_name}.yml", 'w') do |file|
+ data = ActiveRecord::Base.connection.select_all(sql % table_name)
+ puts data
+ file.write data.inject({}) { |hash, record|
+ hash["#{table_name}_#{i.succ!}"] = record
+ hash
+ }.to_yaml
+ end
+ end
+ end
+ end
+end
\ No newline at end of file