Merge remote-tracking branch 'finnlabs/master'

Conflicts:
	spec/models/impediment_spec.rb
	spec/models/story_spec.rb
pull/6827/head
Gregor Schmidt 13 years ago
commit 8cc7a9bce1
  1. 2
      app/controllers/rb_application_controller.rb
  2. 2
      app/helpers/rb_common_helper.rb
  3. 4
      app/helpers/rb_master_backlogs_helper.rb
  4. 2
      app/models/burndown.rb
  5. 4
      app/models/sprint.rb
  6. 2
      app/models/story.rb
  7. 2
      app/models/task.rb
  8. 6
      app/views/shared/_settings.html.erb
  9. 8
      features/step_definitions/_given_steps.rb
  10. 1
      features/step_definitions/_then_steps.rb
  11. 9
      init.rb
  12. 2
      lib/backlogs/issue_actions.rb
  13. 2
      lib/backlogs/issue_edit_actions.rb
  14. 4
      lib/backlogs/issue_form.rb
  15. 2
      lib/backlogs/issue_form/notes_paragraph.rb
  16. 2
      lib/backlogs/issue_view/issue_hierarchy_paragraph.rb
  17. 4
      lib/taskboard_card/document.rb
  18. 8
      lib/taskboard_card/page_layout.rb
  19. 14
      lib/tasks/install.rake
  20. 10
      spec/models/backlog_spec.rb
  21. 10
      spec/models/burndown_spec.rb
  22. 10
      spec/models/impediment_spec.rb
  23. 10
      spec/models/issue_fixed_version_propagated_down_spec.rb
  24. 10
      spec/models/issue_fixed_version_restricted_spec.rb
  25. 10
      spec/models/issue_hierarchy_restriction_project_boundaries_spec.rb
  26. 4
      spec/models/issue_position_spec.rb
  27. 10
      spec/models/story_spec.rb
  28. 1
      spec/models/taskboard_card/card_area_spec.rb
  29. 7
      spec/models/version_spec.rb
  30. 15
      spec/spec_helper.rb

@ -21,7 +21,7 @@ class RbApplicationController < ApplicationController
def check_if_plugin_is_configured
settings = Setting.plugin_backlogs
if settings[:story_trackers].blank? || settings[:task_tracker].blank?
if settings["story_trackers"].blank? || settings["task_tracker"].blank?
respond_to do |format|
format.html { render :file => "shared/not_configured" }
end

@ -131,7 +131,7 @@ module RbCommonHelper
end
def available_story_trackers
trackers = Tracker.find(:all, :conditions => {:id => Setting.plugin_backlogs[:story_trackers]},
trackers = Tracker.find(:all, :conditions => {:id => Setting.plugin_backlogs["story_trackers"]},
:order => 'position')
trackers &= @project.trackers if @project

@ -11,10 +11,10 @@ module RbMasterBacklogsHelper
backlog_menu_items_for(backlog).map do |item|
content_tag(:li, item, :class => 'item')
end
end.join
end
]
].join
end
end

@ -212,7 +212,7 @@ class Burndown
end
def initialize(sprint, project, burn_direction = nil)
burn_direction ||= Setting.plugin_backlogs[:points_burn_direction]
burn_direction ||= Setting.plugin_backlogs["points_burn_direction"]
@sprint_id = sprint.id

@ -50,7 +50,7 @@ class Sprint < Version
page = project.wiki.find_page(self.wiki_page_title)
return false if !page
template = project.wiki.find_page(Setting.plugin_backlogs[:wiki_template])
template = project.wiki.find_page(Setting.plugin_backlogs["wiki_template"])
return false if template && page.text == template.text
true
@ -62,7 +62,7 @@ class Sprint < Version
self.update_attribute(:wiki_page_title, Wiki.titleize(self.name)) if wiki_page_title.blank?
page = project.wiki.find_page(self.wiki_page_title)
template = project.wiki.find_page(Setting.plugin_backlogs[:wiki_template])
template = project.wiki.find_page(Setting.plugin_backlogs["wiki_template"])
if template and not page
page = project.wiki.pages.build(:title => self.wiki_page_title)

@ -61,7 +61,7 @@ class Story < Issue
end
def self.trackers
trackers = Setting.plugin_backlogs[:story_trackers]
trackers = Setting.plugin_backlogs["story_trackers"]
return [] if trackers.blank?
trackers.map { |tracker| Integer(tracker) }

