Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A bunch of commits to keep this plugin compatible with Redmine 4.x #245

Open
wants to merge 93 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
83436ce
modif Neticoa pour Redmine2
May 26, 2015
a68aa20
modifs pour Redmine 3.0
May 26, 2015
d53e26f
modif Redmine 3.0 suite
Sep 30, 2015
db98e23
export pour le plugin impasse sans jruby
fboninneticoa Oct 14, 2015
f64f6b7
Correction copie de TestCase
Oct 30, 2015
d142b7e
Correction export CSV
Jan 8, 2016
e72450c
Compatibility with Redmine 2
May 26, 2015
faf0402
Compatibility with Redmine 3.0
May 26, 2015
85fc1cf
Compatibility with Redmine 3.0 completed
Sep 30, 2015
095f242
Allow export without jruby
fboninneticoa Oct 14, 2015
6700eca
Resolve TestCase copy bug
Oct 30, 2015
dba5aeb
Resolve CSV export
Jan 8, 2016
1231fcb
Modify issue attribute rendering to use new helper
Jan 22, 2016
d905a07
Merge branch 'master' of gitlab.neticoa.ovh:redmine/redmine_impasse
Jan 22, 2016
26695f3
new pagination style in Redmine 3.2
Feb 8, 2016
b5e1a2c
Merge branch 'master' of gitlab.neticoa.ovh:redmine/redmine_impasse
Feb 8, 2016
4069b33
problems of interaction between several plugins
May 20, 2016
60b5b8e
Merge branch 'master' of gitlab.neticoa.ovh:redmine/redmine_impasse
May 20, 2016
d25881a
Conflict with the existing Redmine REST API in JSON format
May 25, 2016
d7b0e66
Conflict with the existing Redmine REST API in JSON format
May 25, 2016
993c1b5
Merge branch 'master' of gitlab.neticoa.ovh:redmine/redmine_impasse
May 25, 2016
fe20c8e
Update README.rdoc
May 27, 2016
6bf9e3c
Merge commit 'fe20c8ef011659093adfecc84ba31c2d6df2980d' into HEAD
May 27, 2016
4cdee78
fixes #16930 :Le test n'est pas affiché avec la bonne balise html dan…
Jun 2, 2016
8ed639f
Merge branch 'fix_16930-dev' into 'develop'
Jun 3, 2016
c2dfc1a
Merge commit '8ed639fc5ef5e81f299d7b0f0832b203bbb3a3d1' into HEAD
Jun 3, 2016
722a1c7
refs #16949: Changer la version du plugin en 1.2.2-NCOA07 et création…
Jun 3, 2016
92ad05d
Merge commit '722a1c7f21d50a1f6913acc546a2b3379a089502' into HEAD
Jun 3, 2016
03a4e9c
fixes #16621 :Le passage à la ligne dans une étape n'est pas affichée…
Jun 3, 2016
1293008
Merge branch 'fix_16621-dev' into 'develop'
Jun 3, 2016
01309b5
Merge commit '12930081f2aa31fd933a77f5aa1e9df8fd47f8ea' into HEAD
Jun 3, 2016
484de38
refs #16930 :refactoring
Jun 3, 2016
5ec31f0
Merge branch 'fix_16930-dev' into 'develop'
Jun 6, 2016
484e420
Merge commit '5ec31f06bc5fd1a52653d044f6da71b1bc514293' into HEAD
Jun 6, 2016
a415ecc
bugg corrigé reste un probléme de rafraichissement
Jun 7, 2016
5da3ba3
fixes #16617 :Le scrolling de la page ne marche pas quand il y a trop…
Jun 7, 2016
1d05449
fixes #16618 :Oublier de renseigner 'Résultats attendus' empêche les …
Jun 7, 2016
68b082b
Merge branch 'fix_16618-dev' into 'develop'
Jun 7, 2016
b74beae
Merge commit '68b082b0f9fdacc063f45f2ad3ecbf1036b35fe8' into HEAD
Jun 7, 2016
8335042
re-indent code
Jun 7, 2016
151c76d
fixes #16623 :On ne peut pas réutiliser les étapes supprimées
Jun 7, 2016
ecf1ec0
fixes #16622 :probléme de rafraichissmenté résolu
Jun 7, 2016
336cee7
Merge branch 'fix_16623-dev' into 'develop'
Jun 7, 2016
d2658f4
Merge commit '336cee7f31a8454c73883561f013fe5b900c34e4' into HEAD
Jun 7, 2016
d2680cb
fixes #16622 :L'appui sur screenshot empêche l'enregistrement ultérieur
Jun 9, 2016
c18108f
Merge branch 'develop' into fix_16622-dev
Jun 9, 2016
8966172
refs #16622 :correction bug
Jun 9, 2016
30f65c1
resolve merge conflit with develop
Jun 9, 2016
192a576
fixes #16948 :[Plugin Impasse] Pouvoir exporter les tests au format C…
Jun 9, 2016
2df0863
Merge branch 'fix_16622-dev' into 'develop'
Jun 10, 2016
28b6d36
Merge branch 'feat_16948-dev' into 'develop'
Jun 10, 2016
beaf525
Merge commit '28b6d36c112ae5345856445617620e5d7ca2bdb8' into HEAD
Jun 10, 2016
8847435
fixes :#16618 :Oublier de renseigner 'Résultats attendus' empêche les…
Jun 13, 2016
81ea3ff
conflit resolved
Jun 13, 2016
dc5a7c9
Merge branch 'fix_16618-dev' into 'develop'
Jun 13, 2016
9eb2a45
Merge commit 'dc5a7c9c5ad574c60bac56ff3cd542ec00124d5d' into HEAD
Jun 13, 2016
9ef9616
fixes #17281
Jun 14, 2016
79bcbdf
refactoring
Jun 14, 2016
a9f4338
Merge branch 'feat_17281-dev' into 'develop'
Jun 14, 2016
738eb48
Merge commit 'a9f433870a87d9f94072fcb5e54e49928096f800' into HEAD
Jun 14, 2016
4d759ee
fixes #16948 :ajout de l'étape au niveau de la génération CSV
Jun 15, 2016
0185687
resolution merge conflit
Jun 15, 2016
3438c04
Merge branch 'feat_16948-dev' into 'develop'
Jun 15, 2016
19bc143
Merge commit '3438c04e3163473e86b1edf33017ed6054475f78' into HEAD
Jun 15, 2016
1db48c1
fixes #16623 :Pouvoirs réutiliser les numéros supprimés
Jun 15, 2016
298926b
generation dynamique step_number
Jun 15, 2016
275a62b
refs #16623 :refactoring
Jun 15, 2016
aeb822f
suppression log
Jun 15, 2016
9ec0739
Merge branch 'fix_16623-dev' into 'develop'
Jun 15, 2016
cd255c0
Merge commit '9ec07395b6b5484ba416298b5c30b69e199f7422' into HEAD
Jun 15, 2016
cdf7863
refs #17299 ; Traduction française d'une petite partie de texte (perm…
agegout Jul 8, 2016
1b15ecc
Merge branch 'fix_17299-dev' into 'develop'
Jul 11, 2016
c686b34
Allow to create new issue without project
Oct 19, 2016
23cc969
Allow to create new issue without project
Oct 19, 2016
3de0ece
date_field instead of text_field for calendar in Redmine 3.3
Oct 19, 2016
366297c
fixes #18309 - Bad display of 'creation of a defect' with the new theme
Oct 24, 2016
2acd7ef
Change permissions on snapshot. There is no reason than File module s…
Oct 25, 2016
a2a8060
fixes #17295 - Screenshot management - Partially resolved as the copy…
Oct 25, 2016
d866540
Amélioration de la navigation dans les tests
Aug 10, 2017
35696cc
Avoid screen flickering when the css fixed property is used
Aug 11, 2017
b51280b
Avoid screen flickering when the css fixed property is used
Aug 11, 2017
4dea699
adaptations pour le theme abacus
Aug 11, 2017
91efbdf
vue execution : retour du floatmenu avec le theme Abacus
Aug 16, 2017
e251fcd
Fix floating div height
Sep 13, 2017
0c0eafa
fixed deprecated calls
Jan 26, 2018
25803f4
Redmine 3.4
Jan 26, 2018
af41e66
Fix 404 error on saving plan test defect #25378
Feb 6, 2018
04d9d58
Fix warning in logs
Feb 7, 2018
b02d009
Fix floating div height on resize
Feb 28, 2018
5bcebbd
Fix conversion TrueClass to integer
Apr 9, 2018
c8665d1
feat(rails5): sync with rails 5.2.2
Mar 11, 2019
1aa4f2b
Adaptations to Redmine 4.0.X : works in progress
Jun 4, 2019
4579cc7
Fixes for Redmine 4.x
Jun 7, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions app/controllers/impasse_custom_fields_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class ImpasseCustomFieldsController < ImpasseAbstractController
before_filter :require_admin

