summaryrefslogtreecommitdiffstats
path: root/test/functional/trackers_controller_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-02-26 09:21:41 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-02-26 09:21:41 +0000
commit589320337db0a242f8adb2150996f6d038aaf9ad (patch)
treefcbea3b4fc98b50d44932e7fee3bc1ad0d3059a8 /test/functional/trackers_controller_test.rb
parent46f52d306dc475022c8544772d2bdd21501e115d (diff)
downloadredmine-589320337db0a242f8adb2150996f6d038aaf9ad.tar.gz
redmine-589320337db0a242f8adb2150996f6d038aaf9ad.zip
Trackers controller refactoring.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2526 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/trackers_controller_test.rb')
-rw-r--r--test/functional/trackers_controller_test.rb53
1 files changed, 52 insertions, 1 deletions
diff --git a/test/functional/trackers_controller_test.rb b/test/functional/trackers_controller_test.rb
index 89bbf228f..e2109ba6f 100644
--- a/test/functional/trackers_controller_test.rb
+++ b/test/functional/trackers_controller_test.rb
@@ -22,7 +22,7 @@ require 'trackers_controller'
class TrackersController; def rescue_action(e) raise e end; end
class TrackersControllerTest < Test::Unit::TestCase
- fixtures :trackers, :projects, :projects_trackers, :users
+ fixtures :trackers, :projects, :projects_trackers, :users, :issues
def setup
@controller = TrackersController.new
@@ -32,6 +32,34 @@ class TrackersControllerTest < Test::Unit::TestCase
@request.session[:user_id] = 1 # admin
end
+ def test_index
+ get :index
+ assert_response :success
+ assert_template 'list'
+ end
+
+ def test_get_new
+ get :new
+ assert_response :success
+ assert_template 'new'
+ end
+
+ def test_post_new
+ post :new, :tracker => { :name => 'New tracker', :project_ids => ['1', '', ''] }
+ assert_redirected_to '/trackers/list'
+ tracker = Tracker.find_by_name('New tracker')
+ assert_equal [1], tracker.project_ids.sort
+ assert_equal 0, tracker.workflows.count
+ end
+
+ def test_post_new_with_workflow_copy
+ post :new, :tracker => { :name => 'New tracker' }, :copy_workflow_from => 1
+ assert_redirected_to '/trackers/list'
+ tracker = Tracker.find_by_name('New tracker')
+ assert_equal 0, tracker.projects.count
+ assert_equal Tracker.find(1).workflows.count, tracker.workflows.count
+ end
+
def test_get_edit
Tracker.find(1).project_ids = [1, 3]
@@ -65,4 +93,27 @@ class TrackersControllerTest < Test::Unit::TestCase
assert_redirected_to '/trackers/list'
assert Tracker.find(1).project_ids.empty?
end
+
+ def test_move_lower
+ tracker = Tracker.find_by_position(1)
+ post :edit, :id => 1, :tracker => { :move_to => 'lower' }
+ assert_equal 2, tracker.reload.position
+ end
+
+ def test_destroy
+ tracker = Tracker.create!(:name => 'Destroyable')
+ assert_difference 'Tracker.count', -1 do
+ post :destroy, :id => tracker.id
+ end
+ assert_redirected_to '/trackers/list'
+ assert_nil flash[:error]
+ end
+
+ def test_destroy_tracker_in_use
+ assert_no_difference 'Tracker.count' do
+ post :destroy, :id => 1
+ end
+ assert_redirected_to '/trackers/list'
+ assert_not_nil flash[:error]
+ end
end