Additional tests

pull/6827/head
Mark Maglana 14 years ago
parent 7deb462ee1
commit b68541e3fa
  1. 4
      app/views/backlogs/_backlog.html.erb
  2. 1
      config/routes.rb
  3. 2
      features/.autotest
  4. 6
      features/manage_stories.feature
  5. 22
      features/product_owner.feature
  6. 0
      features/step_definitions/global_steps.rb
  7. 53
      features/step_definitions/product_owner_steps.rb
  8. 4
      features/support/env.rb
  9. 22
      features/support/setup.rb
  10. 1
      init.rb
  11. 25
      lib/tasks/extract_default_data.rake

@ -35,7 +35,7 @@
:for => :product
},
{
:item => "<a class='show_charts' href='#{backlog.id}'>#{l(:label_burndown)}</a>",
:item => "<a class='show_charts' href='#{backlog[:id]}'>#{l(:label_burndown)}</a>",
: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" }
},

@ -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'

@ -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

@ -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

@ -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

@ -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')

@ -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

@ -35,6 +35,7 @@ Redmine::Plugin.register :redmine_backlogs do
:jsvariables,
:reorder,
:sprint_date,
:index,
:update ],
:stories => [

@ -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…
Cancel
Save