def index
@custom_fields_by_type = CustomField.find(:all).group_by {|f| f.class.name }
@custom_fields_by_type = CustomField.all.group_by {|f| f.class.name }
@tab = params[:tab] || 'Impasse::TestCaseCustomField'
end

Expand All @@ -19,23 +19,23 @@ def new
rescue
end
(redirect_to(:action => 'index'); return) unless @custom_field.is_a?(CustomField)
if request.post? and @custom_field.save
if (request.post? or request.patch?) and @custom_field.save
flash[:notice] = l(:notice_successful_create)
call_hook(:controller_custom_fields_new_after_save, :params => params, :custom_field => @custom_field)
redirect_to :action => 'index', :tab => @custom_field.class.name
else
@trackers = Tracker.find(:all, :order => 'position')
@trackers = Tracker.all.order(:position)
end
end

def edit
@custom_field = CustomField.find(params[:id])
if (request.post? || request.put?) and @custom_field.update_attributes(params[:custom_field])
if (request.post? || request.put? or request.patch?) and @custom_field.update_attributes(params[:custom_field])
flash[:notice] = l(:notice_successful_update)
call_hook(:controller_custom_fields_edit_after_save, :params => params, :custom_field => @custom_field)
redirect_to :action => 'index', :tab => @custom_field.class.name
else
@trackers = Tracker.find(:all, :order => 'position')
@trackers = Tracker.all.order(:position)
end
end

