mirror of
				https://github.com/redmine/redmine.git
				synced 2025-11-03 20:06:24 +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:
		
							
								
								
									
										11
									
								
								test/fixtures/wiki_content_versions.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										11
									
								
								test/fixtures/wiki_content_versions.yml
									
									
									
									
										vendored
									
									
								
							@@ -9,10 +9,10 @@ wiki_content_versions_001:
 | 
				
			|||||||
  wiki_content_id: 1
 | 
					  wiki_content_id: 1
 | 
				
			||||||
  compression: ""
 | 
					  compression: ""
 | 
				
			||||||
  data: |-
 | 
					  data: |-
 | 
				
			||||||
    h1. CookBook documentation
 | 
					    h1. CookBook documentation v1
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
					    Line from v1
 | 
				
			||||||
    Some [[documentation]] here...
 | 
					    Some [[documentation]] here...
 | 
				
			||||||
wiki_content_versions_002: 
 | 
					wiki_content_versions_002: 
 | 
				
			||||||
  updated_on: 2007-03-07 00:08:34 +01:00
 | 
					  updated_on: 2007-03-07 00:08:34 +01:00
 | 
				
			||||||
@@ -24,10 +24,10 @@ wiki_content_versions_002:
 | 
				
			|||||||
  wiki_content_id: 1
 | 
					  wiki_content_id: 1
 | 
				
			||||||
  compression: ""
 | 
					  compression: ""
 | 
				
			||||||
  data: |-
 | 
					  data: |-
 | 
				
			||||||
    h1. CookBook documentation
 | 
					    h1. CookBook documentation v2
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
					    Line from v1
 | 
				
			||||||
    Some updated [[documentation]] here...
 | 
					    Some updated [[documentation]] here...
 | 
				
			||||||
wiki_content_versions_003: 
 | 
					wiki_content_versions_003: 
 | 
				
			||||||
  updated_on: 2007-03-07 00:10:51 +01:00
 | 
					  updated_on: 2007-03-07 00:10:51 +01:00
 | 
				
			||||||
@@ -39,7 +39,8 @@ wiki_content_versions_003:
 | 
				
			|||||||
  wiki_content_id: 1
 | 
					  wiki_content_id: 1
 | 
				
			||||||
  compression: ""
 | 
					  compression: ""
 | 
				
			||||||
  data: |-
 | 
					  data: |-
 | 
				
			||||||
    h1. CookBook documentation
 | 
					    h1. CookBook documentation v3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Some updated [[documentation]] here...
 | 
					    Some updated [[documentation]] here...
 | 
				
			||||||
wiki_content_versions_004: 
 | 
					wiki_content_versions_004: 
 | 
				
			||||||
  data: |-
 | 
					  data: |-
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -161,14 +161,14 @@ class BoardsControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
      post :create, :project_id => 1, :board => { :name => '', :description => 'Testing board creation'}
 | 
					      post :create, :project_id => 1, :board => { :name => '', :description => 'Testing board creation'}
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'new'
 | 
					    assert_select_error /Name cannot be blank/
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_edit
 | 
					  def test_edit
 | 
				
			||||||
    @request.session[:user_id] = 2
 | 
					    @request.session[:user_id] = 2
 | 
				
			||||||
    get :edit, :project_id => 1, :id => 2
 | 
					    get :edit, :project_id => 1, :id => 2
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'edit'
 | 
					    assert_select 'input[name=?][value=?]', 'board[name]', 'Discussion'
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_edit_with_parent
 | 
					  def test_edit_with_parent
 | 
				
			||||||
@@ -176,7 +176,6 @@ class BoardsControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    @request.session[:user_id] = 2
 | 
					    @request.session[:user_id] = 2
 | 
				
			||||||
    get :edit, :project_id => 1, :id => board.id
 | 
					    get :edit, :project_id => 1, :id => board.id
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'edit'
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert_select 'select[name=?]', 'board[parent_id]' do
 | 
					    assert_select 'select[name=?]', 'board[parent_id]' do
 | 
				
			||||||
      assert_select 'option[value="2"][selected=selected]'
 | 
					      assert_select 'option[value="2"][selected=selected]'
 | 
				
			||||||
@@ -204,7 +203,7 @@ class BoardsControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    @request.session[:user_id] = 2
 | 
					    @request.session[:user_id] = 2
 | 
				
			||||||
    put :update, :project_id => 1, :id => 2, :board => { :name => '', :description => 'Testing board update'}
 | 
					    put :update, :project_id => 1, :id => 2, :board => { :name => '', :description => 'Testing board update'}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'edit'
 | 
					    assert_select_error /Name cannot be blank/
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_destroy
 | 
					  def test_destroy
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -28,18 +28,17 @@ class RolesControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
  def test_index
 | 
					  def test_index
 | 
				
			||||||
    get :index
 | 
					    get :index
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'index'
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    assert_not_nil assigns(:roles)
 | 
					 | 
				
			||||||
    assert_equal Role.order('builtin, position').to_a, assigns(:roles)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    assert_select 'table.roles tbody' do
 | 
				
			||||||
 | 
					      assert_select 'tr', Role.count
 | 
				
			||||||
      assert_select 'a[href="/roles/1/edit"]', :text => 'Manager'
 | 
					      assert_select 'a[href="/roles/1/edit"]', :text => 'Manager'
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_new
 | 
					  def test_new
 | 
				
			||||||
    get :new
 | 
					    get :new
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'new'
 | 
					    assert_select 'input[name=?]', 'role[name]'
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_new_with_copy
 | 
					  def test_new_with_copy
 | 
				
			||||||
@@ -47,10 +46,7 @@ class RolesControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    get :new, :params => {:copy => copy_from.id.to_s}
 | 
					    get :new, :params => {:copy => copy_from.id.to_s}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'new'
 | 
					    assert_select 'input[name=?]', 'role[name]'
 | 
				
			||||||
 | 
					 | 
				
			||||||
    role = assigns(:role)
 | 
					 | 
				
			||||||
    assert_equal copy_from.permissions, role.permissions
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert_select 'form' do
 | 
					    assert_select 'form' do
 | 
				
			||||||
      # blank name
 | 
					      # blank name
 | 
				
			||||||
@@ -76,8 +72,7 @@ class RolesControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'new'
 | 
					    assert_select_error /Name cannot be blank/
 | 
				
			||||||
    assert_select 'div#errorExplanation'
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_create_without_workflow_copy
 | 
					  def test_create_without_workflow_copy
 | 
				
			||||||
@@ -113,15 +108,16 @@ class RolesControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
  def test_edit
 | 
					  def test_edit
 | 
				
			||||||
    get :edit, :params => {:id => 1}
 | 
					    get :edit, :params => {:id => 1}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'edit'
 | 
					
 | 
				
			||||||
    assert_equal Role.find(1), assigns(:role)
 | 
					    assert_select 'input[name=?][value=?]', 'role[name]', 'Manager'
 | 
				
			||||||
    assert_select 'select[name=?]', 'role[issues_visibility]'
 | 
					    assert_select 'select[name=?]', 'role[issues_visibility]'
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_edit_anonymous
 | 
					  def test_edit_anonymous
 | 
				
			||||||
    get :edit, :params => {:id => Role.anonymous.id}
 | 
					    get :edit, :params => {:id => Role.anonymous.id}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'edit'
 | 
					
 | 
				
			||||||
 | 
					    assert_select 'input[name=?]', 'role[name]', 0
 | 
				
			||||||
    assert_select 'select[name=?]', 'role[issues_visibility]', 0
 | 
					    assert_select 'select[name=?]', 'role[issues_visibility]', 0
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -165,7 +161,7 @@ class RolesControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
  def test_update_with_failure
 | 
					  def test_update_with_failure
 | 
				
			||||||
    put :update, :params => {:id => 1, :role => {:name => ''}}
 | 
					    put :update, :params => {:id => 1, :role => {:name => ''}}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'edit'
 | 
					    assert_select_error /Name cannot be blank/
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_destroy
 | 
					  def test_destroy
 | 
				
			||||||
@@ -186,10 +182,6 @@ class RolesControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
  def test_get_permissions
 | 
					  def test_get_permissions
 | 
				
			||||||
    get :permissions
 | 
					    get :permissions
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'permissions'
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    assert_not_nil assigns(:roles)
 | 
					 | 
				
			||||||
    assert_equal Role.order('builtin, position').to_a, assigns(:roles)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert_select 'input[name=?][type=checkbox][value=add_issues][checked=checked]', 'permissions[3][]'
 | 
					    assert_select 'input[name=?][type=checkbox][value=add_issues][checked=checked]', 'permissions[3][]'
 | 
				
			||||||
    assert_select 'input[name=?][type=checkbox][value=delete_issues]:not([checked])', 'permissions[3][]'
 | 
					    assert_select 'input[name=?][type=checkbox][value=delete_issues]:not([checked])', 'permissions[3][]'
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -30,15 +30,16 @@ class SearchControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    User.current = nil
 | 
					    User.current = nil
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_search_for_projects
 | 
					  def test_search_without_q_should_display_search_form
 | 
				
			||||||
    get :index
 | 
					    get :index
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'index'
 | 
					    assert_select '#content input[name=q]'
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def test_search_for_projects
 | 
				
			||||||
    get :index, :params => {:q => "cook"}
 | 
					    get :index, :params => {:q => "cook"}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'index'
 | 
					    assert_select '#search-results dt.project a', :text => /eCookbook/
 | 
				
			||||||
    assert assigns(:results).include?(Project.find(1))
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_search_on_archived_project_should_return_404
 | 
					  def test_search_on_archived_project_should_return_404
 | 
				
			||||||
@@ -69,29 +70,32 @@ class SearchControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
      get :index, :params => {:q => 'recipe subproject commit', :all_words => ''}
 | 
					      get :index, :params => {:q => 'recipe subproject commit', :all_words => ''}
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'index'
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert assigns(:results).include?(Issue.find(2))
 | 
					    assert_select '#search-results' do
 | 
				
			||||||
    assert assigns(:results).include?(Issue.find(5))
 | 
					      assert_select 'dt.issue a', :text => /Feature request #2/
 | 
				
			||||||
    assert assigns(:results).include?(Changeset.find(101))
 | 
					      assert_select 'dt.issue a', :text => /Bug #5/
 | 
				
			||||||
 | 
					      assert_select 'dt.changeset a', :text => /Revision 1/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      assert_select 'dt.issue a', :text => /Add ingredients categories/
 | 
					      assert_select 'dt.issue a', :text => /Add ingredients categories/
 | 
				
			||||||
      assert_select 'dd', :text => /should be classified by categories/
 | 
					      assert_select 'dd', :text => /should be classified by categories/
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert assigns(:result_count_by_type).is_a?(Hash)
 | 
					    assert_select '#search-results-counts' do
 | 
				
			||||||
    assert_equal 5, assigns(:result_count_by_type)['changesets']
 | 
					 | 
				
			||||||
      assert_select 'a', :text => 'Changesets (5)'
 | 
					      assert_select 'a', :text => 'Changesets (5)'
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_search_issues
 | 
					  def test_search_issues
 | 
				
			||||||
    get :index, :params => {:q => 'issue', :issues => 1}
 | 
					    get :index, :params => {:q => 'issue', :issues => 1}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'index'
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert_equal true, assigns(:all_words)
 | 
					    assert_select 'input[name=all_words][checked=checked]'
 | 
				
			||||||
    assert_equal false, assigns(:titles_only)
 | 
					    assert_select 'input[name=titles_only]:not([checked])'
 | 
				
			||||||
    assert assigns(:results).include?(Issue.find(8))
 | 
					
 | 
				
			||||||
    assert assigns(:results).include?(Issue.find(5))
 | 
					    assert_select '#search-results' do
 | 
				
			||||||
    assert_select 'dt.issue.closed a',  :text => /Closed/
 | 
					      assert_select 'dt.issue a', :text => /Bug #5/
 | 
				
			||||||
 | 
					      assert_select 'dt.issue.closed a', :text => /Bug #8 \(Closed\)/
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_search_issues_should_search_notes
 | 
					  def test_search_issues_should_search_notes
 | 
				
			||||||
@@ -99,7 +103,10 @@ class SearchControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    get :index, :params => {:q => 'searchkeyword', :issues => 1}
 | 
					    get :index, :params => {:q => 'searchkeyword', :issues => 1}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_include Issue.find(2), assigns(:results)
 | 
					
 | 
				
			||||||
 | 
					    assert_select '#search-results' do
 | 
				
			||||||
 | 
					      assert_select 'dt.issue a', :text => /Feature request #2/
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_search_issues_with_multiple_matches_in_journals_should_return_issue_once
 | 
					  def test_search_issues_with_multiple_matches_in_journals_should_return_issue_once
 | 
				
			||||||
@@ -108,8 +115,11 @@ class SearchControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    get :index, :params => {:q => 'searchkeyword', :issues => 1}
 | 
					    get :index, :params => {:q => 'searchkeyword', :issues => 1}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_include Issue.find(2), assigns(:results)
 | 
					
 | 
				
			||||||
    assert_equal 1, assigns(:results).size
 | 
					    assert_select '#search-results' do
 | 
				
			||||||
 | 
					      assert_select 'dt.issue a', :text => /Feature request #2/
 | 
				
			||||||
 | 
					      assert_select 'dt', 1
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_search_issues_should_search_private_notes_with_permission_only
 | 
					  def test_search_issues_should_search_private_notes_with_permission_only
 | 
				
			||||||
