parent
7deb462ee1
commit
b68541e3fa
@ -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 |
@ -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 |
@ -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 |
@ -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 |
Loading…
Reference in new issue