Expand Down
16 changes: 7 additions & 9 deletions app/controllers/impasse_execution_bugs_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ class ImpasseExecutionBugsController < ImpasseAbstractController

menu_item :impasse
before_filter :find_project_by_project_id, :only => [:new, :create]
before_filter :check_for_default_issue_status, :only => [:new, :create]
before_filter :build_new_issue_from_params, :only => [:new, :create]

helper :journals
Expand All @@ -23,10 +22,11 @@ class ImpasseExecutionBugsController < ImpasseAbstractController
include RepositoriesHelper
helper :sort
include SortHelper
helper :issues
include IssuesHelper

def new
setting = Impasse::Setting.find_or_create_by_project_id(@project)
setting = Impasse::Setting.find_or_initialize_by(:project_id => @project)
@issue.tracker_id = setting.bug_tracker_id unless setting.bug_tracker_id.nil?

respond_to do |format|
Expand Down Expand Up @@ -70,7 +70,11 @@ def build_new_issue_from_params
@issue = @project.issues.visible.find(params[:id])
end
@issue.project = @project # Tracker must be set before custom field values
@issue.tracker ||= @project.trackers.find((params[:issue] && params[:issue][:tracker_id]) || params[:tracker_id] || :first)
if (params[:issue] && params[:issue][:tracker_id]) || params[:tracker_id]
@issue.tracker ||= @project.trackers.find((params[:issue] && params[:issue][:tracker_id]) || params[:tracker_id])
else
@issue.tracker ||= @project.trackers.first
end
if @issue.tracker.nil?
render_error l(:error_no_tracker_in_project)
return false
Expand All @@ -86,10 +90,4 @@ def build_new_issue_from_params
@available_watchers = (@issue.project.users.sort + @issue.watcher_users).uniq
end