@@ -119,66 +129,74 @@ class SearchControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    Role.find(1).add_permission! :view_private_notes
 | 
					    Role.find(1).add_permission! :view_private_notes
 | 
				
			||||||
    get :index, :params => {:q => 'searchkeyword', :issues => 1}
 | 
					    get :index, :params => {:q => 'searchkeyword', :issues => 1}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_include Issue.find(2), assigns(:results)
 | 
					    assert_select '#search-results' do
 | 
				
			||||||
 | 
					      assert_select 'dt.issue a', :text => /Feature request #2/
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Role.find(1).remove_permission! :view_private_notes
 | 
					    Role.find(1).remove_permission! :view_private_notes
 | 
				
			||||||
    get :index, :params => {:q => 'searchkeyword', :issues => 1}
 | 
					    get :index, :params => {:q => 'searchkeyword', :issues => 1}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_not_include Issue.find(2), assigns(:results)
 | 
					    assert_select '#search-results' do
 | 
				
			||||||
 | 
					      assert_select 'dt', :text => /Feature request #2/, :count => 0
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_search_all_projects_with_scope_param
 | 
					  def test_search_all_projects_with_scope_param
 | 
				
			||||||
    get :index, :params => {:q => 'issue', :scope => 'all'}
 | 
					    get :index, :params => {:q => 'issue', :scope => 'all'}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'index'
 | 
					
 | 
				
			||||||
    assert assigns(:results).present?
 | 
					    assert_select '#search-results dt'
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_search_my_projects
 | 
					  def test_search_my_projects
 | 
				
			||||||
    @request.session[:user_id] = 2
 | 
					    @request.session[:user_id] = 2
 | 
				
			||||||
    get :index, :params => {:id => 1, :q => 'recipe subproject', :scope => 'my_projects', :all_words => ''}
 | 
					    get :index, :params => {:id => 1, :q => 'recipe subproject', :scope => 'my_projects', :all_words => ''}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'index'
 | 
					
 | 
				
			||||||
    assert assigns(:results).include?(Issue.find(1))
 | 
					    assert_select '#search-results' do
 | 
				
			||||||
    assert !assigns(:results).include?(Issue.find(5))
 | 
					      assert_select 'dt.issue', :text => /Bug #1/
 | 
				
			||||||
 | 
					      assert_select 'dt', :text => /Bug #5/, :count => 0
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_search_my_projects_without_memberships
 | 
					  def test_search_my_projects_without_memberships
 | 
				
			||||||
    # anonymous user has no memberships
 | 
					    # anonymous user has no memberships
 | 
				
			||||||
    get :index, :params => {:id => 1, :q => 'recipe subproject', :scope => 'my_projects', :all_words => ''}
 | 
					    get :index, :params => {:id => 1, :q => 'recipe subproject', :scope => 'my_projects', :all_words => ''}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'index'
 | 
					
 | 
				
			||||||
    assert assigns(:results).empty?
 | 
					    assert_select '#search-results' do
 | 
				
			||||||
 | 
					      assert_select 'dt', 0
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_search_project_and_subprojects
 | 
					  def test_search_project_and_subprojects
 | 
				
			||||||
    get :index, :params => {:id => 1, :q => 'recipe subproject', :scope => 'subprojects', :all_words => ''}
 | 
					    get :index, :params => {:id => 1, :q => 'recipe subproject', :scope => 'subprojects', :all_words => ''}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'index'
 | 
					
 | 
				
			||||||
    assert assigns(:results).include?(Issue.find(1))
 | 
					    assert_select '#search-results' do
 | 
				
			||||||
    assert assigns(:results).include?(Issue.find(5))
 | 
					      assert_select 'dt.issue', :text => /Bug #1/
 | 
				
			||||||
 | 
					      assert_select 'dt.issue', :text => /Bug #5/
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_search_without_searchable_custom_fields
 | 
					  def test_search_without_searchable_custom_fields
 | 
				
			||||||
    CustomField.update_all "searchable = #{ActiveRecord::Base.connection.quoted_false}"
 | 
					    CustomField.update_all :searchable => false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    get :index, :params => {:id => 1}
 | 
					    get :index, :params => {:id => 1}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'index'
 | 
					 | 
				
			||||||
    assert_not_nil assigns(:project)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    get :index, :params => {:id => 1, :q => "can"}
 | 
					    get :index, :params => {:id => 1, :q => "can"}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'index'
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_search_with_searchable_custom_fields
 | 
					  def test_search_with_searchable_custom_fields
 | 
				
			||||||
    get :index, :params => {:id => 1, :q => "stringforcustomfield"}
 | 
					    get :index, :params => {:id => 1, :q => "stringforcustomfield"}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    results = assigns(:results)
 | 
					
 | 
				
			||||||
    assert_not_nil results
 | 
					    assert_select '#search-results' do
 | 
				
			||||||
    assert_equal 1, results.size
 | 
					      assert_select 'dt.issue', :text => /#7/
 | 
				
			||||||
    assert results.include?(Issue.find(7))
 | 
					      assert_select 'dt', 1
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_search_without_attachments
 | 
					  def test_search_without_attachments
 | 
				
			||||||
@@ -186,9 +204,12 @@ class SearchControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    attachment = Attachment.generate! :container => Issue.find(1), :filename => 'search_attachments.patch'
 | 
					    attachment = Attachment.generate! :container => Issue.find(1), :filename => 'search_attachments.patch'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    get :index, :params => {:id => 1, :q => 'search_attachments', :attachments => '0'}
 | 
					    get :index, :params => {:id => 1, :q => 'search_attachments', :attachments => '0'}
 | 
				
			||||||
    results = assigns(:results)
 | 
					    assert_response :success
 | 
				
			||||||
    assert_equal 1, results.size
 | 
					
 | 
				
			||||||
    assert_equal issue, results.first
 | 
					    assert_select '#search-results' do
 | 
				
			||||||
 | 
					      assert_select 'dt.issue', :text => /##{issue.id}/
 | 
				
			||||||
 | 
					      assert_select 'dt', 1
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_search_attachments_only
 | 
					  def test_search_attachments_only
 | 
				
			||||||
@@ -196,18 +217,26 @@ class SearchControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    attachment = Attachment.generate! :container => Issue.find(1), :filename => 'search_attachments.patch'
 | 
					    attachment = Attachment.generate! :container => Issue.find(1), :filename => 'search_attachments.patch'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    get :index, :params => {:id => 1, :q => 'search_attachments', :attachments => 'only'}
 | 
					    get :index, :params => {:id => 1, :q => 'search_attachments', :attachments => 'only'}
 | 
				
			||||||
    results = assigns(:results)
 | 
					    assert_response :success
 | 
				
			||||||
    assert_equal 1, results.size
 | 
					
 | 
				
			||||||
    assert_equal attachment.container, results.first
 | 
					    assert_select '#search-results' do
 | 
				
			||||||
 | 
					      assert_select 'dt.issue', :text => / #1 /
 | 
				
			||||||
 | 
					      assert_select 'dt', 1
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_search_with_attachments
 | 
					  def test_search_with_attachments
 | 
				
			||||||
    Issue.generate! :subject => 'search_attachments'
 | 
					    issue = Issue.generate! :subject => 'search_attachments'
 | 
				
			||||||
    Attachment.generate! :container => Issue.find(1), :filename => 'search_attachments.patch'
 | 
					    Attachment.generate! :container => Issue.find(1), :filename => 'search_attachments.patch'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    get :index, :params => {:id => 1, :q => 'search_attachments', :attachments => '1'}
 | 
					    get :index, :params => {:id => 1, :q => 'search_attachments', :attachments => '1'}
 | 
				
			||||||
    results = assigns(:results)
 | 
					    assert_response :success
 | 
				
			||||||
    assert_equal 2, results.size
 | 
					
 | 
				
			||||||
 | 
					    assert_select '#search-results' do
 | 
				
			||||||
 | 
					      assert_select 'dt.issue', :text => / #1 /
 | 
				
			||||||
 | 
					      assert_select 'dt.issue', :text => / ##{issue.id} /
 | 
				
			||||||
 | 
					      assert_select 'dt', 2
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_search_open_issues
 | 
					  def test_search_open_issues
 | 
				
			||||||
@@ -215,78 +244,98 @@ class SearchControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    Issue.generate! :subject => 'search_open', :status_id => 5
 | 
					    Issue.generate! :subject => 'search_open', :status_id => 5
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    get :index, :params => {:id => 1, :q => 'search_open', :open_issues => '1'}
 | 
					    get :index, :params => {:id => 1, :q => 'search_open', :open_issues => '1'}
 | 
				
			||||||
    results = assigns(:results)
 | 
					    assert_response :success
 | 
				
			||||||
    assert_equal 1, results.size
 | 
					
 | 
				
			||||||
 | 
					    assert_select '#search-results' do
 | 
				
			||||||
 | 
					      assert_select 'dt', 1
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_search_all_words
 | 
					  def test_search_all_words
 | 
				
			||||||
    # 'all words' is on by default
 | 
					    # 'all words' is on by default
 | 
				
			||||||
    get :index, :params => {:id => 1, :q => 'recipe updating saving', :all_words => '1'}
 | 
					    get :index, :params => {:id => 1, :q => 'recipe updating saving', :all_words => '1'}
 | 
				
			||||||
    assert_equal true, assigns(:all_words)
 | 
					    assert_response :success
 | 
				
			||||||
    results = assigns(:results)
 | 
					
 | 
				
			||||||
    assert_not_nil results
 | 
					    assert_select 'input[name=all_words][checked=checked]'
 | 
				
			||||||
    assert_equal 1, results.size
 | 
					    assert_select '#search-results' do
 | 
				
			||||||
    assert results.include?(Issue.find(3))
 | 
					      assert_select 'dt.issue', :text => / #3 /
 | 
				
			||||||
 | 
					      assert_select 'dt', 1
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_search_one_of_the_words
 | 
					  def test_search_one_of_the_words
 | 
				
			||||||
    get :index, :params => {:id => 1, :q => 'recipe updating saving', :all_words => ''}
 | 
					    get :index, :params => {:id => 1, :q => 'recipe updating saving', :all_words => ''}
 | 
				
			||||||
    assert_equal false, assigns(:all_words)
 | 
					    assert_response :success
 | 
				
			||||||
    results = assigns(:results)
 | 
					
 | 
				
			||||||
    assert_not_nil results
 | 
					    assert_select 'input[name=all_words]:not([checked])'
 | 
				
			||||||
    assert_equal 3, results.size
 | 
					    assert_select '#search-results' do
 | 
				
			||||||
    assert results.include?(Issue.find(3))
 | 
					      assert_select 'dt.issue', :text => / #3 /
 | 
				
			||||||
 | 
					      assert_select 'dt', 3
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_search_titles_only_without_result
 | 
					  def test_search_titles_only_without_result
 | 
				
			||||||
    get :index, :params => {:id => 1, :q => 'recipe updating saving', :titles_only => '1'}
 | 
					    get :index, :params => {:id => 1, :q => 'recipe updating saving', :titles_only => '1'}
 | 
				
			||||||
    results = assigns(:results)
 | 
					    assert_response :success
 | 
				
			||||||
    assert_not_nil results
 | 
					
 | 
				
			||||||
    assert_equal 0, results.size
 | 
					    assert_select 'input[name=titles_only][checked=checked]'
 | 
				
			||||||
 | 
					    assert_select '#search-results' do
 | 
				
			||||||
 | 
					      assert_select 'dt', 0
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_search_titles_only
 | 
					  def test_search_titles_only
 | 
				
			||||||
    get :index, :params => {:id => 1, :q => 'recipe', :titles_only => '1'}
 | 
					    get :index, :params => {:id => 1, :q => 'recipe', :titles_only => '1'}
 | 
				
			||||||
    assert_equal true, assigns(:titles_only)
 | 
					    assert_response :success
 | 
				
			||||||
    results = assigns(:results)
 | 
					
 | 
				
			||||||
    assert_not_nil results
 | 
					    assert_select 'input[name=titles_only][checked=checked]'
 | 
				
			||||||
    assert_equal 2, results.size
 | 
					    assert_select '#search-results' do
 | 
				
			||||||
 | 
					      assert_select 'dt', 2
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_search_content
 | 
					  def test_search_content
 | 
				
			||||||
    Issue.where(:id => 1).update_all("description = 'This is a searchkeywordinthecontent'")
 | 
					    Issue.where(:id => 1).update_all("description = 'This is a searchkeywordinthecontent'")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    get :index, :params => {:id => 1, :q => 'searchkeywordinthecontent', :titles_only => ''}
 | 
					    get :index, :params => {:id => 1, :q => 'searchkeywordinthecontent', :titles_only => ''}
 | 
				
			||||||
    assert_equal false, assigns(:titles_only)
 | 
					    assert_response :success
 | 
				
			||||||
    results = assigns(:results)
 | 
					
 | 
				
			||||||
    assert_not_nil results
 | 
					    assert_select 'input[name=titles_only]:not([checked])'
 | 
				
			||||||
    assert_equal 1, results.size
 | 
					    assert_select '#search-results' do
 | 
				
			||||||
 | 
					      assert_select 'dt.issue', :text => / #1 /
 | 
				
			||||||
 | 
					      assert_select 'dt', 1
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_search_with_pagination
 | 
					  def test_search_with_pagination
 | 
				
			||||||
    issue = (0..24).map {Issue.generate! :subject => 'search_with_limited_results'}.reverse
 | 
					    issues = (0..24).map {Issue.generate! :subject => 'search_with_limited_results'}.reverse
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    get :index, :params => {:q => 'search_with_limited_results'}
 | 
					    get :index, :params => {:q => 'search_with_limited_results'}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_equal issue[0..9], assigns(:results)
 | 
					    issues[0..9].each do |issue|
 | 
				
			||||||
 | 
					      assert_select '#search-results dt.issue', :text => / ##{issue.id} /
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    get :index, :params => {:q => 'search_with_limited_results', :page => 2}
 | 
					    get :index, :params => {:q => 'search_with_limited_results', :page => 2}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_equal issue[10..19], assigns(:results)
 | 
					    issues[10..19].each do |issue|
 | 
				
			||||||
 | 
					      assert_select '#search-results dt.issue', :text => / ##{issue.id} /
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    get :index, :params => {:q => 'search_with_limited_results', :page => 3}
 | 
					    get :index, :params => {:q => 'search_with_limited_results', :page => 3}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_equal issue[20..24], assigns(:results)
 | 
					    issues[20..24].each do |issue|
 | 
				
			||||||
 | 
					      assert_select '#search-results dt.issue', :text => / ##{issue.id} /
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    get :index, :params => {:q => 'search_with_limited_results', :page => 4}
 | 
					    get :index, :params => {:q => 'search_with_limited_results', :page => 4}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_equal [], assigns(:results)
 | 
					    assert_select '#search-results dt', 0
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_search_with_invalid_project_id
 | 
					  def test_search_with_invalid_project_id
 | 
				
			||||||
    get :index, :params => {:id => 195, :q => 'recipe'}
 | 
					    get :index, :params => {:id => 195, :q => 'recipe'}
 | 
				
			||||||
    assert_response 404
 | 
					    assert_response 404
 | 
				
			||||||
    assert_nil assigns(:results)
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_quick_jump_to_issue
 | 
					  def test_quick_jump_to_issue
 | 
				
			||||||
