Test cleanup.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10046 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2012-07-19 17:07:43 +00:00
parent 8553107016
commit c178aded61
1 changed files with 1 additions and 17 deletions

View File

@ -16,11 +16,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
require File.expand_path('../../test_helper', __FILE__)
require 'issue_relations_controller'
# Re-raise errors caught by the controller.
class IssueRelationsController; def rescue_action(e) raise e end; end
class IssueRelationsControllerTest < ActionController::TestCase
fixtures :projects,
@ -36,15 +31,12 @@ class IssueRelationsControllerTest < ActionController::TestCase
:trackers
def setup
@controller = IssueRelationsController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
User.current = nil
@request.session[:user_id] = 3
end
def test_create
assert_difference 'IssueRelation.count' do
@request.session[:user_id] = 3
post :create, :issue_id => 1,
:relation => {:issue_to_id => '2', :relation_type => 'relates', :delay => ''}
end
@ -56,7 +48,6 @@ class IssueRelationsControllerTest < ActionController::TestCase
def test_create_xhr
assert_difference 'IssueRelation.count' do
@request.session[:user_id] = 3
xhr :post, :create, :issue_id => 3, :relation => {:issue_to_id => '1', :relation_type => 'relates', :delay => ''}
assert_response :success
assert_template 'create'
@ -71,7 +62,6 @@ class IssueRelationsControllerTest < ActionController::TestCase
def test_create_should_accept_id_with_hash
assert_difference 'IssueRelation.count' do
@request.session[:user_id] = 3
post :create, :issue_id => 1,
:relation => {:issue_to_id => '#2', :relation_type => 'relates', :delay => ''}
end
@ -81,7 +71,6 @@ class IssueRelationsControllerTest < ActionController::TestCase
def test_create_should_strip_id
assert_difference 'IssueRelation.count' do
@request.session[:user_id] = 3
post :create, :issue_id => 1,
:relation => {:issue_to_id => ' 2 ', :relation_type => 'relates', :delay => ''}
end
@ -92,7 +81,6 @@ class IssueRelationsControllerTest < ActionController::TestCase
def test_create_should_not_break_with_non_numerical_id
assert_no_difference 'IssueRelation.count' do
assert_nothing_raised do
@request.session[:user_id] = 3
post :create, :issue_id => 1,
:relation => {:issue_to_id => 'foo', :relation_type => 'relates', :delay => ''}
end
@ -104,7 +92,6 @@ class IssueRelationsControllerTest < ActionController::TestCase
assert_nil Issue.visible(User.find(3)).find_by_id(4)
assert_no_difference 'IssueRelation.count' do
@request.session[:user_id] = 3
post :create, :issue_id => 1,
:relation => {:issue_to_id => '4', :relation_type => 'relates', :delay => ''}
end
@ -114,7 +101,6 @@ class IssueRelationsControllerTest < ActionController::TestCase
def test_create_xhr_with_failure
assert_no_difference 'IssueRelation.count' do
@request.session[:user_id] = 3
xhr :post, :create, :issue_id => 3, :relation => {:issue_to_id => '999', :relation_type => 'relates', :delay => ''}
assert_response :success
@ -127,7 +113,6 @@ class IssueRelationsControllerTest < ActionController::TestCase
def test_destroy
assert_difference 'IssueRelation.count', -1 do
@request.session[:user_id] = 3
delete :destroy, :id => '2'
end
end
@ -139,7 +124,6 @@ class IssueRelationsControllerTest < ActionController::TestCase
end
assert_difference 'IssueRelation.count', -1 do
@request.session[:user_id] = 3
xhr :delete, :destroy, :id => '2'
assert_response :success