@ -4,7 +4,7 @@ class Task < Issue
unloadable
def self.tracker
task_tracker = Setting.plugin_backlogs[:task_tracker]
task_tracker = Setting.plugin_backlogs["task_tracker"]
task_tracker.blank? ? nil : task_tracker.to_i
end

@ -50,16 +50,16 @@
<%= label_tag("settings[points_burn_direction]", l(:backlogs_points_burn_direction)) %>
<%= select_tag("settings[points_burn_direction]",
options_for_select([[l(:label_points_burn_up), 'up'], [l(:label_points_burn_down), 'down']],
Setting.plugin_backlogs[:points_burn_direction])) %>
Setting.plugin_backlogs["points_burn_direction"])) %>
</p>
<p>
<%= label_tag("settings[card_spec]", l(:backlogs_card_specification)) %>
<%= select_tag("settings[card_spec]",
options_for_select(TaskboardCard::PageLayout::LABELS.keys.sort.collect{|label| [label, label]},
Setting.plugin_backlogs[:card_spec])) %>
Setting.plugin_backlogs["card_spec"])) %>
</p>
<p>
<%= label_tag("settings[wiki_template]", l(:backlogs_wiki_template)) %>
<%= text_field_tag("settings[wiki_template]",
Setting.plugin_backlogs[:wiki_template]) %>
Setting.plugin_backlogs["wiki_template"]) %>
</p>

@ -249,7 +249,7 @@ end
Given /^I have selected card label stock (.+)$/ do |stock|
settings = Setting.plugin_backlogs
settings[:card_spec] = stock
settings["card_spec"] = stock
Setting.plugin_backlogs = settings
# If this goes wrong, you are probably missing
@ -288,7 +288,7 @@ Given /^I have set the content for wiki page (.+) to (.+)$/ do |title, content|
end
Given /^I have made (.+) the template page for sprint notes/ do |title|
Setting.plugin_backlogs = Setting.plugin_backlogs.merge({:wiki_template => Wiki.titleize(title)})
Setting.plugin_backlogs = Setting.plugin_backlogs.merge("wiki_template" => Wiki.titleize(title))
end
Given /^there are no stories in the [pP]roject$/ do
@ -303,7 +303,7 @@ Given /^the tracker "(.+?)" is configured to track tasks$/ do |tracker_name|
tracker = Tracker.find_by_name(tracker_name)
tracker = Factory.create(:tracker, :name => tracker_name) if tracker.blank?
Setting.plugin_backlogs = Setting.plugin_backlogs.merge(:task_tracker => tracker.id)
Setting.plugin_backlogs = Setting.plugin_backlogs.merge("task_tracker" => tracker.id)
end
Given /^the following trackers are configured to track stories:$/ do |table|
@ -319,7 +319,7 @@ Given /^the following trackers are configured to track stories:$/ do |table|
# otherwise the tracker id's from the previous test are still active
Issue.instance_variable_set(:@backlogs_trackers, nil)
Setting.plugin_backlogs = Setting.plugin_backlogs.merge(:story_trackers => story_trackers.map(&:id))
Setting.plugin_backlogs = Setting.plugin_backlogs.merge("story_trackers" => story_trackers.map(&:id))
end
Given /^the [tT]racker(?: "([^\"]*)")? has for the Role "(.+?)" the following workflows:$/ do |tracker_name, role_name, table|

@ -1,3 +1,4 @@
#-- encoding: UTF-8
Then /^(.+) should be in the (\d+)(?:st|nd|rd|th) position of the sprint named (.+)$/ do |story_subject, position, sprint_name|
position = position.to_i
story = Story.find(:first, :conditions => ["subject=? and name=?", story_subject, sprint_name], :joins => :fixed_version)

@ -4,6 +4,7 @@ require 'acts_as_silent_list'
Dispatcher.to_prepare do
require_dependency 'issue'
require_dependency 'task'
if Issue.const_defined? "SAFE_ATTRIBUTES"
Issue::SAFE_ATTRIBUTES << "story_points"
@ -47,9 +48,9 @@ Redmine::Plugin.register :backlogs do
settings :default => {
:story_trackers => nil,
:task_tracker => nil,
:card_spec => nil
"story_trackers" => nil,
"task_tracker" => nil,
"card_spec" => nil
},
:partial => 'shared/settings'
@ -111,5 +112,5 @@ Redmine::Plugin.register :backlogs do
:caption => :project_module_backlogs,
:before => :calendar,
:param => :project_id,
:if => lambda { not(User.current.respond_to?(:impaired?) and User.current.impaired?) }
:if => proc { not(User.current.respond_to?(:impaired?) and User.current.impaired?) }
end