@@ -297,18 +346,25 @@ class SearchControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    # issue of a private project
 | 
					    # issue of a private project
 | 
				
			||||||
    get :index, :params => {:q => "4"}
 | 
					    get :index, :params => {:q => "4"}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'index'
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_large_integer
 | 
					  def test_large_integer
 | 
				
			||||||
    get :index, :params => {:q => '4615713488'}
 | 
					    get :index, :params => {:q => '4615713488'}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'index'
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_tokens_with_quotes
 | 
					  def test_tokens_with_quotes
 | 
				
			||||||
    get :index, :params => {:id => 1, :q => '"good bye" hello "bye bye"'}
 | 
					    issue1 = Issue.generate! :subject => 'say hello'
 | 
				
			||||||
    assert_equal ["good bye", "hello", "bye bye"], assigns(:tokens)
 | 
					    issue2 = Issue.generate! :subject => 'say good bye'
 | 
				
			||||||
 | 
					    issue3 = Issue.generate! :subject => 'say goodbye'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    get :index, :params => {:q => '"good bye" hello "bye bye"', :all_words => ''}
 | 
				
			||||||
 | 
					    assert_response :success
 | 
				
			||||||
 | 
					    assert_select '#search-results' do
 | 
				
			||||||
 | 
					      assert_select 'dt.issue a', :text => / ##{issue1.id} /
 | 
				
			||||||
 | 
					      assert_select 'dt.issue a', :text => / ##{issue2.id} /
 | 
				
			||||||
 | 
					      assert_select 'dt.issue a', :text => / ##{issue3.id} /, :count => 0
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_results_should_be_escaped_once
 | 
					  def test_results_should_be_escaped_once
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -68,9 +68,9 @@ class SearchCustomFieldsVisibilityTest < Redmine::ControllerTest
 | 
				
			|||||||
        assert_response :success
 | 
					        assert_response :success
 | 
				
			||||||
        # we should get a result only if the custom field is visible
 | 
					        # we should get a result only if the custom field is visible
 | 
				
			||||||
        if fields.include?(field)
 | 
					        if fields.include?(field)
 | 
				
			||||||
          assert_equal 1, assigns(:results).size
 | 
					          assert_select '#search-results dt', 1
 | 
				
			||||||
        else
 | 
					        else
 | 
				
			||||||
          assert_equal 0, assigns(:results).size
 | 
					          assert_select '#search-results dt', 0
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -34,13 +34,13 @@ class SettingsControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
  def test_index
 | 
					  def test_index
 | 
				
			||||||
    get :index
 | 
					    get :index
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'edit'
 | 
					
 | 
				
			||||||
 | 
					    assert_select 'input[name=?][value=?]', 'settings[app_title]', Setting.app_title
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_get_edit
 | 
					  def test_get_edit
 | 
				
			||||||
    get :edit
 | 
					    get :edit
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'edit'
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert_select 'input[name=?][value=""]', 'settings[enabled_scm][]'
 | 
					    assert_select 'input[name=?][value=""]', 'settings[enabled_scm][]'
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
@@ -195,7 +195,7 @@ class SettingsControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    get :plugin, :params => {:id => 'foo'}
 | 
					    get :plugin, :params => {:id => 'foo'}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'plugin'
 | 
					
 | 
				
			||||||
    assert_select 'form[action="/settings/plugin/foo"]' do
 | 
					    assert_select 'form[action="/settings/plugin/foo"]' do
 | 
				
			||||||
      assert_select 'input[name=?][value=?]', 'settings[sample_setting]', 'Plugin setting value'
 | 
					      assert_select 'input[name=?][value=?]', 'settings[sample_setting]', 'Plugin setting value'
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -37,14 +37,12 @@ class TimeEntryReportsControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
  def test_report_at_project_level
 | 
					  def test_report_at_project_level
 | 
				
			||||||
    get :report, :params => {:project_id => 'ecookbook'}
 | 
					    get :report, :params => {:project_id => 'ecookbook'}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'report'
 | 
					 | 
				
			||||||
    assert_select 'form#query_form[action=?]', '/projects/ecookbook/time_entries/report'
 | 
					    assert_select 'form#query_form[action=?]', '/projects/ecookbook/time_entries/report'
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_report_all_projects
 | 
					  def test_report_all_projects
 | 
				
			||||||
    get :report
 | 
					    get :report
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'report'
 | 
					 | 
				
			||||||
    assert_select 'form#query_form[action=?]', '/time_entries/report'
 | 
					    assert_select 'form#query_form[action=?]', '/time_entries/report'
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -60,42 +58,32 @@ class TimeEntryReportsControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
  def test_report_all_projects_one_criteria
 | 
					  def test_report_all_projects_one_criteria
 | 
				
			||||||
    get :report, :params => {:columns => 'week', :from => "2007-04-01", :to => "2007-04-30", :criteria => ['project']}
 | 
					    get :report, :params => {:columns => 'week', :from => "2007-04-01", :to => "2007-04-30", :criteria => ['project']}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'report'
 | 
					    assert_select 'tr.total td:last', :text => '8.65'
 | 
				
			||||||
    assert_not_nil assigns(:report)
 | 
					 | 
				
			||||||
    assert_equal "8.65", "%.2f" % assigns(:report).total_hours
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_report_all_time
 | 
					  def test_report_all_time
 | 
				
			||||||
    get :report, :params => {:project_id => 1, :criteria => ['project', 'issue']}
 | 
					    get :report, :params => {:project_id => 1, :criteria => ['project', 'issue']}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'report'
 | 
					    assert_select 'tr.total td:last', :text => '162.90'
 | 
				
			||||||
    assert_not_nil assigns(:report)
 | 
					 | 
				
			||||||
    assert_equal "162.90", "%.2f" % assigns(:report).total_hours
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_report_all_time_by_day
 | 
					  def test_report_all_time_by_day
 | 
				
			||||||
    get :report, :params => {:project_id => 1, :criteria => ['project', 'issue'], :columns => 'day'}
 | 
					    get :report, :params => {:project_id => 1, :criteria => ['project', 'issue'], :columns => 'day'}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'report'
 | 
					    assert_select 'tr.total td:last', :text => '162.90'
 | 
				
			||||||
    assert_not_nil assigns(:report)
 | 
					 | 
				
			||||||
    assert_equal "162.90", "%.2f" % assigns(:report).total_hours
 | 
					 | 
				
			||||||
    assert_select 'th', :text => '2007-03-12'
 | 
					    assert_select 'th', :text => '2007-03-12'
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_report_one_criteria
 | 
					  def test_report_one_criteria
 | 
				
			||||||
    get :report, :params => {:project_id => 1, :columns => 'week', :from => "2007-04-01", :to => "2007-04-30", :criteria => ['project']}
 | 
					    get :report, :params => {:project_id => 1, :columns => 'week', :from => "2007-04-01", :to => "2007-04-30", :criteria => ['project']}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'report'
 | 
					    assert_select 'tr.total td:last', :text => '8.65'
 | 
				
			||||||
    assert_not_nil assigns(:report)
 | 
					 | 
				
			||||||
    assert_equal "8.65", "%.2f" % assigns(:report).total_hours
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_report_two_criteria
 | 
					  def test_report_two_criteria
 | 
				
			||||||
    get :report, :params => {:project_id => 1, :columns => 'month', :from => "2007-01-01", :to => "2007-12-31", :criteria => ["user", "activity"]}
 | 
					    get :report, :params => {:project_id => 1, :columns => 'month', :from => "2007-01-01", :to => "2007-12-31", :criteria => ["user", "activity"]}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'report'
 | 
					    assert_select 'tr.total td:last', :text => '162.90'
 | 
				
			||||||
    assert_not_nil assigns(:report)
 | 
					 | 
				
			||||||
    assert_equal "162.90", "%.2f" % assigns(:report).total_hours
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_report_custom_field_criteria_with_multiple_values_on_single_value_custom_field_should_not_fail
 | 
					  def test_report_custom_field_criteria_with_multiple_values_on_single_value_custom_field_should_not_fail
 | 
				
			||||||
@@ -123,9 +111,7 @@ class TimeEntryReportsControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
  def test_report_one_day
 | 
					  def test_report_one_day
 | 
				
			||||||
    get :report, :params => {:project_id => 1, :columns => 'day', :from => "2007-03-23", :to => "2007-03-23", :criteria => ["user", "activity"]}
 | 
					    get :report, :params => {:project_id => 1, :columns => 'day', :from => "2007-03-23", :to => "2007-03-23", :criteria => ["user", "activity"]}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'report'
 | 
					    assert_select 'tr.total td:last', :text => '4.25'
 | 
				
			||||||
    assert_not_nil assigns(:report)
 | 
					 | 
				
			||||||
    assert_equal "4.25", "%.2f" % assigns(:report).total_hours
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_report_by_week_should_use_commercial_year
 | 
					  def test_report_by_week_should_use_commercial_year
 | 
				
			||||||
@@ -157,7 +143,6 @@ class TimeEntryReportsControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
  def test_report_should_propose_association_custom_fields
 | 
					  def test_report_should_propose_association_custom_fields
 | 
				
			||||||
    get :report
 | 
					    get :report
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'report'
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert_select 'select[name=?]', 'criteria[]' do
 | 
					    assert_select 'select[name=?]', 'criteria[]' do
 | 
				
			||||||
      assert_select 'option[value=cf_1]', {:text => 'Database'}, 'Issue custom field not found'
 | 
					      assert_select 'option[value=cf_1]', {:text => 'Database'}, 'Issue custom field not found'
 | 
				
			||||||
@@ -169,10 +154,8 @@ class TimeEntryReportsControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
  def test_report_with_association_custom_fields
 | 
					  def test_report_with_association_custom_fields
 | 
				
			||||||
    get :report, :params => {:criteria => ['cf_1', 'cf_3', 'cf_7']}
 | 
					    get :report, :params => {:criteria => ['cf_1', 'cf_3', 'cf_7']}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'report'
 | 
					
 | 
				
			||||||
    assert_not_nil assigns(:report)
 | 
					    assert_select 'tr.total td:last', :text => '162.90'
 | 
				
			||||||
    assert_equal 3, assigns(:report).criteria.size
 | 
					 | 
				
			||||||
    assert_equal "162.90", "%.2f" % assigns(:report).total_hours
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Custom fields columns
 | 
					    # Custom fields columns
 | 
				
			||||||
    assert_select 'th', :text => 'Database'
 | 
					    assert_select 'th', :text => 'Database'
 | 
				
			||||||
@@ -189,15 +172,14 @@ class TimeEntryReportsControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
  def test_report_one_criteria_no_result
 | 
					  def test_report_one_criteria_no_result
 | 
				
			||||||
    get :report, :params => {:project_id => 1, :columns => 'week', :from => "1998-04-01", :to => "1998-04-30", :criteria => ['project']}
 | 
					    get :report, :params => {:project_id => 1, :columns => 'week', :from => "1998-04-01", :to => "1998-04-30", :criteria => ['project']}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'report'
 | 
					
 | 
				
			||||||
    assert_not_nil assigns(:report)
 | 
					    assert_select '.nodata'
 | 
				
			||||||
    assert_equal "0.00", "%.2f" % assigns(:report).total_hours
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_report_status_criterion
 | 
					  def test_report_status_criterion
 | 
				
			||||||
    get :report, :params => {:project_id => 1, :criteria => ['status']}
 | 
					    get :report, :params => {:project_id => 1, :criteria => ['status']}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'report'
 | 
					
 | 
				
			||||||
    assert_select 'th', :text => 'Status'
 | 
					    assert_select 'th', :text => 'Status'
 | 
				
			||||||
    assert_select 'td', :text => 'New'
 | 
					    assert_select 'td', :text => 'New'
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,7 +32,7 @@ class TimelogControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    @request.session[:user_id] = 3
 | 
					    @request.session[:user_id] = 3
 | 
				
			||||||
    get :new
 | 
					    get :new
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'new'
 | 
					
 | 
				
			||||||
    assert_select 'input[name=?][type=hidden]', 'project_id', 0
 | 
					    assert_select 'input[name=?][type=hidden]', 'project_id', 0
 | 
				
			||||||
    assert_select 'input[name=?][type=hidden]', 'issue_id', 0
 | 
					    assert_select 'input[name=?][type=hidden]', 'issue_id', 0
 | 
				
			||||||
    assert_select 'select[name=?]', 'time_entry[project_id]' do
 | 
					    assert_select 'select[name=?]', 'time_entry[project_id]' do
 | 
				
			||||||
@@ -45,7 +45,7 @@ class TimelogControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    @request.session[:user_id] = 3
 | 
					    @request.session[:user_id] = 3
 | 
				
			||||||
    get :new, :params => {:project_id => 1}
 | 
					    get :new, :params => {:project_id => 1}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'new'
 | 
					
 | 
				
			||||||
    assert_select 'input[name=?][type=hidden]', 'project_id'
 | 
					    assert_select 'input[name=?][type=hidden]', 'project_id'
 | 
				
			||||||
    assert_select 'input[name=?][type=hidden]', 'issue_id', 0
 | 
					    assert_select 'input[name=?][type=hidden]', 'issue_id', 0
 | 
				
			||||||
    assert_select 'select[name=?]', 'time_entry[project_id]', 0
 | 
					    assert_select 'select[name=?]', 'time_entry[project_id]', 0
 | 
				
			||||||
@@ -55,7 +55,7 @@ class TimelogControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    @request.session[:user_id] = 3
 | 
					    @request.session[:user_id] = 3
 | 
				
			||||||
    get :new, :params => {:issue_id => 2}
 | 
					    get :new, :params => {:issue_id => 2}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'new'
 | 
					
 | 
				
			||||||
    assert_select 'input[name=?][type=hidden]', 'project_id', 0
 | 
					    assert_select 'input[name=?][type=hidden]', 'project_id', 0
 | 
				
			||||||
    assert_select 'input[name=?][type=hidden]', 'issue_id'
 | 
					    assert_select 'input[name=?][type=hidden]', 'issue_id'
 | 
				
			||||||
    assert_select 'select[name=?]', 'time_entry[project_id]', 0
 | 
					    assert_select 'select[name=?]', 'time_entry[project_id]', 0
 | 
				
			||||||
@@ -65,7 +65,7 @@ class TimelogControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    @request.session[:user_id] = 3
 | 
					    @request.session[:user_id] = 3
 | 
				
			||||||
    get :new, :params => {:time_entry => {:project_id => '1'}}
 | 
					    get :new, :params => {:time_entry => {:project_id => '1'}}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'new'
 | 
					
 | 
				
			||||||
    assert_select 'select[name=?]', 'time_entry[project_id]' do
 | 
					    assert_select 'select[name=?]', 'time_entry[project_id]' do
 | 
				
			||||||
      assert_select 'option[value="1"][selected=selected]'
 | 
					      assert_select 'option[value="1"][selected=selected]'
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
@@ -106,7 +106,7 @@ class TimelogControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    @request.session[:user_id] = 2
 | 
					    @request.session[:user_id] = 2
 | 
				
			||||||
    get :edit, :params => {:id => 2, :project_id => nil}
 | 
					    get :edit, :params => {:id => 2, :project_id => nil}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'edit'
 | 
					
 | 
				
			||||||
    assert_select 'form[action=?]', '/time_entries/2'
 | 
					    assert_select 'form[action=?]', '/time_entries/2'
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -118,7 +118,7 @@ class TimelogControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    @request.session[:user_id] = 1
 | 
					    @request.session[:user_id] = 1
 | 
				
			||||||
    get :edit, :params => {:project_id => 1, :id => 1}
 | 
					    get :edit, :params => {:project_id => 1, :id => 1}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'edit'
 | 
					
 | 
				
			||||||
    # Blank option since nothing is pre-selected
 | 
					    # Blank option since nothing is pre-selected
 | 
				
			||||||
    assert_select 'option', :text => '--- Please select ---'
 | 
					    assert_select 'option', :text => '--- Please select ---'
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
@@ -341,7 +341,7 @@ class TimelogControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    post :create, :params => {:time_entry => {:issue_id => ''}}
 | 
					    post :create, :params => {:time_entry => {:issue_id => ''}}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'new'
 | 
					    assert_select_error /Project cannot be blank/
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_create_with_failure
 | 
					  def test_create_with_failure
 | 
				
			||||||
