##// END OF EJS Templates
Fix generation of blank local link when no title is specified in wiki link....
Fix generation of blank local link when no title is specified in wiki link. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7560 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r7412:f21fd28917d2
r7440:ac2dbde135f7
Show More
issue_moves_controller_test.rb
174 lines | 6.9 KiB | text/x-ruby | RubyLexer
/ test / functional / issue_moves_controller_test.rb
Jean-Baptiste Barth
Use absolute paths in test/**/* requires for Ruby 1.9.2 compatibility. #4050...
r4395 require File.expand_path('../../test_helper', __FILE__)
Eric Davis
Refactor: Extract a new IssueMovesController from IssuesController....
r3822
class IssueMovesControllerTest < ActionController::TestCase
Toshi MARUYAMA
Rails3: replace "all" fixtures at test/functional/issue_moves_controller_test.rb...
r7401 fixtures :projects, :trackers, :issue_statuses, :issues,
:enumerations, :users, :issue_categories,
:projects_trackers,
:roles,
:member_roles,
:members,
:enabled_modules,
:workflows,
Toshi MARUYAMA
remove duplicate fixtures from test/functional/issue_moves_controller_test.rb...
r7409 :journals, :journal_details
Eric Davis
Refactor: Extract a new IssueMovesController from IssuesController....
r3822
def setup
User.current = nil
end
Jean-Baptiste Barth
Do not show inactive issue priorities where not necessary (#8573)....
r5950 def test_get_issue_moves_new
@request.session[:user_id] = 2
get :new, :id => 1
assert_tag :tag => 'option', :content => 'eCookbook',
:attributes => { :value => '1', :selected => 'selected' }
%w(new_tracker_id status_id priority_id assigned_to_id).each do |field|
assert_tag :tag => 'option', :content => '(No change)', :attributes => { :value => '' },
:parent => {:tag => 'select', :attributes => {:id => field}}
assert_no_tag :tag => 'option', :attributes => {:selected => 'selected'},
:parent => {:tag => 'select', :attributes => {:id => field}}
end
# Be sure we don't include inactive enumerations
assert ! IssuePriority.find(15).active?
assert_no_tag :option, :attributes => {:value => '15'},
:parent => {:tag => 'select', :attributes => {:id => 'priority_id'} }
end
Eric Davis
Refactor: Extract a new IssueMovesController from IssuesController....
r3822 def test_create_one_issue_to_another_project
@request.session[:user_id] = 2
post :create, :id => 1, :new_project_id => 2, :tracker_id => '', :assigned_to_id => '', :status_id => '', :start_date => '', :due_date => ''
assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook'
assert_equal 2, Issue.find(1).project_id
end
def test_create_one_issue_to_another_project_should_follow_when_needed
@request.session[:user_id] = 2
post :create, :id => 1, :new_project_id => 2, :follow => '1'
assert_redirected_to '/issues/1'
end
def test_bulk_create_to_another_project
@request.session[:user_id] = 2
post :create, :ids => [1, 2], :new_project_id => 2
assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook'
# Issues moved to project 2
assert_equal 2, Issue.find(1).project_id
assert_equal 2, Issue.find(2).project_id
# No tracker change
assert_equal 1, Issue.find(1).tracker_id
assert_equal 2, Issue.find(2).tracker_id
end
Toshi MARUYAMA
remove trailing white-spaces from test/functional/issue_moves_controller_test.rb....
r6788
Eric Davis
Refactor: Extract a new IssueMovesController from IssuesController....
r3822 def test_bulk_create_to_another_tracker
@request.session[:user_id] = 2
post :create, :ids => [1, 2], :new_tracker_id => 2
assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook'
assert_equal 2, Issue.find(1).tracker_id
assert_equal 2, Issue.find(2).tracker_id
end
Eric Davis
Allow changing the Priority when moving issues....
r4177 context "#create via bulk move" do
Eric Davis
Allow adding notes when moving issues...
r4178 setup do
Eric Davis
Allow changing the Priority when moving issues....
r4177 @request.session[:user_id] = 2
Eric Davis
Allow adding notes when moving issues...
r4178 end
Toshi MARUYAMA
remove trailing white-spaces from test/functional/issue_moves_controller_test.rb....
r6788
Eric Davis
Allow adding notes when moving issues...
r4178 should "allow changing the issue priority" do
Eric Davis
Allow changing the Priority when moving issues....
r4177 post :create, :ids => [1, 2], :priority_id => 6
assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook'
assert_equal 6, Issue.find(1).priority_id
assert_equal 6, Issue.find(2).priority_id
end
Eric Davis
Allow adding notes when moving issues...
r4178
should "allow adding a note when moving" do
post :create, :ids => [1, 2], :notes => 'Moving two issues'
assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook'
Jean-Philippe Lang
Fixes unsafe assertion that may cause failures....
r4371 assert_equal 'Moving two issues', Issue.find(1).journals.sort_by(&:id).last.notes
assert_equal 'Moving two issues', Issue.find(2).journals.sort_by(&:id).last.notes
Eric Davis
Allow adding notes when moving issues...
r4178
end
Toshi MARUYAMA
remove trailing white-spaces from test/functional/issue_moves_controller_test.rb....
r6788
Eric Davis
Allow changing the Priority when moving issues....
r4177 end
Eric Davis
Refactor: Extract a new IssueMovesController from IssuesController....
r3822 def test_bulk_copy_to_another_project
@request.session[:user_id] = 2
assert_difference 'Issue.count', 2 do
assert_no_difference 'Project.find(1).issues.count' do
post :create, :ids => [1, 2], :new_project_id => 2, :copy_options => {:copy => '1'}
end
end
Jean-Philippe Lang
Adds leading slash to all assert_redirected_to arguments (#6887)....
r4293 assert_redirected_to '/projects/ecookbook/issues'
Eric Davis
Refactor: Extract a new IssueMovesController from IssuesController....
r3822 end
context "#create via bulk copy" do
should "allow not changing the issue's attributes" do
@request.session[:user_id] = 2
issue_before_move = Issue.find(1)
assert_difference 'Issue.count', 1 do
assert_no_difference 'Project.find(1).issues.count' do
Toshi MARUYAMA
code layout clean up of 'should "allow not changing the issue's attributes"' at test/functional/issue_moves_controller_test.rb...
r7410 post :create, :ids => [1], :new_project_id => 2,
:copy_options => {:copy => '1'}, :new_tracker_id => '',
:assigned_to_id => '', :status_id => '',
:start_date => '', :due_date => ''
Eric Davis
Refactor: Extract a new IssueMovesController from IssuesController....
r3822 end
end
issue_after_move = Issue.first(:order => 'id desc', :conditions => {:project_id => 2})
assert_equal issue_before_move.tracker_id, issue_after_move.tracker_id
assert_equal issue_before_move.status_id, issue_after_move.status_id
assert_equal issue_before_move.assigned_to_id, issue_after_move.assigned_to_id
end
Toshi MARUYAMA
remove trailing white-spaces from test/functional/issue_moves_controller_test.rb....
r6788
Eric Davis
Refactor: Extract a new IssueMovesController from IssuesController....
r3822 should "allow changing the issue's attributes" do
# Fixes random test failure with Mysql
Toshi MARUYAMA
code layout clean up of 'should "allow changing the issue's attributes"' at test/functional/issue_moves_controller_test.rb...
r7411 # where Issue.all(:limit => 2, :order => 'id desc', :conditions => {:project_id => 2})
# doesn't return the expected results
Eric Davis
Refactor: Extract a new IssueMovesController from IssuesController....
r3822 Issue.delete_all("project_id=2")
Toshi MARUYAMA
remove trailing white-spaces from test/functional/issue_moves_controller_test.rb....
r6788
Eric Davis
Refactor: Extract a new IssueMovesController from IssuesController....
r3822 @request.session[:user_id] = 2
assert_difference 'Issue.count', 2 do
assert_no_difference 'Project.find(1).issues.count' do
Toshi MARUYAMA
code layout clean up of 'should "allow changing the issue's attributes"' at test/functional/issue_moves_controller_test.rb...
r7411 post :create, :ids => [1, 2], :new_project_id => 2,
:copy_options => {:copy => '1'}, :new_tracker_id => '',
:assigned_to_id => 4, :status_id => 3,
:start_date => '2009-12-01', :due_date => '2009-12-31'
Eric Davis
Refactor: Extract a new IssueMovesController from IssuesController....
r3822 end
end
copied_issues = Issue.all(:limit => 2, :order => 'id desc', :conditions => {:project_id => 2})
assert_equal 2, copied_issues.size
copied_issues.each do |issue|
assert_equal 2, issue.project_id, "Project is incorrect"
assert_equal 4, issue.assigned_to_id, "Assigned to is incorrect"
assert_equal 3, issue.status_id, "Status is incorrect"
assert_equal '2009-12-01', issue.start_date.to_s, "Start date is incorrect"
assert_equal '2009-12-31', issue.due_date.to_s, "Due date is incorrect"
end
end
Jean-Philippe Lang
Fixed: notes are lost when copying issue(s) (#6901, #8239)....
r5482
should "allow adding a note when copying" do
@request.session[:user_id] = 2
assert_difference 'Issue.count', 1 do
Toshi MARUYAMA
code layout clean up of 'should "allow adding a note when copying"' at test/functional/issue_moves_controller_test.rb...
r7412 post :create, :ids => [1], :copy_options => {:copy => '1'},
:notes => 'Copying one issue', :new_tracker_id => '',
:assigned_to_id => 4, :status_id => 3,
:start_date => '2009-12-01', :due_date => '2009-12-31'
Jean-Philippe Lang
Fixed: notes are lost when copying issue(s) (#6901, #8239)....
r5482 end
Toshi MARUYAMA
remove trailing white-spaces from test/functional/issue_moves_controller_test.rb....
r6788
Jean-Philippe Lang
Fixed: notes are lost when copying issue(s) (#6901, #8239)....
r5482 issue = Issue.first(:order => 'id DESC')
assert_equal 1, issue.journals.size
journal = issue.journals.first
assert_equal 0, journal.details.size
assert_equal 'Copying one issue', journal.notes
end
Eric Davis
Refactor: Extract a new IssueMovesController from IssuesController....
r3822 end
Toshi MARUYAMA
remove trailing white-spaces from test/functional/issue_moves_controller_test.rb....
r6788
Eric Davis
Refactor: Extract a new IssueMovesController from IssuesController....
r3822 def test_copy_to_another_project_should_follow_when_needed
@request.session[:user_id] = 2
post :create, :ids => [1], :new_project_id => 2, :copy_options => {:copy => '1'}, :follow => '1'
issue = Issue.first(:order => 'id DESC')
assert_redirected_to :controller => 'issues', :action => 'show', :id => issue
end
end