@ -8,6 +8,6 @@ class Backlogs::IssueActions < ChiliProject::Nissue::View
content_tag(:div, [
t.watcher_link(@issue, User.current, :class => css_class, :replace => ".#{css_class}"),
(t.modal_link_to(l(:button_update), {:controller => 'issue_boxes', :action => 'edit', :id => @issue }, :class => 'icon icon-edit') if t.authorize_for('issue_boxes', 'edit'))
], :class => 'contextual')
].join, :class => 'contextual')
end
end

@ -17,6 +17,6 @@ class Backlogs::IssueEditActions < ChiliProject::Nissue::View
:update => @html_id,
:with => "Form.serialize('#{@form_id}')"
}, { :class => 'icon icon-save', :accesskey => t.accesskey(:update) }) if t.authorize_for('issue_boxes', 'update'))
], :class => 'contextual')
].join, :class => 'contextual')
end
end

@ -19,12 +19,12 @@ class Backlogs::IssueForm < Backlogs::IssueView
errors_paragraph.render(t),
s,
notes_paragraph.render(t)
], :id => form_id)
].join, :id => form_id)
end
def errors_paragraph
@errors_paragraph ||= ChiliProject::Nissue::SimpleParagraph.new(@issue) do |t|
content_tag(:div, [t.error_messages_for('issue')], :style => "clear:right")
content_tag(:div, t.error_messages_for('issue'), :style => "clear:right")
end
end

@ -8,7 +8,7 @@ class Backlogs::IssueForm::NotesParagraph < ChiliProject::Nissue::IssueView::Des
s = content_tag(:fieldset, [
content_tag(:legend, l(:field_notes)),
t.text_area_tag('issue[notes]', '', :cols => 60, :rows => 10, :class => 'wiki-edit', :id => html_id),
t.wikitoolbar_for(html_id) ]
t.wikitoolbar_for(html_id) ].join
)
end
end

@ -65,7 +65,7 @@ class Backlogs::IssueView::IssueHierarchyParagraph < ChiliProject::Nissue::Issue
content_tag('td', h(issue.status)),
content_tag('td', t.link_to_user(issue.assigned_to)),
content_tag('td', t.link_to_version(issue.fixed_version))
],
].join,
:class => css_classes.join(' '))
end
end

@ -24,9 +24,9 @@ module TaskboardCard
def initialize(lang)
set_language_if_valid lang
raise "No label stock selected" unless Setting.plugin_backlogs[:card_spec]
raise "No label stock selected" unless Setting.plugin_backlogs["card_spec"]
label = PageLayout.selected_label
raise "Label stock \"#{Setting.plugin_backlogs[:card_spec]}\" not found" unless label
raise "Label stock \"#{Setting.plugin_backlogs["card_spec"]}\" not found" unless label
label['papersize'].upcase!

@ -30,7 +30,7 @@ module TaskboardCard
end
def selected_label
LABELS[Setting.plugin_backlogs[:card_spec]]
LABELS[Setting.plugin_backlogs["card_spec"]]
end
def measurement(x)
@ -135,12 +135,12 @@ module TaskboardCard
YAML.dump(malformed_labels, dump)
end
if Setting.plugin_backlogs[:card_spec] && ! PageLayout.selected_label && LABELS.size != 0
if Setting.plugin_backlogs["card_spec"] && ! PageLayout.selected_label && LABELS.size != 0
# current label non-existant
label = LABELS.keys[0]
puts "Non-existant label stock '#{Setting.plugin_backlogs[:card_spec]}' selected, replacing with random '#{label}'"
puts "Non-existant label stock '#{Setting.plugin_backlogs["card_spec"]}' selected, replacing with random '#{label}'"
s = Setting.plugin_backlogs
s[:card_spec] = label
s["card_spec"] = label
Setting.plugin_backlogs = s
end
end