@@ -356,7 +356,6 @@ class TimelogControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'new'
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_create_without_project
 | 
					  def test_create_without_project
 | 
				
			||||||
@@ -393,7 +392,7 @@ class TimelogControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert assigns(:time_entry).errors[:issue_id].present?
 | 
					    assert_select_error /Issue is invalid/
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_create_without_project_should_deny_without_permission
 | 
					  def test_create_without_project_should_deny_without_permission
 | 
				
			||||||
@@ -484,8 +483,8 @@ class TimelogControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
        :issue_id => '5'
 | 
					        :issue_id => '5'
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    assert_response 200
 | 
					    assert_response :success
 | 
				
			||||||
    assert_include "Issue is invalid", assigns(:time_entry).errors.full_messages
 | 
					    assert_select_error /Issue is invalid/
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_get_bulk_edit
 | 
					  def test_get_bulk_edit
 | 
				
			||||||
@@ -493,7 +492,6 @@ class TimelogControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    get :bulk_edit, :params => {:ids => [1, 2]}
 | 
					    get :bulk_edit, :params => {:ids => [1, 2]}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'bulk_edit'
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert_select 'ul#bulk-selection' do
 | 
					    assert_select 'ul#bulk-selection' do
 | 
				
			||||||
      assert_select 'li', 2
 | 
					      assert_select 'li', 2
 | 
				
			||||||
@@ -517,7 +515,6 @@ class TimelogControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    get :bulk_edit, :params => {:ids => [1, 2, 6]}
 | 
					    get :bulk_edit, :params => {:ids => [1, 2, 6]}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'bulk_edit'
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_bulk_edit_with_edit_own_time_entries_permission
 | 
					  def test_bulk_edit_with_edit_own_time_entries_permission
 | 
				
			||||||
@@ -664,26 +661,28 @@ class TimelogControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    @request.session[:user_id] = 2
 | 
					    @request.session[:user_id] = 2
 | 
				
			||||||
    get :index
 | 
					    get :index
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'index'
 | 
					
 | 
				
			||||||
    assert_select 'a[href=?]', '/time_entries/new', :text => /Log time/
 | 
					    assert_select 'a[href=?]', '/time_entries/new', :text => /Log time/
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_index_my_spent_time
 | 
					  def test_index_my_spent_time
 | 
				
			||||||
    @request.session[:user_id] = 2
 | 
					    @request.session[:user_id] = 2
 | 
				
			||||||
    get :index, :params => {:user_id => 'me'}
 | 
					    get :index, :params => {:user_id => 'me', :c => ['user']}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'index'
 | 
					
 | 
				
			||||||
    assert assigns(:entries).all? {|entry| entry.user_id == 2}
 | 
					    users = css_select('table.time-entries tbody td.user').map(&:text).uniq
 | 
				
			||||||
 | 
					    assert_equal ["John Smith"], users
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_index_at_project_level
 | 
					  def test_index_at_project_level
 | 
				
			||||||
    get :index, :params => {:project_id => 'ecookbook'}
 | 
					    get :index, :params => {:project_id => 'ecookbook', :c => ['project']}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'index'
 | 
					    
 | 
				
			||||||
    assert_not_nil assigns(:entries)
 | 
					    assert_select 'tr.time-entry', 4
 | 
				
			||||||
    assert_equal 4, assigns(:entries).size
 | 
					    
 | 
				
			||||||
    # project and subproject
 | 
					    # project and subproject
 | 
				
			||||||
    assert_equal [1, 3], assigns(:entries).collect(&:project_id).uniq.sort
 | 
					    projects = css_select('table.time-entries tbody td.project').map(&:text).uniq.sort
 | 
				
			||||||
 | 
					    assert_equal ["eCookbook", "eCookbook Subproject 1"], projects
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert_select '.total-for-hours', :text => 'Hours: 162.90'
 | 
					    assert_select '.total-for-hours', :text => 'Hours: 162.90'
 | 
				
			||||||
    assert_select 'form#query_form[action=?]', '/projects/ecookbook/time_entries'
 | 
					    assert_select 'form#query_form[action=?]', '/projects/ecookbook/time_entries'
 | 
				
			||||||