def check_for_default_issue_status
if IssueStatus.default.nil?
render_error l(:error_no_default_issue_status)
return false
end
end
end
28 changes: 12 additions & 16 deletions app/controllers/impasse_executions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,11 @@ def put
status = 'success'
errors = []
for test_case_id in test_case_ids
test_plan_case = Impasse::TestPlanCase.find(:first, :conditions=>[
"test_plan_id=? AND test_case_id=?",
params[:test_plan_case][:test_plan_id],
test_case_id])
test_plan_case = Impasse::TestPlanCase.where("test_plan_id=? AND test_case_id=?",params[:test_plan_case][:test_plan_id],
test_case_id).first
next if test_plan_case.nil?
execution = Impasse::Execution.find_or_initialize_by_test_plan_case_id(test_plan_case.id)
execution.attributes = params[:execution]
execution = Impasse::Execution.find_or_initialize_by(:test_plan_case_id => test_plan_case.id)
execution.update_attributes(params[:execution])
if params[:record]
execution.execution_ts = Time.now.to_datetime
execution.executor_id = User.current.id
Expand Down Expand Up @@ -66,10 +64,10 @@ def destroy

status = true
for test_case_id in test_case_ids
test_plan_case = Impasse::TestPlanCase.find(:first, :conditions=>[
"test_plan_id=? AND test_case_id=?", params[:test_plan_case][:test_plan_id], test_case_id])
test_plan_case = Impasse::TestPlanCase.where(
"test_plan_id=? AND test_case_id=?", params[:test_plan_case][:test_plan_id], test_case_id).first
next if test_plan_case.nil?
execution = Impasse::Execution.find_by_test_plan_case_id(test_plan_case.id)
execution = Impasse::Execution.find_by(:test_plan_case_id => test_plan_case.id)
next if execution.nil?
execution.tester_id = execution.expected_date = nil
satus &= execution.save
Expand Down Expand Up @@ -98,16 +96,14 @@ def edit
executions = Impasse::Execution.find_by_sql [sql, params[:test_plan_case][:test_plan_id], params[:test_plan_case][:test_case_id]]
if executions.size == 0
@execution = Impasse::Execution.new
@execution.test_plan_case = Impasse::TestPlanCase.find_by_test_plan_id_and_test_case_id(
params[:test_plan_case][:test_plan_id], params[:test_plan_case][:test_case_id])
@execution.test_plan_case = Impasse::TestPlanCase.find_by(
:test_plan_id => params[:test_plan_case][:test_plan_id], :test_case_id => params[:test_plan_case][:test_case_id])
else
@execution = executions.first
end
@execution.attributes = params[:execution]
@execution_histories = Impasse::ExecutionHistory.find(:all, :joins => [ :executor ],
:conditions => ["test_plan_case_id=?", @execution.test_plan_case_id],
:order => "execution_ts DESC")
if request.post? and @execution.save
@execution.update_attributes(params[:execution]) if params[:execution].present?
@execution_histories = Impasse::ExecutionHistory.where(:test_plan_case_id => @execution.test_plan_case_id).joins(:executor).order("execution_ts DESC")
if (request.post? or request.patch?) and @execution.save
render :json => {'status'=>true}
else
render :partial=>'edit'
Expand Down
8 changes: 4 additions & 4 deletions app/controllers/impasse_requirement_issues_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class ImpasseRequirementIssuesController < ImpasseAbstractController