@ -28,8 +28,8 @@ namespace :redmine do
# Necessary because adding key-value pairs one by one doesn't seem to work
settings = Setting.plugin_backlogs
settings[:points_burn_direction] ||= 'down'
settings[:wiki_template] ||= ''
settings["points_burn_direction"] ||= 'down'
settings["wiki_template"] ||= ''
puts
puts "====================================================="
@ -41,7 +41,7 @@ namespace :redmine do
Rake::Task['redmine:backlogs:current_labels'].invoke
end
settings[:card_spec] ||= Cards::TaskboardCards::LABELS.keys[0] unless Cards::TaskboardCards::LABELS.size == 0
settings["card_spec"] ||= Cards::TaskboardCards::LABELS.keys[0] unless Cards::TaskboardCards::LABELS.size == 0
trackers = Tracker.find(:all)
@ -79,19 +79,19 @@ namespace :redmine do
end
end
settings[:story_trackers] = selection.map{ |s| trackers[s.to_i-1].id }
settings["story_trackers"] = selection.map{ |s| trackers[s.to_i-1].id }
end
if !Task.tracker
# Check if there is at least one tracker available
puts "-----------------------------------------------------"
if settings[:story_trackers].length < trackers.length
if settings["story_trackers"].length < trackers.length
invalid = true
while invalid
# If there's at least one, ask the user to pick one
puts "Which tracker do you want to use for your tasks?"
available_trackers = trackers.select{|t| !settings[:story_trackers].include? t.id}
available_trackers = trackers.select{|t| !settings["story_trackers"].include? t.id}
j = 0
available_trackers.each_with_index { |t, i| puts " #{ j = i + 1 }. #{ t.name }" }
@ -104,7 +104,7 @@ namespace :redmine do
print "You selected #{available_trackers[selection.first.to_i-1].name}. Is this correct? (y/n) "
STDOUT.flush
if (STDIN.gets.chomp!).match("y")
settings[:task_tracker] = available_trackers[selection.first.to_i-1].id
settings["task_tracker"] = available_trackers[selection.first.to_i-1].id
invalid = false
end
else

@ -5,11 +5,11 @@ describe Backlog do
before(:each) do
@feature = Factory.create(:tracker_feature)
Setting.plugin_backlogs = {:points_burn_direction => "down",
:wiki_template => "",
:card_spec => "Sattleford VM-5040",
:story_trackers => [@feature.id.to_s],
:task_tracker => "0"}
Setting.plugin_backlogs = {"points_burn_direction" => "down",
"wiki_template" => "",
"card_spec" => "Sattleford VM-5040",
"story_trackers" => [@feature.id.to_s],
"task_tracker" => "0"}
@status = Factory.create(:issue_status)
end

@ -40,11 +40,11 @@ describe Burndown do
let(:issue_resolved) { @status3 ||= Factory.create(:issue_status, :name => "status 3", :is_closed => false) }
before(:each) do
Setting.plugin_backlogs = {:points_burn_direction => "down",
:wiki_template => "",
:card_spec => "Sattleford VM-5040",
:story_trackers => [tracker_feature.id.to_s],
:task_tracker => tracker_task.id.to_s }
Setting.plugin_backlogs = {"points_burn_direction" => "down",
"wiki_template" => "",
"card_spec" => "Sattleford VM-5040",
"story_trackers" => [tracker_feature.id.to_s],
"task_tracker" => tracker_task.id.to_s }
project.save!

@ -45,11 +45,11 @@ describe Impediment do
before(:each) do
Setting.use_caching = false
Setting.plugin_backlogs = {:points_burn_direction => "down",
:wiki_template => "",
:card_spec => "Sattleford VM-5040",
:story_trackers => [tracker_feature.id.to_s],
:task_tracker => tracker_task.id.to_s }
Setting.plugin_backlogs = {"points_burn_direction" => "down",
"wiki_template" => "",
"card_spec" => "Sattleford VM-5040",
"story_trackers" => [tracker_feature.id.to_s],
"task_tracker" => tracker_task.id.to_s }
User.current = user
issue_priority.save

@ -134,11 +134,11 @@ describe Issue, "changing a story's fixed_version changes the fixed_version of a
before(:each) do
project.save!
Setting.plugin_backlogs = {:points_burn_direction => "down",
:wiki_template => "",
:card_spec => "Sattleford VM-5040",
:story_trackers => [tracker_feature.id],
:task_tracker => tracker_task.id.to_s}
Setting.plugin_backlogs = {"points_burn_direction" => "down",
"wiki_template" => "",
"card_spec" => "Sattleford VM-5040",
"story_trackers" => [tracker_feature.id],
"task_tracker" => tracker_task.id.to_s}
# otherwise the tracker id's from the previous test are still active
Issue.instance_variable_set(:@backlogs_trackers, nil)