@@ -693,10 +692,11 @@ class TimelogControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    entry = TimeEntry.generate!(:project => Project.find(3))
 | 
					    entry = TimeEntry.generate!(:project => Project.find(3))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    with_settings :display_subprojects_issues => '0' do
 | 
					    with_settings :display_subprojects_issues => '0' do
 | 
				
			||||||
      get :index, :params => {:project_id => 'ecookbook'}
 | 
					      get :index, :params => {:project_id => 'ecookbook', :c => ['project']}
 | 
				
			||||||
      assert_response :success
 | 
					      assert_response :success
 | 
				
			||||||
      assert_template 'index'
 | 
					
 | 
				
			||||||
      assert_not_include entry, assigns(:entries)
 | 
					      projects = css_select('table.time-entries tbody td.project').map(&:text).uniq.sort
 | 
				
			||||||
 | 
					      assert_equal ["eCookbook"], projects
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -704,10 +704,11 @@ class TimelogControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    entry = TimeEntry.generate!(:project => Project.find(3))
 | 
					    entry = TimeEntry.generate!(:project => Project.find(3))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    with_settings :display_subprojects_issues => '0' do
 | 
					    with_settings :display_subprojects_issues => '0' do
 | 
				
			||||||
      get :index, :params => {:project_id => 'ecookbook', :subproject_id => 3}
 | 
					      get :index, :params => {:project_id => 'ecookbook', :c => ['project'], :subproject_id => 3}
 | 
				
			||||||
      assert_response :success
 | 
					      assert_response :success
 | 
				
			||||||
      assert_template 'index'
 | 
					
 | 
				
			||||||
      assert_include entry, assigns(:entries)
 | 
					      projects = css_select('table.time-entries tbody td.project').map(&:text).uniq.sort
 | 
				
			||||||
 | 
					      assert_equal ["eCookbook", "eCookbook Subproject 1"], projects
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -740,10 +741,8 @@ class TimelogControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
      :v => {'spent_on' => ['2007-03-20', '2007-04-30']}
 | 
					      :v => {'spent_on' => ['2007-03-20', '2007-04-30']}
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'index'
 | 
					 | 
				
			||||||
    assert_not_nil assigns(:entries)
 | 
					 | 
				
			||||||
    assert_equal 3, assigns(:entries).size
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    assert_select 'tr.time-entry', 3
 | 
				
			||||||
    assert_select '.total-for-hours', :text => 'Hours: 12.90'
 | 
					    assert_select '.total-for-hours', :text => 'Hours: 12.90'
 | 
				
			||||||
    assert_select 'form#query_form[action=?]', '/projects/ecookbook/time_entries'
 | 
					    assert_select 'form#query_form[action=?]', '/projects/ecookbook/time_entries'
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
@@ -755,10 +754,8 @@ class TimelogControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
      :to => '2007-04-30'
 | 
					      :to => '2007-04-30'
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'index'
 | 
					 | 
				
			||||||
    assert_not_nil assigns(:entries)
 | 
					 | 
				
			||||||
    assert_equal 3, assigns(:entries).size
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    assert_select 'tr.time-entry', 3
 | 
				
			||||||
    assert_select '.total-for-hours', :text => 'Hours: 12.90'
 | 
					    assert_select '.total-for-hours', :text => 'Hours: 12.90'
 | 
				
			||||||
    assert_select 'form#query_form[action=?]', '/projects/ecookbook/time_entries'
 | 
					    assert_select 'form#query_form[action=?]', '/projects/ecookbook/time_entries'
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
@@ -787,7 +784,7 @@ class TimelogControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
      :v => {'spent_on' => ['2012-06-15', '2012-06-16']}
 | 
					      :v => {'spent_on' => ['2012-06-15', '2012-06-16']}
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_equal [t2, t1, t3], assigns(:entries)
 | 
					    assert_equal [t2, t1, t3].map(&:id).map(&:to_s), css_select('input[name="ids[]"]').map {|e| e.attr('value')}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    get :index, :params => {
 | 
					    get :index, :params => {
 | 
				
			||||||
      :project_id => 1,
 | 
					      :project_id => 1,
 | 
				
			||||||
@@ -797,7 +794,7 @@ class TimelogControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
      :sort => 'spent_on'
 | 
					      :sort => 'spent_on'
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_equal [t3, t1, t2], assigns(:entries)
 | 
					    assert_equal [t3, t1, t2].map(&:id).map(&:to_s), css_select('input[name="ids[]"]').map {|e| e.attr('value')}
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_index_with_filter_on_issue_custom_field
 | 
					  def test_index_with_filter_on_issue_custom_field
 | 
				
			||||||
@@ -810,7 +807,7 @@ class TimelogControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
      :v => {'issue.cf_2' => ['filter_on_issue_custom_field']}
 | 
					      :v => {'issue.cf_2' => ['filter_on_issue_custom_field']}
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_equal [entry], assigns(:entries)
 | 
					    assert_equal [entry].map(&:id).map(&:to_s), css_select('input[name="ids[]"]').map {|e| e.attr('value')}
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_index_with_issue_custom_field_column
 | 
					  def test_index_with_issue_custom_field_column
 | 
				
			||||||
@@ -821,7 +818,6 @@ class TimelogControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
      :c => %w(project spent_on issue comments hours issue.cf_2)
 | 
					      :c => %w(project spent_on issue comments hours issue.cf_2)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_include :'issue.cf_2', assigns(:query).column_names
 | 
					 | 
				
			||||||
    assert_select 'td.issue_cf_2', :text => 'filter_on_issue_custom_field'
 | 
					    assert_select 'td.issue_cf_2', :text => 'filter_on_issue_custom_field'
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -834,7 +830,6 @@ class TimelogControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
      :c => ["hours", field_name]
 | 
					      :c => ["hours", field_name]
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_include field_name.to_sym, assigns(:query).column_names
 | 
					 | 
				
			||||||
    assert_select "td.#{field_name}", :text => 'CF Value'
 | 
					    assert_select "td.#{field_name}", :text => 'CF Value'
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -850,13 +845,12 @@ class TimelogControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
      :sort => field_name
 | 
					      :sort => field_name
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_include field_name.to_sym, assigns(:query).column_names
 | 
					 | 
				
			||||||
    assert_select "th a.sort", :text => 'String Field'
 | 
					    assert_select "th a.sort", :text => 'String Field'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Make sure that values are properly sorted
 | 
					    # Make sure that values are properly sorted
 | 
				
			||||||
    values = assigns(:entries).map {|e| e.custom_field_value(field)}.compact
 | 
					    values = css_select("td.#{field_name}").map(&:text).reject(&:blank?)
 | 
				
			||||||
    assert_equal 3, values.size
 | 
					 | 
				
			||||||
    assert_equal values.sort, values
 | 
					    assert_equal values.sort, values
 | 
				
			||||||
 | 
					    assert_equal 3, values.size
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_index_with_query
 | 
					  def test_index_with_query
 | 
				
			||||||
@@ -874,8 +868,7 @@ class TimelogControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    get :index, :params => {:project_id => 1, :format => 'atom'}
 | 
					    get :index, :params => {:project_id => 1, :format => 'atom'}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_equal 'application/atom+xml', @response.content_type
 | 
					    assert_equal 'application/atom+xml', @response.content_type
 | 
				
			||||||
    assert_not_nil assigns(:items)
 | 
					    assert_select 'entry > title', :text => /7\.65 hours/
 | 
				
			||||||
    assert assigns(:items).first.is_a?(TimeEntry)
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_index_at_project_level_should_include_csv_export_dialog
 | 
					  def test_index_at_project_level_should_include_csv_export_dialog
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -122,7 +122,9 @@ class TimelogCustomFieldsVisibilityTest < Redmine::ControllerTest
 | 
				
			|||||||
    assert_select 'td', :text => 'ValueB', :count => 0
 | 
					    assert_select 'td', :text => 'ValueB', :count => 0
 | 
				
			||||||
    assert_select 'td', {:text => 'ValueC'}, "ValueC not found in:\n#{response.body}"
 | 
					    assert_select 'td', {:text => 'ValueC'}, "ValueC not found in:\n#{response.body}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    get :index, :params => {:set_filter => '1', "issue.cf_#{@field2.id}" => '*'}
 | 
					    get :index, :params => {:set_filter => '1', "issue.cf_#{@field2.id}" => '*', :c => ["issue.cf_#{@field2.id}"]}
 | 
				
			||||||
    assert_equal %w(ValueA ValueC), assigns(:entries).map{|i| i.issue.custom_field_value(@field2)}.sort
 | 
					    assert_select 'td', :text => "ValueA"
 | 
				
			||||||
 | 
					    assert_select 'td', :text => "ValueC"
 | 
				
			||||||
 | 
					    assert_select 'td', :text => "ValueB", :count => 0
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -28,7 +28,7 @@ class TrackersControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
  def test_index
 | 
					  def test_index
 | 
				
			||||||
    get :index
 | 
					    get :index
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'index'
 | 
					    assert_select 'table.trackers'
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  def test_index_by_anonymous_should_redirect_to_login_form
 | 
					  def test_index_by_anonymous_should_redirect_to_login_form
 | 
				
			||||||
@@ -46,7 +46,7 @@ class TrackersControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
  def test_new
 | 
					  def test_new
 | 
				
			||||||
    get :new
 | 
					    get :new
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'new'
 | 
					    assert_select 'input[name=?]', 'tracker[name]'
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_create
 | 
					  def test_create
 | 
				
			||||||
@@ -112,7 +112,6 @@ class TrackersControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'new'
 | 
					 | 
				
			||||||
    assert_select_error /name cannot be blank/i
 | 
					    assert_select_error /name cannot be blank/i
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -121,7 +120,6 @@ class TrackersControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    get :edit, :params => {:id => 1}
 | 
					    get :edit, :params => {:id => 1}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'edit'
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert_select 'input[name=?][value="1"][checked=checked]', 'tracker[project_ids][]'
 | 
					    assert_select 'input[name=?][value="1"][checked=checked]', 'tracker[project_ids][]'
 | 
				
			||||||
    assert_select 'input[name=?][value="2"]:not([checked])', 'tracker[project_ids][]'
 | 
					    assert_select 'input[name=?][value="2"]:not([checked])', 'tracker[project_ids][]'
 | 
				
			||||||
@@ -136,7 +134,6 @@ class TrackersControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    get :edit, :params => {:id => 1}
 | 
					    get :edit, :params => {:id => 1}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'edit'
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert_select 'input[name=?][value=assigned_to_id][checked=checked]', 'tracker[core_fields][]'
 | 
					    assert_select 'input[name=?][value=assigned_to_id][checked=checked]', 'tracker[core_fields][]'
 | 
				
			||||||
    assert_select 'input[name=?][value=fixed_version_id][checked=checked]', 'tracker[core_fields][]'
 | 
					    assert_select 'input[name=?][value=fixed_version_id][checked=checked]', 'tracker[core_fields][]'
 | 
				
			||||||
@@ -186,7 +183,7 @@ class TrackersControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
  def test_update_with_failure
 | 
					  def test_update_with_failure
 | 
				
			||||||
    put :update, :params => {:id => 1, :tracker => { :name => '' }}
 | 
					    put :update, :params => {:id => 1, :tracker => { :name => '' }}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'edit'
 | 
					
 | 
				
			||||||
    assert_select_error /name cannot be blank/i
 | 
					    assert_select_error /name cannot be blank/i
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -216,7 +213,6 @@ class TrackersControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
  def test_get_fields
 | 
					  def test_get_fields
 | 
				
			||||||
    get :fields
 | 
					    get :fields
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'fields'
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert_select 'form' do
 | 
					    assert_select 'form' do
 | 
				
			||||||
      assert_select 'input[type=checkbox][name=?][value=assigned_to_id]', 'trackers[1][core_fields][]'
 | 
					      assert_select 'input[type=checkbox][name=?][value=assigned_to_id]', 'trackers[1][core_fields][]'
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -35,37 +35,30 @@ class UsersControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
  def test_index
 | 
					  def test_index
 | 
				
			||||||
    get :index
 | 
					    get :index
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'index'
 | 
					    assert_select 'table.users'
 | 
				
			||||||
    assert_not_nil assigns(:users)
 | 
					    assert_select 'tr.user.active'
 | 
				
			||||||
    # active users only
 | 
					    assert_select 'tr.user.locked', 0
 | 
				
			||||||
    assert_nil assigns(:users).detect {|u| !u.active?}
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_index_with_status_filter
 | 
					  def test_index_with_status_filter
 | 
				
			||||||
    get :index, :params => {:status => 3}
 | 
					    get :index, :params => {:status => 3}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'index'
 | 
					    assert_select 'tr.user.active', 0
 | 
				
			||||||
    assert_not_nil assigns(:users)
 | 
					    assert_select 'tr.user.locked'
 | 
				
			||||||
    assert_equal [3], assigns(:users).map(&:status).uniq
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_index_with_name_filter
 | 
					  def test_index_with_name_filter
 | 
				
			||||||
    get :index, :params => {:name => 'john'}
 | 
					    get :index, :params => {:name => 'john'}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'index'
 | 
					    assert_select 'tr.user td.username', :text => 'jsmith'
 | 
				
			||||||
    users = assigns(:users)
 | 
					    assert_select 'tr.user', 1
 | 
				
			||||||
    assert_not_nil users
 | 
					 | 
				
			||||||
    assert_equal 1, users.size
 | 
					 | 
				
			||||||
    assert_equal 'John', users.first.firstname
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_index_with_group_filter
 | 
					  def test_index_with_group_filter
 | 
				
			||||||
    get :index, :params => {:group_id => '10'}
 | 
					    get :index, :params => {:group_id => '10'}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'index'
 | 
					
 | 
				
			||||||
    users = assigns(:users)
 | 
					    assert_select 'tr.user', Group.find(10).users.count
 | 
				
			||||||
    assert users.any?
 | 
					 | 
				
			||||||
    assert_equal([], (users - Group.find(10).users))
 | 
					 | 
				
			||||||
    assert_select 'select[name=group_id]' do
 | 
					    assert_select 'select[name=group_id]' do
 | 
				
			||||||
      assert_select 'option[value="10"][selected=selected]'
 | 
					      assert_select 'option[value="10"][selected=selected]'
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
@@ -75,8 +68,14 @@ class UsersControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    @request.session[:user_id] = nil
 | 
					    @request.session[:user_id] = nil
 | 
				
			||||||
    get :show, :params => {:id => 2}
 | 
					    get :show, :params => {:id => 2}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'show'
 | 
					    assert_select 'h2', :text => /John Smith/
 | 
				
			||||||
    assert_not_nil assigns(:user)
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def test_show_should_display_visible_custom_fields
 | 
				
			||||||
 | 
					    @request.session[:user_id] = nil
 | 
				
			||||||
 | 
					    UserCustomField.find_by_name('Phone number').update_attribute :visible, true
 | 
				
			||||||
 | 
					    get :show, :params => {:id => 2}
 | 
				
			||||||
 | 
					    assert_response :success
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert_select 'li', :text => /Phone number/
 | 
					    assert_select 'li', :text => /Phone number/
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
@@ -86,8 +85,6 @@ class UsersControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    UserCustomField.find_by_name('Phone number').update_attribute :visible, false
 | 
					    UserCustomField.find_by_name('Phone number').update_attribute :visible, false
 | 
				
			||||||
    get :show, :params => {:id => 2}
 | 
					    get :show, :params => {:id => 2}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'show'
 | 
					 | 
				
			||||||
    assert_not_nil assigns(:user)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert_select 'li', :text => /Phone number/, :count => 0
 | 
					    assert_select 'li', :text => /Phone number/, :count => 0
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
@@ -113,7 +110,7 @@ class UsersControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    @request.session[:user_id] = 1
 | 
					    @request.session[:user_id] = 1
 | 
				
			||||||
    get :show, :params => {:id => 5}
 | 
					    get :show, :params => {:id => 5}
 | 
				
			||||||
    assert_response 200
 | 
					    assert_response 200
 | 
				
			||||||
    assert_not_nil assigns(:user)
 | 
					    assert_select 'h2', :text => /Dave2 Lopper2/
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_show_user_who_is_not_visible_should_return_404
 | 
					  def test_show_user_who_is_not_visible_should_return_404
 | 
				
			||||||
@@ -129,10 +126,9 @@ class UsersControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    @request.session[:user_id] = 1
 | 
					    @request.session[:user_id] = 1
 | 
				
			||||||
    get :show, :params => {:id => 2}
 | 
					    get :show, :params => {:id => 2}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    memberships = assigns(:memberships)
 | 
					
 | 
				
			||||||
    assert_not_nil memberships
 | 
					    # membership of private project admin can see
 | 
				
			||||||
    project_ids = memberships.map(&:project_id)
 | 
					    assert_select 'li a', :text => "OnlineStore"
 | 
				
			||||||
    assert project_ids.include?(2) #private project admin can see
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_show_current_should_require_authentication
 | 
					  def test_show_current_should_require_authentication
 | 
				
			||||||
@@ -145,15 +141,13 @@ class UsersControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    @request.session[:user_id] = 2
 | 
					    @request.session[:user_id] = 2
 | 
				
			||||||
    get :show, :params => {:id => 'current'}
 | 
					    get :show, :params => {:id => 'current'}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'show'
 | 
					    assert_select 'h2', :text => /John Smith/
 | 
				
			||||||
    assert_equal User.find(2), assigns(:user)
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_new
 | 
					  def test_new
 | 
				
			||||||
    get :new
 | 
					    get :new
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template :new
 | 
					    assert_select 'input[name=?]', 'user[login]'
 | 
				
			||||||
    assert assigns(:user)
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_create
 | 
					  def test_create
 | 
				
			||||||
@@ -266,7 +260,7 @@ class UsersControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
      post :create, :params => {:user => {}}
 | 
					      post :create, :params => {:user => {}}
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'new'
 | 
					    assert_select_error /Email cannot be blank/
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_create_with_failure_sould_preserve_preference
 | 
					  def test_create_with_failure_sould_preserve_preference
 | 
				
			||||||
@@ -283,7 +277,6 @@ class UsersControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'new'
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert_select 'select#pref_time_zone option[selected=selected]', :text => /Paris/
 | 
					    assert_select 'select#pref_time_zone option[selected=selected]', :text => /Paris/
 | 
				
			||||||
    assert_select 'input#pref_no_self_notified[value="1"][checked=checked]'
 | 
					    assert_select 'input#pref_no_self_notified[value="1"][checked=checked]'
 | 
				
			||||||
@@ -336,8 +329,7 @@ class UsersControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
  def test_edit
 | 
					  def test_edit
 | 
				
			||||||
    get :edit, :params => {:id => 2}
 | 
					    get :edit, :params => {:id => 2}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'edit'
 | 
					    assert_select 'input[name=?][value=?]', 'user[login]', 'jsmith'
 | 
				
			||||||
    assert_equal User.find(2), assigns(:user)
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_edit_registered_user
 | 
					  def test_edit_registered_user
 | 
				
			||||||
@@ -371,7 +363,7 @@ class UsersControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'edit'
 | 
					    assert_select_error /First name cannot be blank/
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_update_with_group_ids_should_assign_groups
 | 
					  def test_update_with_group_ids_should_assign_groups
 | 
				
			||||||
@@ -476,7 +468,6 @@ class UsersControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
  def test_update_notified_project
 | 
					  def test_update_notified_project
 | 
				
			||||||
    get :edit, :params => {:id => 2}
 | 
					    get :edit, :params => {:id => 2}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'edit'
 | 
					 | 
				
			||||||
    u = User.find(2)
 | 
					    u = User.find(2)
 | 
				
			||||||
    assert_equal [1, 2, 5], u.projects.collect{|p| p.id}.sort
 | 
					    assert_equal [1, 2, 5], u.projects.collect{|p| p.id}.sort
 | 
				
			||||||
    assert_equal [1, 2, 5], u.notified_projects_ids.sort
 | 
					    assert_equal [1, 2, 5], u.notified_projects_ids.sort
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -29,12 +29,12 @@ class VersionsControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
  def test_index
 | 
					  def test_index
 | 
				
			||||||
    get :index, :params => {:project_id => 1}
 | 
					    get :index, :params => {:project_id => 1}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'index'
 | 
					
 | 
				
			||||||
    assert_not_nil assigns(:versions)
 | 
					 | 
				
			||||||
    # Version with no date set appears
 | 
					    # 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
 | 
					    # 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
 | 
					    # Context menu on issues
 | 
				
			||||||
    assert_select "script", :text => Regexp.new(Regexp.escape("contextMenuInit('/issues/context_menu')"))
 | 
					    assert_select "script", :text => Regexp.new(Regexp.escape("contextMenuInit('/issues/context_menu')"))
 | 
				
			||||||
    assert_select "div#sidebar" do
 | 
					    assert_select "div#sidebar" do
 | 
				
			||||||
@@ -48,31 +48,33 @@ class VersionsControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
  def test_index_with_completed_versions
 | 
					  def test_index_with_completed_versions
 | 
				
			||||||
    get :index, :params => {:project_id => 1, :completed => 1}
 | 
					    get :index, :params => {:project_id => 1, :completed => 1}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'index'
 | 
					
 | 
				
			||||||
    assert_not_nil assigns(:versions)
 | 
					 | 
				
			||||||
    # Version with no date set appears
 | 
					    # Version with no date set appears
 | 
				
			||||||
    assert assigns(:versions).include?(Version.find(3))
 | 
					    assert_select 'h3', :text => Version.find(3).name
 | 
				
			||||||
    # Completed version appears
 | 
					    # Completed version appears
 | 
				
			||||||
    assert assigns(:versions).include?(Version.find(1))
 | 
					    assert_select 'h3', :text => Version.find(1).name
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_index_with_tracker_ids
 | 
					  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]}
 | 
					    get :index, :params => {:project_id => 1, :tracker_ids => [1, 3]}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'index'
 | 
					    assert_select 'a.issue.tracker-1'
 | 
				
			||||||
    assert_not_nil assigns(:issues_by_version)
 | 
					    assert_select 'a.issue.tracker-2', 0
 | 
				
			||||||
    assert_nil assigns(:issues_by_version).values.flatten.detect {|issue| issue.tracker_id == 2}
 | 
					    assert_select 'a.issue.tracker-3'
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_index_showing_subprojects_versions
 | 
					  def test_index_showing_subprojects_versions
 | 
				
			||||||
    @subproject_version = Version.create!(:project => Project.find(3), :name => "Subproject version")
 | 
					    @subproject_version = Version.create!(:project => Project.find(3), :name => "Subproject version")
 | 
				
			||||||
    get :index, :params => {:project_id => 1, :with_subprojects => 1}
 | 
					    get :index, :params => {:project_id => 1, :with_subprojects => 1}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'index'
 | 
					 | 
				
			||||||
    assert_not_nil assigns(:versions)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert assigns(:versions).include?(Version.find(4)), "Shared version not found"
 | 
					    # Shared version
 | 
				
			||||||
    assert assigns(:versions).include?(@subproject_version), "Subproject version not found"
 | 
					    assert_select 'h3', :text => Version.find(4).name
 | 
				
			||||||
 | 
					    # Subproject version
 | 
				
			||||||
 | 
					    assert_select 'h3', :text => /Subproject version/
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_index_should_prepend_shared_versions
 | 
					  def test_index_should_prepend_shared_versions
 | 
				
			||||||
@@ -92,8 +94,6 @@ class VersionsControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
  def test_show
 | 
					  def test_show
 | 
				
			||||||
    get :show, :params => {:id => 2}
 | 
					    get :show, :params => {:id => 2}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'show'
 | 
					 | 
				
			||||||
    assert_not_nil assigns(:version)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert_select 'h2', :text => /1.0/
 | 
					    assert_select 'h2', :text => /1.0/
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
@@ -127,14 +127,13 @@ class VersionsControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    @request.session[:user_id] = 2
 | 
					    @request.session[:user_id] = 2
 | 
				
			||||||
    get :new, :params => {:project_id => '1'}
 | 
					    get :new, :params => {:project_id => '1'}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'new'
 | 
					    assert_select 'input[name=?]', 'version[name]'
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_new_from_issue_form
 | 
					  def test_new_from_issue_form
 | 
				
			||||||
    @request.session[:user_id] = 2
 | 
					    @request.session[:user_id] = 2
 | 
				
			||||||
    xhr :get, :new, :params => {:project_id => '1'}
 | 
					    xhr :get, :new, :params => {:project_id => '1'}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'new'
 | 
					 | 
				
			||||||
    assert_equal 'text/javascript', response.content_type
 | 
					    assert_equal 'text/javascript', response.content_type
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -159,7 +158,6 @@ class VersionsControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    assert_equal 1, version.project_id
 | 
					    assert_equal 1, version.project_id
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'create'
 | 
					 | 
				
			||||||
    assert_equal 'text/javascript', response.content_type
 | 
					    assert_equal 'text/javascript', response.content_type
 | 
				
			||||||
    assert_include 'test_add_version_from_issue_form', response.body
 | 
					    assert_include 'test_add_version_from_issue_form', response.body
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
@@ -170,7 +168,6 @@ class VersionsControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
      xhr :post, :create, :params => {:project_id => '1', :version => {:name => ''}}
 | 
					      xhr :post, :create, :params => {:project_id => '1', :version => {:name => ''}}
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'new'
 | 
					 | 
				
			||||||
    assert_equal 'text/javascript', response.content_type
 | 
					    assert_equal 'text/javascript', response.content_type
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -178,7 +175,7 @@ class VersionsControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    @request.session[:user_id] = 2
 | 
					    @request.session[:user_id] = 2
 | 
				
			||||||
    get :edit, :params => {:id => 2}
 | 
					    get :edit, :params => {:id => 2}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'edit'
 | 
					    assert_select 'input[name=?][value=?]', 'version[name]', Version.find(2).name
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_close_completed
 | 
					  def test_close_completed
 | 
				
			||||||