def index
@project = Project.find(params[:project_id])
setting = Impasse::Setting.find_by_project_id(@project.id)
setting = Impasse::Setting.find_by(:project_id => @project.id)
params[:set_filter] = true
params[:fields] ||= []
params[:fields] << 'tracker_id'
Expand Down Expand Up @@ -42,7 +42,7 @@ def index

def add_test_case
ActiveRecord::Base.transaction do
requirement_issue = Impasse::RequirementIssue.find_by_issue_id(params[:issue_id]) || Impasse::RequirementIssue.create(:issue_id => params[:issue_id])
requirement_issue = Impasse::RequirementIssue.find_by(:issue_id => params[:issue_id]) || Impasse::RequirementIssue.create(:issue_id => params[:issue_id])
node = Impasse::Node.find(params[:test_case_id])
if node.is_test_case?
create_requirement_case(requirement_issue.id, node.id)
Expand All @@ -59,7 +59,7 @@ def add_test_case
def remove_test_case
ActiveRecord::Base.transaction do
requirement_issue = Impasse::RequirementIssue.find(params[:id])
requirement_cases = requirement_issue.requirement_cases.find(:first, :conditions => { :test_case_id => params[:test_case_id] })
requirement_cases = requirement_issue.requirement_cases.where(:test_case_id => params[:test_case_id]).first
requirement_cases.destroy

render :json => { :status => 'success', :message => l(:notice_successful_delete) }
Expand All @@ -68,7 +68,7 @@ def remove_test_case

private
def create_requirement_case(requirement_id, test_case_id)
Impasse::RequirementCase.find_by_requirement_id_and_test_case_id(requirement_id, test_case_id) || Impasse::RequirementCase.create(:requirement_id => requirement_id, :test_case_id => test_case_id)
Impasse::RequirementCase.find_by(:requirement_id => requirement_id, :test_case_id => test_case_id) || Impasse::RequirementCase.create(:requirement_id => requirement_id, :test_case_id => test_case_id)
end

end
8 changes: 4 additions & 4 deletions app/controllers/impasse_settings_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ def index
end