@ -235,11 +235,11 @@ describe Issue, "fixed version restricted by an issues parents (if it's a task)"
before(:each) do
project.save!
Setting.plugin_backlogs = {:points_burn_direction => "down",
:wiki_template => "",
:card_spec => "Sattleford VM-5040",
:story_trackers => [tracker_feature.id],
:task_tracker => tracker_task.id.to_s}
Setting.plugin_backlogs = {"points_burn_direction" => "down",
"wiki_template" => "",
"card_spec" => "Sattleford VM-5040",
"story_trackers" => [tracker_feature.id],
"task_tracker" => tracker_task.id.to_s}
# otherwise the tracker id's from the previous test are still active
Issue.instance_variable_set(:@backlogs_trackers, nil)

@ -96,11 +96,11 @@ describe Issue, 'parent-child relationships between backlogs stories and backlog
parent_project.save!
child_project.save!
Setting.plugin_backlogs = {:points_burn_direction => "down",
:wiki_template => "",
:card_spec => "Sattleford VM-5040",
:story_trackers => [tracker_feature.id],
:task_tracker => tracker_task.id.to_s}
Setting.plugin_backlogs = {"points_burn_direction" => "down",
"wiki_template" => "",
"card_spec" => "Sattleford VM-5040",
"story_trackers" => [tracker_feature.id],
"task_tracker" => tracker_task.id.to_s}
# otherwise the tracker id's from the previous test are still active
Issue.instance_variable_set(:@backlogs_trackers, nil)

@ -56,8 +56,8 @@ describe Issue do
# enable and configure backlogs
project.enabled_module_names = project.enabled_module_names + ["backlogs"]
Setting.plugin_backlogs = {:story_trackers => [story_tracker.id, epic_tracker.id],
:task_tracker => task_tracker.id}
Setting.plugin_backlogs = {"story_trackers" => [story_tracker.id, epic_tracker.id],
"task_tracker" => task_tracker.id}
# otherwise the tracker id's from the previous test are still active
Issue.instance_variable_set(:@backlogs_trackers, nil)

@ -22,11 +22,11 @@ describe Story do
before(:each) do
Setting.use_caching = false
Setting.plugin_backlogs = {:points_burn_direction => "down",
:wiki_template => "",
:card_spec => "Sattleford VM-5040",
:story_trackers => [tracker_feature.id.to_s],
:task_tracker => "0"}
Setting.plugin_backlogs = {"points_burn_direction" => "down",
"wiki_template" => "",
"card_spec" => "Sattleford VM-5040",
"story_trackers" => [tracker_feature.id.to_s],
"task_tracker" => "0"}
end
describe "Class methods" do

@ -1,3 +1,4 @@
#-- encoding: UTF-8
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
describe TaskboardCard::CardArea do

@ -40,8 +40,8 @@ describe Version do
# enable and configure backlogs
project.enabled_module_names = project.enabled_module_names + ["backlogs"]
Setting.plugin_backlogs = {:story_trackers => [epic_tracker.id, story_tracker.id],
:task_tracker => task_tracker.id}
Setting.plugin_backlogs = {"story_trackers" => [epic_tracker.id, story_tracker.id],
"task_tracker" => task_tracker.id}
# otherwise the tracker id's from the previous test are still active
Issue.instance_variable_set(:@backlogs_trackers, nil)
@ -62,7 +62,8 @@ describe Version do
[e1, s2, s3, s4, s5].each(&:move_to_bottom)
# messing around with positions
[s3, s4].map(&:assume_not_in_list)
s3.send :assume_not_in_list
s4.send :assume_not_in_list
t3.send(:update_attribute_silently, :position, 3)
o9.send(:update_attribute_silently, :position, 9)

@ -7,20 +7,7 @@ begin
rescue LoadError
end
begin
require 'spec/spec_helper'
rescue LoadError => error
puts <<-EOS
You need to install rspec in your Redmine project.
Please execute the following code:
gem install rspec-rails
script/generate rspec
EOS
raise error
end
require './spec/spec_helper'
require 'redmine_factory_girl'

Loading…
Cancel
Save