@@ -216,7 +213,7 @@ class VersionsControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'edit'
 | 
					    assert_select_error /Name cannot be blank/
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_destroy
 | 
					  def test_destroy
 | 
				
			||||||
@@ -243,15 +240,11 @@ class VersionsControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
  def test_issue_status_by
 | 
					  def test_issue_status_by
 | 
				
			||||||
    xhr :get, :status_by, :params => {:id => 2}
 | 
					    xhr :get, :status_by, :params => {:id => 2}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'status_by'
 | 
					 | 
				
			||||||
    assert_template '_issue_counts'
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_issue_status_by_status
 | 
					  def test_issue_status_by_status
 | 
				
			||||||
    xhr :get, :status_by, :params => {:id => 2, :status_by => 'status'}
 | 
					    xhr :get, :status_by, :params => {:id => 2, :status_by => 'status'}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'status_by'
 | 
					 | 
				
			||||||
    assert_template '_issue_counts'
 | 
					 | 
				
			||||||
    assert_include 'Assigned', response.body
 | 
					    assert_include 'Assigned', response.body
 | 
				
			||||||
    assert_include 'Closed', response.body
 | 
					    assert_include 'Closed', response.body
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -144,7 +144,6 @@ class WatchersControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    @request.session[:user_id] = 2
 | 
					    @request.session[:user_id] = 2
 | 
				
			||||||
    xhr :get, :new, :params => {:project_id => 1}
 | 
					    xhr :get, :new, :params => {:project_id => 1}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_equal Project.find(1), assigns(:project)
 | 
					 | 
				
			||||||
    assert_match /ajax-modal/, response.body
 | 
					    assert_match /ajax-modal/, response.body
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -152,7 +151,6 @@ class WatchersControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    @request.session[:user_id] = 2
 | 
					    @request.session[:user_id] = 2
 | 
				
			||||||
    xhr :get, :new, :params => {:project_id => 'ecookbook'}
 | 
					    xhr :get, :new, :params => {:project_id => 'ecookbook'}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_equal Project.find(1), assigns(:project)
 | 
					 | 
				
			||||||
    assert_match /ajax-modal/, response.body
 | 
					    assert_match /ajax-modal/, response.body
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -266,16 +264,16 @@ class WatchersControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
  def test_autocomplete_for_user_should_return_visible_users
 | 
					  def test_autocomplete_for_user_should_return_visible_users
 | 
				
			||||||
    Role.update_all :users_visibility => 'members_of_visible_projects'
 | 
					    Role.update_all :users_visibility => 'members_of_visible_projects'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    hidden = User.generate!(:lastname => 'autocomplete')
 | 
					    hidden = User.generate!(:lastname => 'autocomplete_hidden')
 | 
				
			||||||
    visible = User.generate!(:lastname => 'autocomplete')
 | 
					    visible = User.generate!(:lastname => 'autocomplete_visible')
 | 
				
			||||||
    User.add_to_project(visible, Project.find(1))
 | 
					    User.add_to_project(visible, Project.find(1))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @request.session[:user_id] = 2
 | 
					    @request.session[:user_id] = 2
 | 
				
			||||||
    xhr :get, :autocomplete_for_user, :params => {:q => 'autocomp', :project_id => 'ecookbook'}
 | 
					    xhr :get, :autocomplete_for_user, :params => {:q => 'autocomp', :project_id => 'ecookbook'}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert_include visible, assigns(:users)
 | 
					    assert_include visible.name, response.body
 | 
				
			||||||
    assert_not_include hidden, assigns(:users)
 | 
					    assert_not_include hidden.name, response.body
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_append
 | 
					  def test_append
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -28,33 +28,32 @@ class WelcomeControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
  def test_index
 | 
					  def test_index
 | 
				
			||||||
    get :index
 | 
					    get :index
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'index'
 | 
					    assert_select 'h3', :text => 'Latest news'
 | 
				
			||||||
    assert_not_nil assigns(:news)
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_browser_language
 | 
					  def test_browser_language
 | 
				
			||||||
    @request.env['HTTP_ACCEPT_LANGUAGE'] = 'fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3'
 | 
					    @request.env['HTTP_ACCEPT_LANGUAGE'] = 'fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3'
 | 
				
			||||||
    get :index
 | 
					    get :index
 | 
				
			||||||
    assert_equal :fr, @controller.current_language
 | 
					    assert_select 'html[lang=fr]'
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_browser_language_alternate
 | 
					  def test_browser_language_alternate
 | 
				
			||||||
    @request.env['HTTP_ACCEPT_LANGUAGE'] = 'zh-TW'
 | 
					    @request.env['HTTP_ACCEPT_LANGUAGE'] = 'zh-TW'
 | 
				
			||||||
    get :index
 | 
					    get :index
 | 
				
			||||||
    assert_equal :"zh-TW", @controller.current_language
 | 
					    assert_select 'html[lang=zh-TW]'
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_browser_language_alternate_not_valid
 | 
					  def test_browser_language_alternate_not_valid
 | 
				
			||||||
    @request.env['HTTP_ACCEPT_LANGUAGE'] = 'fr-CA'
 | 
					    @request.env['HTTP_ACCEPT_LANGUAGE'] = 'fr-CA'
 | 
				
			||||||
    get :index
 | 
					    get :index
 | 
				
			||||||
    assert_equal :fr, @controller.current_language
 | 
					    assert_select 'html[lang=fr]'
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_browser_language_should_be_ignored_with_force_default_language_for_anonymous
 | 
					  def test_browser_language_should_be_ignored_with_force_default_language_for_anonymous
 | 
				
			||||||
    @request.env['HTTP_ACCEPT_LANGUAGE'] = 'fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3'
 | 
					    @request.env['HTTP_ACCEPT_LANGUAGE'] = 'fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3'
 | 
				
			||||||
    with_settings :force_default_language_for_anonymous => '1' do
 | 
					    with_settings :force_default_language_for_anonymous => '1' do
 | 
				
			||||||
      get :index
 | 
					      get :index
 | 
				
			||||||
      assert_equal :en, @controller.current_language
 | 
					      assert_select 'html[lang=en]'
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -64,7 +63,7 @@ class WelcomeControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    @request.env['HTTP_ACCEPT_LANGUAGE'] = 'fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3'
 | 
					    @request.env['HTTP_ACCEPT_LANGUAGE'] = 'fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3'
 | 
				
			||||||
    with_settings :default_language => 'fi' do
 | 
					    with_settings :default_language => 'fi' do
 | 
				
			||||||
      get :index
 | 
					      get :index
 | 
				
			||||||
      assert_equal :it, @controller.current_language
 | 
					      assert_select 'html[lang=it]'
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -74,7 +73,7 @@ class WelcomeControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    @request.env['HTTP_ACCEPT_LANGUAGE'] = 'fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3'
 | 
					    @request.env['HTTP_ACCEPT_LANGUAGE'] = 'fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3'
 | 
				
			||||||
    with_settings :force_default_language_for_loggedin => '1', :default_language => 'fi' do
 | 
					    with_settings :force_default_language_for_loggedin => '1', :default_language => 'fi' do
 | 
				
			||||||
      get :index
 | 
					      get :index
 | 
				
			||||||
      assert_equal :fi, @controller.current_language
 | 
					      assert_select 'html[lang=fi]'
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -30,9 +30,8 @@ class WikiControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
  def test_show_start_page
 | 
					  def test_show_start_page
 | 
				
			||||||
    get :show, :params => {:project_id => 'ecookbook'}
 | 
					    get :show, :params => {:project_id => 'ecookbook'}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'show'
 | 
					 | 
				
			||||||
    assert_select 'h1', :text => /CookBook documentation/
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    assert_select 'h1', :text => /CookBook documentation/
 | 
				
			||||||
    # child_pages macro
 | 
					    # child_pages macro
 | 
				
			||||||
    assert_select 'ul.pages-hierarchy>li>a[href=?]', '/projects/ecookbook/wiki/Page_with_an_inline_image',
 | 
					    assert_select 'ul.pages-hierarchy>li>a[href=?]', '/projects/ecookbook/wiki/Page_with_an_inline_image',
 | 
				
			||||||
      :text => 'Page with an inline image'
 | 
					      :text => 'Page with an inline image'
 | 
				
			||||||
@@ -48,7 +47,7 @@ class WikiControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
  def test_show_page_with_name
 | 
					  def test_show_page_with_name
 | 
				
			||||||
    get :show, :params => {:project_id => 1, :id => 'Another_page'}
 | 
					    get :show, :params => {:project_id => 1, :id => 'Another_page'}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'show'
 | 
					
 | 
				
			||||||
    assert_select 'h1', :text => /Another page/
 | 
					    assert_select 'h1', :text => /Another page/
 | 
				
			||||||
    # Included page with an inline image
 | 
					    # Included page with an inline image
 | 
				
			||||||
    assert_select 'p', :text => /This is an inline image/
 | 
					    assert_select 'p', :text => /This is an inline image/
 | 
				
			||||||
@@ -60,7 +59,6 @@ class WikiControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
      get :show, :params => {:project_id => 'ecookbook', :id => 'CookBook_documentation', :version => '2'}
 | 
					      get :show, :params => {:project_id => 'ecookbook', :id => 'CookBook_documentation', :version => '2'}
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'show'
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert_select 'a[href=?]', '/projects/ecookbook/wiki/CookBook_documentation/1', :text => /Previous/
 | 
					    assert_select 'a[href=?]', '/projects/ecookbook/wiki/CookBook_documentation/1', :text => /Previous/
 | 
				
			||||||
    assert_select 'a[href=?]', '/projects/ecookbook/wiki/CookBook_documentation/2/diff', :text => /diff/
 | 
					    assert_select 'a[href=?]', '/projects/ecookbook/wiki/CookBook_documentation/2/diff', :text => /diff/
 | 
				
			||||||
@@ -76,9 +74,8 @@ class WikiControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    content.save!
 | 
					    content.save!
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    get :show, :params => {:project_id => 'ecookbook', :id => page.title, :version => '1'}
 | 
					    get :show, :params => {:project_id => 'ecookbook', :id => page.title, :version => '1'}
 | 
				
			||||||
    assert_kind_of WikiContent::Version, assigns(:content)
 | 
					 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'show'
 | 
					    assert_select 'a[href=?]', '/projects/ecookbook/wiki/Page_with_an_inline_image', :text => /Current version/
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_show_old_version_without_permission_should_be_denied
 | 
					  def test_show_old_version_without_permission_should_be_denied
 | 
				
			||||||
@@ -93,7 +90,6 @@ class WikiControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
      get :show, :params => {:project_id => 'ecookbook', :id => 'CookBook_documentation', :version => '1'}
 | 
					      get :show, :params => {:project_id => 'ecookbook', :id => 'CookBook_documentation', :version => '1'}
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'show'
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert_select 'a', :text => /Previous/, :count => 0
 | 
					    assert_select 'a', :text => /Previous/, :count => 0
 | 
				
			||||||
    assert_select 'a', :text => /diff/, :count => 0
 | 
					    assert_select 'a', :text => /diff/, :count => 0
 | 
				
			||||||
@@ -150,7 +146,7 @@ class WikiControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    @request.session[:user_id] = 2
 | 
					    @request.session[:user_id] = 2
 | 
				
			||||||
    get :show, :params => {:project_id => 1, :id => 'Unexistent page'}
 | 
					    get :show, :params => {:project_id => 1, :id => 'Unexistent page'}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'edit'
 | 
					    assert_select 'textarea[name=?]', 'content[text]'
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_show_specific_version_of_an_unexistent_page_without_edit_right
 | 
					  def test_show_specific_version_of_an_unexistent_page_without_edit_right
 | 
				
			||||||
@@ -162,7 +158,6 @@ class WikiControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    @request.session[:user_id] = 2
 | 
					    @request.session[:user_id] = 2
 | 
				
			||||||
    get :show, :params => {:project_id => 1, :id => 'Unexistent page', :parent => 'Another_page'}
 | 
					    get :show, :params => {:project_id => 1, :id => 'Unexistent page', :parent => 'Another_page'}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'edit'
 | 
					 | 
				
			||||||
    assert_select 'select[name=?] option[value="2"][selected=selected]', 'wiki_page[parent_id]'
 | 
					    assert_select 'select[name=?] option[value="2"][selected=selected]', 'wiki_page[parent_id]'
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -179,7 +174,6 @@ class WikiControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    get :show, :params => {:project_id => 1, :id => 'NoContent'}
 | 
					    get :show, :params => {:project_id => 1, :id => 'NoContent'}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'edit'
 | 
					 | 
				
			||||||
    assert_select 'textarea[name=?]', 'content[text]'
 | 
					    assert_select 'textarea[name=?]', 'content[text]'
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -188,7 +182,7 @@ class WikiControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    get :new, :params => {:project_id => 'ecookbook'}
 | 
					    get :new, :params => {:project_id => 'ecookbook'}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'new'
 | 
					    assert_select 'input[name=?]', 'title'
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_get_new_xhr
 | 
					  def test_get_new_xhr
 | 
				
			||||||
@@ -196,7 +190,7 @@ class WikiControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    xhr :get, :new, :params => {:project_id => 'ecookbook'}
 | 
					    xhr :get, :new, :params => {:project_id => 'ecookbook'}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'new'
 | 
					    assert_include 'Unallowed characters', response.body
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_post_new_with_valid_title_should_redirect_to_edit
 | 
					  def test_post_new_with_valid_title_should_redirect_to_edit
 | 
				
			||||||