def edit
@setting = Impasse::Setting.find_or_create_by_project_id(:project_id => @project.id)
@setting = Impasse::Setting.find_or_initialize_by(:project_id => @project.id)
unless params[:setting][:requirement_tracker]
params[:setting][:requirement_tracker] = []
end
@setting.attributes = params[:setting]
if request.put? or request.post?
@setting.update_attributes(params[:setting])
if request.put? or request.post? or request.patch?
ActiveRecord::Base.transaction do
custom_fields_by_type = {
'Impasse::TestCaseCustomField' => [],
Expand All @@ -30,7 +30,7 @@ def edit
@project.execution_custom_fields = custom_fields_by_type['Impasse::ExecutionCustomField']
@setting.save!
flash[:notice] = l(:notice_successful_update)
redirect_to :controller => '/projects', :action => 'settings', :id => @project, :tab => 'impasse'
redirect_to settings_project_path(@project, :tab => 'impasse')
end
end
end
Expand Down
32 changes: 16 additions & 16 deletions app/controllers/impasse_test_case_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ def index
@allowed_projects = Issue.allowed_target_projects_on_move
@allowed_projects.delete_if{|project| @project.id == project.id }
end
@setting = Impasse::Setting.find_by_project_id(@project) || Impasse::Setting.create(:project_id => @project.id)
@setting = Impasse::Setting.find_by(:project_id => @project) || Impasse::Setting.create(:project_id => @project.id)
end

def list
if params[:node_id].to_i == -1
root = Impasse::Node.find_by_name_and_node_type_id(@project.identifier, 1)
root = Impasse::Node.find_by(:name => @project.identifier, :node_type_id => 1)
@nodes = Impasse::Node.find_children(root.id, params[:test_plan_id], params[:filters])
root.name = get_root_name(params[:test_plan_id])
@nodes.unshift(root)
Expand All @@ -34,16 +34,16 @@ def list

def show
@node, @test_case = get_node(params[:node])
@setting = Impasse::Setting.find_by_project_id(@project) || Impasse::Setting.create(:project_id => @project.id)
@setting = Impasse::Setting.find_by(:project_id => @project) || Impasse::Setting.create(:project_id => @project.id)

render :partial => 'show'
end

def new
new_node
@setting = Impasse::Setting.find_by_project_id(@project) || Impasse::Setting.create(:project_id => @project.id)
@setting = Impasse::Setting.find_by(:project_id => @project) || Impasse::Setting.create(:project_id => @project.id)

if request.post? or request.put?
if request.post? or request.put? or request.patch?
begin
ActiveRecord::Base.transaction do
@node.save!
Expand Down Expand Up @@ -104,10 +104,10 @@ def move

def edit
@node, @test_case = get_node(params[:node])
@test_case.attributes = params[:test_case]
@setting = Impasse::Setting.find_by_project_id(@project) || Impasse::Setting.create(:project_id => @project.id)
@test_case.update_attributes(params[:test_case])
@setting = Impasse::Setting.find_by(:project_id => @project) || Impasse::Setting.create(:project_id => @project.id)

if request.post? or request.put?
if request.post? or request.put? or request.patch?
begin
ActiveRecord::Base.transaction do
save_node(@node)
Expand Down Expand Up @@ -152,7 +152,7 @@ def destroy
ActiveRecord::Base.transaction do
node.all_decendant_cases_with_plan.each do |child|
if child.planned?
Impasse::TestCase.update_all({:active => false}, ["id=?", child.id])
Impasse::TestCase.where(:id => child.id).update_all(:active => false)
inactive_cases << child
else
case child.node_type_id
Expand All @@ -174,7 +174,7 @@ def destroy
end

def keywords
keywords = Impasse::Keyword.find_all_by_project_id(@project).map{|r| r.keyword}
keywords = Impasse::Keyword.where(:project_id => @project).map{|r| r.keyword}
render :json => keywords
end

Expand Down Expand Up @@ -218,7 +218,7 @@ def copy_to_another_project
ActiveRecord::Base.transaction do
new_node = node.dup
if new_node.node_type_id == 1
root = Impasse::Node.find_by_name_and_node_type_id(dest_project.identifier, 1)
root = Impasse::Node.find_by(:name => dest_project.identifier, :node_type_id => 1)
if root
new_node = root
# TODO get max node order
Expand All @@ -238,7 +238,7 @@ def copy_to_another_project
new_test_suite.id = new_node.id
new_test_suite.save!
when 3
test_case = Impasse::TestCase.find(:first, :conditions => { :id => node.id }, :include => :test_steps)
test_case = Impasse::TestCase.where(:id => node.id).includes(:test_steps).first
new_test_case = test_case.dup
new_test_case.id = new_node.id
new_test_case.save!
Expand Down Expand Up @@ -278,7 +278,7 @@ def new_node

def get_node(node_params)
node = Impasse::Node.find(node_params[:id])
node.attributes = node_params
node.update_attributes(node_params)

if node.is_test_case?
test_case = Impasse::TestCase.find(node_params[:id])
Expand All @@ -299,7 +299,7 @@ def save_node(node)
end

def save_keywords(node, keywords = "")
project_keywords = Impasse::Keyword.find_all_by_project_id(@project)
project_keywords = Impasse::Keyword.where(:project_id => @project)
words = keywords.split(/\s*,\s*/)
words.delete_if {|word| word =~ /^\s*$/}.uniq!

Expand Down Expand Up @@ -338,7 +338,7 @@ def get_root_name(test_plan_id)
def find_project
begin
@project = Project.find(params[:project_id])
@project_node = Impasse::Node.find(:first, :conditions=>["name=? and node_type_id=?", @project.identifier, 1])
@project_node = Impasse::Node.where(:name => @project.identifier, :node_type_id => 1).first
if @project_node.nil?
@project_node = Impasse::Node.new(:name=>@project.identifier, :node_type_id=>1, :node_order=>1)
@project_node.save
Expand All @@ -352,7 +352,7 @@ def copy_node(original_node, parent_id, level=0)
node = original_node.dup

if node.is_test_case?
original_case = Impasse::TestCase.find(original_node.id, :include => :test_steps)
original_case = Impasse::TestCase.where(:id => original_node.id).includes(:test_steps).first
test_case = original_case.dup
original_case.test_steps.each{|ts| test_case.test_steps << ts.dup }
else
Expand Down
23 changes: 11 additions & 12 deletions app/controllers/impasse_test_plans_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ def index
end

def show
@test_plan = Impasse::TestPlan.find(:first, :conditions => { :id => params[:id]}, :include => :version)
@setting = Impasse::Setting.find_by_project_id(@project) || Impasse::Setting.create(:project_id => @project.id)
@test_plan = Impasse::TestPlan.where(:id => params[:id]).includes(:version).first
@setting = Impasse::Setting.find_by(:project_id => @project) || Impasse::Setting.create(:project_id => @project.id)
end

def new
@test_plan = Impasse::TestPlan.new(params[:test_plan])
if request.post? and @test_plan.save
if (request.post? or request.patch?) and @test_plan.save
flash[:notice] = l(:notice_successful_create)
redirect_to :action => :tc_assign, :project_id => @project, :id => @test_plan
end
Expand All @@ -30,8 +30,8 @@ def new

def edit
@test_plan = Impasse::TestPlan.find(params[:id])
@test_plan.attributes = params[:test_plan]
if (request.post? or request.put?) and @test_plan.save
@test_plan.update_attributes(params[:test_plan])
if (request.post? or request.put? or request.patch?) and @test_plan.save
flash[:notice] = l(:notice_successful_update)
redirect_to :action => :show, :project_id => @project, :id => @test_plan
end
Expand All @@ -40,16 +40,16 @@ def edit

def destroy
@test_plan = Impasse::TestPlan.find(params[:id])
if request.post? and @test_plan.destroy
if (request.post? or request.patch?) and @test_plan.destroy
flash[:notice] = l(:notice_successful_delete)
redirect_to :action => :index, :project_id => @project
end
end

def copy
@test_plan = Impasse::TestPlan.find(params[:id])
@test_plan.attributes = params[:test_plan]
if request.post? or request.put?
@test_plan.update_attributes(params[:test_plan])
if request.post? or request.put? or request.patch?
ActiveRecord::Base.transaction do
new_test_plan = @test_plan.dup
new_test_plan.save!
Expand Down Expand Up @@ -100,7 +100,7 @@ def statistics
def add_test_case
if params.include? :test_case_ids
new_cases = 0
nodes = Impasse::Node.find(:all, :conditions => ["id in (?)", params[:test_case_ids]])
nodes = Impasse::Node.where("id in (?)", params[:test_case_ids])
ActiveRecord::Base.transaction do
for node in nodes
test_case_ids = []
Expand All @@ -112,8 +112,7 @@ def add_test_case

for test_case_id in test_case_ids
test_plan_case =
Impasse::TestPlanCase.find_or_create_by_test_case_id_and_test_plan_id(
:test_case_id => test_case_id,
Impasse::TestPlanCase.find_or_create_by(:test_case_id => test_case_id,
:test_plan_id => params[:test_plan_id],
:node_order => 0)
new_cases += 1
Expand All @@ -131,7 +130,7 @@ def remove_test_case
end

def autocomplete
@users = @project.users.like(params[:q]).all(:limit => 100)
@users = @project.users.like(params[:q]).limit(100)
render :layout => false
end
end
Loading