mirror of
https://github.com/redmine/redmine.git
synced 2025-11-08 06:15:59 +01:00
Removes calls to #assert_template and #assigns in functional tests.
git-svn-id: http://svn.redmine.org/redmine/trunk@15724 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -29,12 +29,12 @@ class VersionsControllerTest < Redmine::ControllerTest
|
||||
def test_index
|
||||
get :index, :params => {:project_id => 1}
|
||||
assert_response :success
|
||||
assert_template 'index'
|
||||
assert_not_nil assigns(:versions)
|
||||
|
||||
# Version with no date set appears
|
||||
assert assigns(:versions).include?(Version.find(3))
|
||||
assert_select 'h3', :text => Version.find(3).name
|
||||
# Completed version doesn't appear
|
||||
assert !assigns(:versions).include?(Version.find(1))
|
||||
assert_select 'h3', :text => Version.find(1).name, :count => 0
|
||||
|
||||
# Context menu on issues
|
||||
assert_select "script", :text => Regexp.new(Regexp.escape("contextMenuInit('/issues/context_menu')"))
|
||||
assert_select "div#sidebar" do
|
||||
@@ -48,31 +48,33 @@ class VersionsControllerTest < Redmine::ControllerTest
|
||||
def test_index_with_completed_versions
|
||||
get :index, :params => {:project_id => 1, :completed => 1}
|
||||
assert_response :success
|
||||
assert_template 'index'
|
||||
assert_not_nil assigns(:versions)
|
||||
|
||||
# Version with no date set appears
|
||||
assert assigns(:versions).include?(Version.find(3))
|
||||
assert_select 'h3', :text => Version.find(3).name
|
||||
# Completed version appears
|
||||
assert assigns(:versions).include?(Version.find(1))
|
||||
assert_select 'h3', :text => Version.find(1).name
|
||||
end
|
||||
|
||||
def test_index_with_tracker_ids
|
||||
(1..3).each do |tracker_id|
|
||||
Issue.generate! :project_id => 1, :fixed_version_id => 3, :tracker_id => tracker_id
|
||||
end
|
||||
get :index, :params => {:project_id => 1, :tracker_ids => [1, 3]}
|
||||
assert_response :success
|
||||
assert_template 'index'
|
||||
assert_not_nil assigns(:issues_by_version)
|
||||
assert_nil assigns(:issues_by_version).values.flatten.detect {|issue| issue.tracker_id == 2}
|
||||
assert_select 'a.issue.tracker-1'
|
||||
assert_select 'a.issue.tracker-2', 0
|
||||
assert_select 'a.issue.tracker-3'
|
||||
end
|
||||
|
||||
def test_index_showing_subprojects_versions
|
||||
@subproject_version = Version.create!(:project => Project.find(3), :name => "Subproject version")
|
||||
get :index, :params => {:project_id => 1, :with_subprojects => 1}
|
||||
assert_response :success
|
||||
assert_template 'index'
|
||||
assert_not_nil assigns(:versions)
|
||||
|
||||
assert assigns(:versions).include?(Version.find(4)), "Shared version not found"
|
||||
assert assigns(:versions).include?(@subproject_version), "Subproject version not found"
|
||||
# Shared version
|
||||
assert_select 'h3', :text => Version.find(4).name
|
||||
# Subproject version
|
||||
assert_select 'h3', :text => /Subproject version/
|
||||
end
|
||||
|
||||
def test_index_should_prepend_shared_versions
|
||||
@@ -92,8 +94,6 @@ class VersionsControllerTest < Redmine::ControllerTest
|
||||
def test_show
|
||||
get :show, :params => {:id => 2}
|
||||
assert_response :success
|
||||
assert_template 'show'
|
||||
assert_not_nil assigns(:version)
|
||||
|
||||
assert_select 'h2', :text => /1.0/
|
||||
end
|
||||
@@ -127,14 +127,13 @@ class VersionsControllerTest < Redmine::ControllerTest
|
||||
@request.session[:user_id] = 2
|
||||
get :new, :params => {:project_id => '1'}
|
||||
assert_response :success
|
||||
assert_template 'new'
|
||||
assert_select 'input[name=?]', 'version[name]'
|
||||
end
|
||||
|
||||
def test_new_from_issue_form
|
||||
@request.session[:user_id] = 2
|
||||
xhr :get, :new, :params => {:project_id => '1'}
|
||||
assert_response :success
|
||||
assert_template 'new'
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
end
|
||||
|
||||
@@ -159,7 +158,6 @@ class VersionsControllerTest < Redmine::ControllerTest
|
||||
assert_equal 1, version.project_id
|
||||
|
||||
assert_response :success
|
||||
assert_template 'create'
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_include 'test_add_version_from_issue_form', response.body
|
||||
end
|
||||
@@ -170,7 +168,6 @@ class VersionsControllerTest < Redmine::ControllerTest
|
||||
xhr :post, :create, :params => {:project_id => '1', :version => {:name => ''}}
|
||||
end
|
||||
assert_response :success
|
||||
assert_template 'new'
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
end
|
||||
|
||||
@@ -178,7 +175,7 @@ class VersionsControllerTest < Redmine::ControllerTest
|
||||
@request.session[:user_id] = 2
|
||||
get :edit, :params => {:id => 2}
|
||||
assert_response :success
|
||||
assert_template 'edit'
|
||||
assert_select 'input[name=?][value=?]', 'version[name]', Version.find(2).name
|
||||
end
|
||||
|
||||
def test_close_completed
|
||||
@@ -216,7 +213,7 @@ class VersionsControllerTest < Redmine::ControllerTest
|
||||
}
|
||||
}
|
||||
assert_response :success
|
||||
assert_template 'edit'
|
||||
assert_select_error /Name cannot be blank/
|
||||
end
|
||||
|
||||
def test_destroy
|
||||
@@ -243,15 +240,11 @@ class VersionsControllerTest < Redmine::ControllerTest
|
||||
def test_issue_status_by
|
||||
xhr :get, :status_by, :params => {:id => 2}
|
||||
assert_response :success
|
||||
assert_template 'status_by'
|
||||
assert_template '_issue_counts'
|
||||
end
|
||||
|
||||
def test_issue_status_by_status
|
||||
xhr :get, :status_by, :params => {:id => 2, :status_by => 'status'}
|
||||
assert_response :success
|
||||
assert_template 'status_by'
|
||||
assert_template '_issue_counts'
|
||||
assert_include 'Assigned', response.body
|
||||
assert_include 'Closed', response.body
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user