@@ -219,7 +213,6 @@ class WikiControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    post :new, :params => {:project_id => 'ecookbook', :title => 'Another page'}
 | 
					    post :new, :params => {:project_id => 'ecookbook', :title => 'Another page'}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'new'
 | 
					 | 
				
			||||||
    assert_select_error 'Title has already been taken'
 | 
					    assert_select_error 'Title has already been taken'
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -228,7 +221,6 @@ class WikiControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    xhr :post, :new, :params => {:project_id => 'ecookbook', :title => 'Another page'}
 | 
					    xhr :post, :new, :params => {:project_id => 'ecookbook', :title => 'Another page'}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'new'
 | 
					 | 
				
			||||||
    assert_include 'Title has already been taken', response.body
 | 
					    assert_include 'Title has already been taken', response.body
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -298,7 +290,6 @@ class WikiControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    get :edit, :params => {:project_id => 'ecookbook', :id => 'Another_page'}
 | 
					    get :edit, :params => {:project_id => 'ecookbook', :id => 'Another_page'}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'edit'
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert_select 'textarea[name=?]', 'content[text]',
 | 
					    assert_select 'textarea[name=?]', 'content[text]',
 | 
				
			||||||
      :text => WikiPage.find_by_title('Another_page').content.text
 | 
					      :text => WikiPage.find_by_title('Another_page').content.text
 | 
				
			||||||
@@ -309,7 +300,6 @@ class WikiControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    get :edit, :params => {:project_id => 'ecookbook', :id => 'Page_with_sections', :section => 2}
 | 
					    get :edit, :params => {:project_id => 'ecookbook', :id => 'Page_with_sections', :section => 2}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'edit'
 | 
					 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    page = WikiPage.find_by_title('Page_with_sections')
 | 
					    page = WikiPage.find_by_title('Page_with_sections')
 | 
				
			||||||
    section, hash = Redmine::WikiFormatting::Textile::Formatter.new(page.content.text).get_section(2)
 | 
					    section, hash = Redmine::WikiFormatting::Textile::Formatter.new(page.content.text).get_section(2)
 | 
				
			||||||
@@ -398,7 +388,6 @@ class WikiControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
      end
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'edit'
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert_select_error /Comment is too long/
 | 
					    assert_select_error /Comment is too long/
 | 
				
			||||||
    assert_select 'textarea#content_text', :text => "edited"
 | 
					    assert_select 'textarea#content_text', :text => "edited"
 | 
				
			||||||
@@ -475,7 +464,6 @@ class WikiControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
      end
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'edit'
 | 
					 | 
				
			||||||
    assert_select 'div.error', :text => /Data has been updated by another user/
 | 
					    assert_select 'div.error', :text => /Data has been updated by another user/
 | 
				
			||||||
    assert_select 'textarea[name=?]', 'content[text]', :text => /Text should not be lost/
 | 
					    assert_select 'textarea[name=?]', 'content[text]', :text => /Text should not be lost/
 | 
				
			||||||
    assert_select 'input[name=?][value=?]', 'content[comments]', 'My comments'
 | 
					    assert_select 'input[name=?][value=?]', 'content[comments]', 'My comments'
 | 
				
			||||||
@@ -577,7 +565,6 @@ class WikiControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
      end
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'edit'
 | 
					 | 
				
			||||||
    assert_select 'div.error', :text => /Data has been updated by another user/
 | 
					    assert_select 'div.error', :text => /Data has been updated by another user/
 | 
				
			||||||
    assert_select 'textarea[name=?]', 'content[text]', :text => /Text should not be lost/
 | 
					    assert_select 'textarea[name=?]', 'content[text]', :text => /Text should not be lost/
 | 
				
			||||||
    assert_select 'input[name=?][value=?]', 'content[comments]', 'My comments'
 | 
					    assert_select 'input[name=?][value=?]', 'content[comments]', 'My comments'
 | 
				
			||||||
@@ -595,7 +582,6 @@ class WikiControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'common/_preview'
 | 
					 | 
				
			||||||
    assert_select 'strong', :text => /previewed text/
 | 
					    assert_select 'strong', :text => /previewed text/
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -611,7 +597,6 @@ class WikiControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'common/_preview'
 | 
					 | 
				
			||||||
    assert_select 'h1', :text => /New page/
 | 
					    assert_select 'h1', :text => /New page/
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -619,9 +604,10 @@ class WikiControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    @request.session[:user_id] = 2
 | 
					    @request.session[:user_id] = 2
 | 
				
			||||||
    get :history, :params => {:project_id => 'ecookbook', :id => 'CookBook_documentation'}
 | 
					    get :history, :params => {:project_id => 'ecookbook', :id => 'CookBook_documentation'}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'history'
 | 
					
 | 
				
			||||||
    assert_not_nil assigns(:versions)
 | 
					    assert_select 'table.wiki-page-versions tbody' do
 | 
				
			||||||
    assert_equal 3, assigns(:versions).size
 | 
					      assert_select 'tr', 3
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert_select "input[type=submit][name=commit]"
 | 
					    assert_select "input[type=submit][name=commit]"
 | 
				
			||||||
    assert_select 'td' do
 | 
					    assert_select 'td' do
 | 
				
			||||||
@@ -635,9 +621,11 @@ class WikiControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    @request.session[:user_id] = 2
 | 
					    @request.session[:user_id] = 2
 | 
				
			||||||
    get :history, :params => {:project_id => 'ecookbook', :id => 'Another_page'}
 | 
					    get :history, :params => {:project_id => 'ecookbook', :id => 'Another_page'}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'history'
 | 
					
 | 
				
			||||||
    assert_not_nil assigns(:versions)
 | 
					    assert_select 'table.wiki-page-versions tbody' do
 | 
				
			||||||
    assert_equal 1, assigns(:versions).size
 | 
					      assert_select 'tr', 1
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert_select "input[type=submit][name=commit]", false
 | 
					    assert_select "input[type=submit][name=commit]", false
 | 
				
			||||||
    assert_select 'td' do
 | 
					    assert_select 'td' do
 | 
				
			||||||
      assert_select 'a[href=?]', '/projects/ecookbook/wiki/Another_page/1', :text => '1'
 | 
					      assert_select 'a[href=?]', '/projects/ecookbook/wiki/Another_page/1', :text => '1'
 | 
				
			||||||
@@ -661,7 +649,6 @@ class WikiControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
      :version_from => (content.version - 1)
 | 
					      :version_from => (content.version - 1)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'diff'
 | 
					 | 
				
			||||||
    assert_select 'span.diff_out', :text => 'Line removed'
 | 
					    assert_select 'span.diff_out', :text => 'Line removed'
 | 
				
			||||||
    assert_select 'span.diff_in', :text => 'Line added'
 | 
					    assert_select 'span.diff_in', :text => 'Line added'
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
@@ -689,13 +676,19 @@ class WikiControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
      :version => 2
 | 
					      :version => 2
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'annotate'
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Line 1
 | 
					    # Line 1
 | 
				
			||||||
    assert_select 'table.annotate tr:nth-child(1)' do
 | 
					    assert_select 'table.annotate tr:nth-child(1)' do
 | 
				
			||||||
      assert_select 'th.line-num', :text => '1'
 | 
					      assert_select 'th.line-num', :text => '1'
 | 
				
			||||||
 | 
					      assert_select 'td.author', :text => /Redmine Admin/
 | 
				
			||||||
 | 
					      assert_select 'td', :text => /h1\. CookBook documentation v2/
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Line 4
 | 
				
			||||||
 | 
					    assert_select 'table.annotate tr:nth-child(4)' do
 | 
				
			||||||
 | 
					      assert_select 'th.line-num', :text => '4'
 | 
				
			||||||
      assert_select 'td.author', :text => /John Smith/
 | 
					      assert_select 'td.author', :text => /John Smith/
 | 
				
			||||||
      assert_select 'td', :text => /h1\. CookBook documentation/
 | 
					      assert_select 'td', :text => /Line from v1/
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Line 5
 | 
					    # Line 5
 | 
				
			||||||
@@ -718,7 +711,6 @@ class WikiControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    @request.session[:user_id] = 2
 | 
					    @request.session[:user_id] = 2
 | 
				
			||||||
    get :rename, :params => {:project_id => 1, :id => 'Another_page'}
 | 
					    get :rename, :params => {:project_id => 1, :id => 'Another_page'}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'rename'
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert_select 'select[name=?]', 'wiki_page[parent_id]' do
 | 
					    assert_select 'select[name=?]', 'wiki_page[parent_id]' do
 | 
				
			||||||
      assert_select 'option[value=""]', :text => ''
 | 
					      assert_select 'option[value=""]', :text => ''
 | 
				
			||||||
@@ -730,7 +722,6 @@ class WikiControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    @request.session[:user_id] = 2
 | 
					    @request.session[:user_id] = 2
 | 
				
			||||||
    get :rename, :params => {:project_id => 1, :id => 'Child_1'}
 | 
					    get :rename, :params => {:project_id => 1, :id => 'Child_1'}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'rename'
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert_select 'select[name=?]', 'wiki_page[parent_id]' do
 | 
					    assert_select 'select[name=?]', 'wiki_page[parent_id]' do
 | 
				
			||||||
      assert_select 'option[value=""]', :text => ''
 | 
					      assert_select 'option[value=""]', :text => ''
 | 
				
			||||||
@@ -808,7 +799,6 @@ class WikiControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    get :rename, :params => {:project_id => 1, :id => 'Another_page'}
 | 
					    get :rename, :params => {:project_id => 1, :id => 'Another_page'}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'rename'
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert_select 'select[name=?]', 'wiki_page[wiki_id]' do
 | 
					    assert_select 'select[name=?]', 'wiki_page[wiki_id]' do
 | 
				
			||||||
      assert_select 'option', 2
 | 
					      assert_select 'option', 2
 | 
				
			||||||
@@ -849,7 +839,6 @@ class WikiControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
      delete :destroy, :params => {:project_id => 1, :id => 'Another_page'}
 | 
					      delete :destroy, :params => {:project_id => 1, :id => 'Another_page'}
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'destroy'
 | 
					 | 
				
			||||||
    assert_select 'form' do
 | 
					    assert_select 'form' do
 | 
				
			||||||
      assert_select 'input[name=todo][value=nullify]'
 | 
					      assert_select 'input[name=todo][value=nullify]'
 | 
				
			||||||
      assert_select 'input[name=todo][value=destroy]'
 | 
					      assert_select 'input[name=todo][value=destroy]'
 | 
				
			||||||
@@ -913,11 +902,10 @@ class WikiControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
  def test_index
 | 
					  def test_index
 | 
				
			||||||
    get :index, :params => {:project_id => 'ecookbook'}
 | 
					    get :index, :params => {:project_id => 'ecookbook'}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'index'
 | 
					
 | 
				
			||||||
    pages = assigns(:pages)
 | 
					    assert_select 'ul.pages-hierarchy' do
 | 
				
			||||||
    assert_not_nil pages
 | 
					      assert_select 'li', Project.find(1).wiki.pages.count
 | 
				
			||||||
    assert_equal Project.find(1).wiki.pages.size, pages.size
 | 
					    end
 | 
				
			||||||
    assert_equal pages.first.content.updated_on, pages.first.updated_on
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert_select 'ul.pages-hierarchy' do
 | 
					    assert_select 'ul.pages-hierarchy' do
 | 
				
			||||||
      assert_select 'li' do
 | 
					      assert_select 'li' do
 | 
				
			||||||
@@ -938,8 +926,6 @@ class WikiControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    get :export, :params => {:project_id => 'ecookbook'}
 | 
					    get :export, :params => {:project_id => 'ecookbook'}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_not_nil assigns(:pages)
 | 
					 | 
				
			||||||
    assert assigns(:pages).any?
 | 
					 | 
				
			||||||
    assert_equal "text/html", @response.content_type
 | 
					    assert_equal "text/html", @response.content_type
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert_select "a[name=?]", "CookBook_documentation"
 | 
					    assert_select "a[name=?]", "CookBook_documentation"
 | 
				
			||||||
@@ -952,8 +938,6 @@ class WikiControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    get :export, :params => {:project_id => 'ecookbook', :format => 'pdf'}
 | 
					    get :export, :params => {:project_id => 'ecookbook', :format => 'pdf'}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_not_nil assigns(:pages)
 | 
					 | 
				
			||||||
    assert assigns(:pages).any?
 | 
					 | 
				
			||||||
    assert_equal 'application/pdf', @response.content_type
 | 
					    assert_equal 'application/pdf', @response.content_type
 | 
				
			||||||
    assert_equal 'attachment; filename="ecookbook.pdf"', @response.headers['Content-Disposition']
 | 
					    assert_equal 'attachment; filename="ecookbook.pdf"', @response.headers['Content-Disposition']
 | 
				
			||||||
    assert @response.body.starts_with?('%PDF')
 | 
					    assert @response.body.starts_with?('%PDF')
 | 
				
			||||||
@@ -971,9 +955,6 @@ class WikiControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    get :date_index, :params => {:project_id => 'ecookbook'}
 | 
					    get :date_index, :params => {:project_id => 'ecookbook'}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'date_index'
 | 
					 | 
				
			||||||
    assert_not_nil assigns(:pages)
 | 
					 | 
				
			||||||
    assert_not_nil assigns(:pages_by_date)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert_select 'a[href=?]', '/projects/ecookbook/activity.atom?show_wiki_edits=1'
 | 
					    assert_select 'a[href=?]', '/projects/ecookbook/activity.atom?show_wiki_edits=1'
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
@@ -1005,7 +986,7 @@ class WikiControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    @request.session[:user_id] = 2
 | 
					    @request.session[:user_id] = 2
 | 
				
			||||||
    get :show, :params => {:project_id => 1}
 | 
					    get :show, :params => {:project_id => 1}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'show'
 | 
					
 | 
				
			||||||
    assert_select 'a[href=?]', '/projects/1/wiki/CookBook_documentation/edit'
 | 
					    assert_select 'a[href=?]', '/projects/1/wiki/CookBook_documentation/edit'
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1013,7 +994,7 @@ class WikiControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    @request.session[:user_id] = 4
 | 
					    @request.session[:user_id] = 4
 | 
				
			||||||
    get :show, :params => {:project_id => 1}
 | 
					    get :show, :params => {:project_id => 1}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'show'
 | 
					
 | 
				
			||||||
    assert_select 'a[href=?]', '/projects/1/wiki/CookBook_documentation/edit', 0
 | 
					    assert_select 'a[href=?]', '/projects/1/wiki/CookBook_documentation/edit', 0
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1021,7 +1002,7 @@ class WikiControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    @request.session[:user_id] = 2
 | 
					    @request.session[:user_id] = 2
 | 
				
			||||||
    get :show, :params => {:project_id => 1, :format => 'pdf'}
 | 
					    get :show, :params => {:project_id => 1, :format => 'pdf'}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_not_nil assigns(:page)
 | 
					
 | 
				
			||||||
    assert_equal 'application/pdf', @response.content_type
 | 
					    assert_equal 'application/pdf', @response.content_type
 | 
				
			||||||
    assert_equal 'attachment; filename="CookBook_documentation.pdf"',
 | 
					    assert_equal 'attachment; filename="CookBook_documentation.pdf"',
 | 
				
			||||||
                  @response.headers['Content-Disposition']
 | 
					                  @response.headers['Content-Disposition']
 | 
				
			||||||
@@ -1031,7 +1012,7 @@ class WikiControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    @request.session[:user_id] = 2
 | 
					    @request.session[:user_id] = 2
 | 
				
			||||||
    get :show, :params => {:project_id => 1, :format => 'html'}
 | 
					    get :show, :params => {:project_id => 1, :format => 'html'}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_not_nil assigns(:page)
 | 
					
 | 
				
			||||||
    assert_equal 'text/html', @response.content_type
 | 
					    assert_equal 'text/html', @response.content_type
 | 
				
			||||||
    assert_equal 'attachment; filename="CookBook_documentation.html"',
 | 
					    assert_equal 'attachment; filename="CookBook_documentation.html"',
 | 
				
			||||||
                  @response.headers['Content-Disposition']
 | 
					                  @response.headers['Content-Disposition']
 | 
				
			||||||
@@ -1042,19 +1023,18 @@ class WikiControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    @request.session[:user_id] = 2
 | 
					    @request.session[:user_id] = 2
 | 
				
			||||||
    get :show, :params => {:project_id => 1, :format => 'html', :version => 2}
 | 
					    get :show, :params => {:project_id => 1, :format => 'html', :version => 2}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_not_nil assigns(:content)
 | 
					
 | 
				
			||||||
    assert_equal 2, assigns(:content).version
 | 
					 | 
				
			||||||
    assert_equal 'text/html', @response.content_type
 | 
					    assert_equal 'text/html', @response.content_type
 | 
				
			||||||
    assert_equal 'attachment; filename="CookBook_documentation.html"',
 | 
					    assert_equal 'attachment; filename="CookBook_documentation.html"',
 | 
				
			||||||
                  @response.headers['Content-Disposition']
 | 
					                  @response.headers['Content-Disposition']
 | 
				
			||||||
    assert_select 'h1', :text => /CookBook documentation/
 | 
					    assert_select 'h1', :text => /CookBook documentation v2/
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_show_txt
 | 
					  def test_show_txt
 | 
				
			||||||
    @request.session[:user_id] = 2
 | 
					    @request.session[:user_id] = 2
 | 
				
			||||||
    get :show, :params => {:project_id => 1, :format => 'txt'}
 | 
					    get :show, :params => {:project_id => 1, :format => 'txt'}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_not_nil assigns(:page)
 | 
					
 | 
				
			||||||
    assert_equal 'text/plain', @response.content_type
 | 
					    assert_equal 'text/plain', @response.content_type
 | 
				
			||||||
    assert_equal 'attachment; filename="CookBook_documentation.txt"',
 | 
					    assert_equal 'attachment; filename="CookBook_documentation.txt"',
 | 
				
			||||||
                  @response.headers['Content-Disposition']
 | 
					                  @response.headers['Content-Disposition']
 | 
				
			||||||
@@ -1065,12 +1045,11 @@ class WikiControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    @request.session[:user_id] = 2
 | 
					    @request.session[:user_id] = 2
 | 
				
			||||||
    get :show, :params => {:project_id => 1, :format => 'txt', :version => 2}
 | 
					    get :show, :params => {:project_id => 1, :format => 'txt', :version => 2}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_not_nil assigns(:content)
 | 
					
 | 
				
			||||||
    assert_equal 2, assigns(:content).version
 | 
					 | 
				
			||||||
    assert_equal 'text/plain', @response.content_type
 | 
					    assert_equal 'text/plain', @response.content_type
 | 
				
			||||||
    assert_equal 'attachment; filename="CookBook_documentation.txt"',
 | 
					    assert_equal 'attachment; filename="CookBook_documentation.txt"',
 | 
				
			||||||
                  @response.headers['Content-Disposition']
 | 
					                  @response.headers['Content-Disposition']
 | 
				
			||||||
    assert_include 'h1. CookBook documentation', @response.body
 | 
					    assert_include 'h1. CookBook documentation v2', @response.body
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_edit_unprotected_page
 | 
					  def test_edit_unprotected_page
 | 
				
			||||||
@@ -1078,7 +1057,6 @@ class WikiControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    @request.session[:user_id] = 4
 | 
					    @request.session[:user_id] = 4
 | 
				
			||||||
    get :edit, :params => {:project_id => 1, :id => 'Another_page'}
 | 
					    get :edit, :params => {:project_id => 1, :id => 'Another_page'}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'edit'
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_edit_protected_page_by_nonmember
 | 
					  def test_edit_protected_page_by_nonmember
 | 
				
			||||||
@@ -1092,7 +1070,6 @@ class WikiControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    @request.session[:user_id] = 2
 | 
					    @request.session[:user_id] = 2
 | 
				
			||||||
    get :edit, :params => {:project_id => 1, :id => 'CookBook_documentation'}
 | 
					    get :edit, :params => {:project_id => 1, :id => 'CookBook_documentation'}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'edit'
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_history_of_non_existing_page_should_return_404
 | 
					  def test_history_of_non_existing_page_should_return_404
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -31,7 +31,6 @@ class WikisControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    assert_difference 'Wiki.count' do
 | 
					    assert_difference 'Wiki.count' do
 | 
				
			||||||
      xhr :post, :edit, :params => {:id => 3, :wiki => { :start_page => 'Start page' }}
 | 
					      xhr :post, :edit, :params => {:id => 3, :wiki => { :start_page => 'Start page' }}
 | 
				
			||||||
      assert_response :success
 | 
					      assert_response :success
 | 
				
			||||||
      assert_template 'edit'
 | 
					 | 
				
			||||||
      assert_equal 'text/javascript', response.content_type
 | 
					      assert_equal 'text/javascript', response.content_type
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -46,7 +45,6 @@ class WikisControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    assert_no_difference 'Wiki.count' do
 | 
					    assert_no_difference 'Wiki.count' do
 | 
				
			||||||
      xhr :post, :edit, :params => {:id => 3, :wiki => { :start_page => '' }}
 | 
					      xhr :post, :edit, :params => {:id => 3, :wiki => { :start_page => '' }}
 | 
				
			||||||
      assert_response :success
 | 
					      assert_response :success
 | 
				
			||||||
      assert_template 'edit'
 | 
					 | 
				
			||||||
      assert_equal 'text/javascript', response.content_type
 | 
					      assert_equal 'text/javascript', response.content_type
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -60,7 +58,6 @@ class WikisControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    assert_no_difference 'Wiki.count' do
 | 
					    assert_no_difference 'Wiki.count' do
 | 
				
			||||||
      xhr :post, :edit, :params => {:id => 1, :wiki => { :start_page => 'Other start page' }}
 | 
					      xhr :post, :edit, :params => {:id => 1, :wiki => { :start_page => 'Other start page' }}
 | 
				
			||||||
      assert_response :success
 | 
					      assert_response :success
 | 
				
			||||||
      assert_template 'edit'
 | 
					 | 
				
			||||||
      assert_equal 'text/javascript', response.content_type
 | 
					      assert_equal 'text/javascript', response.content_type
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -28,7 +28,6 @@ class WorkflowsControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
  def test_index
 | 
					  def test_index
 | 
				
			||||||
    get :index
 | 
					    get :index
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'index'
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    count = WorkflowTransition.where(:role_id => 1, :tracker_id => 2).count
 | 
					    count = WorkflowTransition.where(:role_id => 1, :tracker_id => 2).count
 | 
				
			||||||
    assert_select 'a[href=?]', '/workflows/edit?role_id=1&tracker_id=2', :content => count.to_s
 | 
					    assert_select 'a[href=?]', '/workflows/edit?role_id=1&tracker_id=2', :content => count.to_s
 | 
				
			||||||
@@ -37,7 +36,6 @@ class WorkflowsControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
  def test_get_edit
 | 
					  def test_get_edit
 | 
				
			||||||
    get :edit
 | 
					    get :edit
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'edit'
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_get_edit_with_role_and_tracker
 | 
					  def test_get_edit_with_role_and_tracker
 | 
				
			||||||
@@ -47,11 +45,11 @@ class WorkflowsControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    get :edit, :params => {:role_id => 2, :tracker_id => 1}
 | 
					    get :edit, :params => {:role_id => 2, :tracker_id => 1}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'edit'
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # used status only
 | 
					    # used status only
 | 
				
			||||||
    assert_not_nil assigns(:statuses)
 | 
					    statuses = IssueStatus.where(:id => [2, 3, 5]).sorted.pluck(:name)
 | 
				
			||||||
    assert_equal [2, 3, 5], assigns(:statuses).collect(&:id)
 | 
					    assert_equal ["New issue"] + statuses,
 | 
				
			||||||
 | 
					      css_select('table.workflows.transitions-always tbody tr td:first').map(&:text).map(&:strip)
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    # allowed transitions
 | 
					    # allowed transitions
 | 
				
			||||||
    assert_select 'input[type=checkbox][name=?][value="1"][checked=checked]', 'transitions[3][5][always]'
 | 
					    assert_select 'input[type=checkbox][name=?][value="1"][checked=checked]', 'transitions[3][5][always]'
 | 
				
			||||||
@@ -74,8 +72,13 @@ class WorkflowsControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
  def test_get_edit_with_all_roles_and_all_trackers
 | 
					  def test_get_edit_with_all_roles_and_all_trackers
 | 
				
			||||||
    get :edit, :params => {:role_id => 'all', :tracker_id => 'all'}
 | 
					    get :edit, :params => {:role_id => 'all', :tracker_id => 'all'}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_equal Role.sorted.to_a, assigns(:roles)
 | 
					
 | 
				
			||||||
    assert_equal Tracker.sorted.to_a, assigns(:trackers)
 | 
					    assert_select 'select[name=?][multiple=multiple]', 'role_id[]' do
 | 
				
			||||||
 | 
					      assert_select 'option[selected=selected]', Role.all.select(&:consider_workflow?).count
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					    assert_select 'select[name=?]', 'tracker_id[]' do
 | 
				
			||||||
 | 
					      assert_select 'option[selected=selected][value=all]'
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_get_edit_with_role_and_tracker_and_all_statuses
 | 
					  def test_get_edit_with_role_and_tracker_and_all_statuses
 | 
				
			||||||
@@ -83,10 +86,10 @@ class WorkflowsControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    get :edit, :params => {:role_id => 2, :tracker_id => 1, :used_statuses_only => '0'}
 | 
					    get :edit, :params => {:role_id => 2, :tracker_id => 1, :used_statuses_only => '0'}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'edit'
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert_not_nil assigns(:statuses)
 | 
					    statuses = IssueStatus.all.sorted.pluck(:name)
 | 
				
			||||||
    assert_equal IssueStatus.count, assigns(:statuses).size
 | 
					    assert_equal ["New issue"] + statuses,
 | 
				
			||||||
 | 
					      css_select('table.workflows.transitions-always tbody tr td:first').map(&:text).map(&:strip)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert_select 'input[type=checkbox][name=?]', 'transitions[1][1][always]'
 | 
					    assert_select 'input[type=checkbox][name=?]', 'transitions[1][1][always]'
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
@@ -161,7 +164,6 @@ class WorkflowsControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
    get :permissions
 | 
					    get :permissions
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'permissions'
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_get_permissions_with_role_and_tracker
 | 
					  def test_get_permissions_with_role_and_tracker
 | 
				
			||||||
@@ -172,7 +174,6 @@ class WorkflowsControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    get :permissions, :params => {:role_id => 1, :tracker_id => 2}
 | 
					    get :permissions, :params => {:role_id => 1, :tracker_id => 2}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'permissions'
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert_select 'input[name=?][value="1"]', 'role_id[]'
 | 
					    assert_select 'input[name=?][value="1"]', 'role_id[]'
 | 
				
			||||||
    assert_select 'input[name=?][value="2"]', 'tracker_id[]'
 | 
					    assert_select 'input[name=?][value="2"]', 'tracker_id[]'
 | 
				
			||||||
@@ -213,7 +214,6 @@ class WorkflowsControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    get :permissions, :params => {:role_id => 1, :tracker_id => 1}
 | 
					    get :permissions, :params => {:role_id => 1, :tracker_id => 1}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'permissions'
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Custom field that is always required
 | 
					    # Custom field that is always required
 | 
				
			||||||
    # The default option is "(Required)"
 | 
					    # The default option is "(Required)"
 | 
				
			||||||
@@ -231,7 +231,6 @@ class WorkflowsControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    get :permissions, :params => {:role_id => 2, :tracker_id => 1}
 | 
					    get :permissions, :params => {:role_id => 2, :tracker_id => 1}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'permissions'
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert_select 'select[name=?]:not(.disabled)', "permissions[1][#{cf1.id}]"
 | 
					    assert_select 'select[name=?]:not(.disabled)', "permissions[1][#{cf1.id}]"
 | 
				
			||||||
    assert_select 'select[name=?]:not(.disabled)', "permissions[1][#{cf3.id}]"
 | 
					    assert_select 'select[name=?]:not(.disabled)', "permissions[1][#{cf3.id}]"
 | 
				
			||||||
@@ -287,7 +286,10 @@ class WorkflowsControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    get :permissions, :params => {:role_id => 1, :tracker_id => 2, :used_statuses_only => '0'}
 | 
					    get :permissions, :params => {:role_id => 1, :tracker_id => 2, :used_statuses_only => '0'}
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_equal IssueStatus.sorted.to_a, assigns(:statuses)
 | 
					
 | 
				
			||||||
 | 
					    statuses = IssueStatus.all.sorted.pluck(:name)
 | 
				
			||||||
 | 
					    assert_equal statuses,
 | 
				
			||||||
 | 
					      css_select('table.workflows.fields_permissions thead tr:nth-child(2) td:not(:first-child)').map(&:text).map(&:strip)
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_get_permissions_should_set_css_class
 | 
					  def test_get_permissions_should_set_css_class
 | 
				
			||||||
@@ -330,7 +332,7 @@ class WorkflowsControllerTest < Redmine::ControllerTest
 | 
				
			|||||||
  def test_get_copy
 | 
					  def test_get_copy
 | 
				
			||||||
    get :copy
 | 
					    get :copy
 | 
				
			||||||
    assert_response :success
 | 
					    assert_response :success
 | 
				
			||||||
    assert_template 'copy'
 | 
					
 | 
				
			||||||
    assert_select 'select[name=source_tracker_id]' do
 | 
					    assert_select 'select[name=source_tracker_id]' do
 | 
				
			||||||
      assert_select 'option[value="1"]', :text => 'Bug'
 | 
					      assert_select 'option[value="1"]', :text => 'Bug'
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user