diff --git a/app/views/activities/index.html.erb b/app/views/activities/index.html.erb
index 8f5cd08e6..033ae3cb6 100644
--- a/app/views/activities/index.html.erb
+++ b/app/views/activities/index.html.erb
@@ -46,7 +46,7 @@
<% end %>
<% content_for :sidebar do %>
-<%= form_tag({}, :method => :get) do %>
+<%= form_tag({}, :method => :get, :id => 'activity_scope_form') do %>
<%= l(:label_activity) %>
<% @activity.event_types.each do |t| %>
diff --git a/app/views/boards/show.html.erb b/app/views/boards/show.html.erb
index a9734318a..b032a5939 100644
--- a/app/views/boards/show.html.erb
+++ b/app/views/boards/show.html.erb
@@ -35,7 +35,7 @@
<% @topics.each do |topic| %>
-
+
| <%= link_to topic.subject, board_message_path(@board, topic) %> |
<%= link_to_user(topic.author) %> |
<%= format_time(topic.created_on) %> |
diff --git a/app/views/issues/_conflict.html.erb b/app/views/issues/_conflict.html.erb
index c13ace665..ea4c35d7d 100644
--- a/app/views/issues/_conflict.html.erb
+++ b/app/views/issues/_conflict.html.erb
@@ -3,6 +3,7 @@
<% if @conflict_journals.present? %>
<% @conflict_journals.sort_by(&:id).each do |journal| %>
+
<%= authoring journal.created_on, journal.user, :label => :label_updated_time_by %>
<% if journal.details.any? %>
@@ -14,6 +15,7 @@
<%= textilizable(journal, :notes) unless journal.notes.blank? %>
+
<% end %>
<% end %>
diff --git a/lib/redmine/field_format.rb b/lib/redmine/field_format.rb
index 3385989ac..f6b120dc4 100644
--- a/lib/redmine/field_format.rb
+++ b/lib/redmine/field_format.rb
@@ -47,6 +47,13 @@ module Redmine
formats.map {|format| [::I18n.t(format.label), format.name] }.sort_by(&:first)
end
+ # Returns an array of formats that can be used for a custom field class
+ def self.formats_for_custom_field_class(klass=nil)
+ all.values.select do |format|
+ format.class.customized_class_names.nil? || format.class.customized_class_names.include?(klass.name)
+ end
+ end
+
class Base
include Singleton
include Redmine::I18n
diff --git a/test/functional/account_controller_openid_test.rb b/test/functional/account_controller_openid_test.rb
index 6e6723e5b..b76e4bca2 100644
--- a/test/functional/account_controller_openid_test.rb
+++ b/test/functional/account_controller_openid_test.rb
@@ -111,9 +111,8 @@ class AccountControllerOpenidTest < Redmine::ControllerTest
post :login, :openid_url => 'http://openid.example.com/good_user'
assert_response :success
- assert_template 'register'
- assert assigns(:user)
- assert_equal 'http://openid.example.com/good_user', assigns(:user)[:identity_url]
+
+ assert_select 'input[name=?][value=?]', 'user[identity_url]', 'http://openid.example.com/good_user'
end
def test_login_with_openid_with_new_user_with_missing_information_should_register
@@ -121,9 +120,6 @@ class AccountControllerOpenidTest < Redmine::ControllerTest
post :login, :openid_url => 'http://openid.example.com/good_blank_user'
assert_response :success
- assert_template 'register'
- assert assigns(:user)
- assert_equal 'http://openid.example.com/good_blank_user', assigns(:user)[:identity_url]
assert_select 'input[name=?]', 'user[login]'
assert_select 'input[name=?]', 'user[password]'
diff --git a/test/functional/account_controller_test.rb b/test/functional/account_controller_test.rb
index 3ef771f56..37a67d475 100644
--- a/test/functional/account_controller_test.rb
+++ b/test/functional/account_controller_test.rb
@@ -27,7 +27,6 @@ class AccountControllerTest < Redmine::ControllerTest
def test_get_login
get :login
assert_response :success
- assert_template 'login'
assert_select 'input[name=username]'
assert_select 'input[name=password]'
@@ -131,7 +130,6 @@ class AccountControllerTest < Redmine::ControllerTest
def test_login_with_wrong_password
post :login, :username => 'admin', :password => 'bad'
assert_response :success
- assert_template 'login'
assert_select 'div.flash.error', :text => /Invalid user or password/
assert_select 'input[name=username][value=admin]'
@@ -190,7 +188,6 @@ class AccountControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
get :logout
assert_response :success
- assert_template 'logout'
assert_equal 2, @request.session[:user_id]
end
@@ -219,8 +216,6 @@ class AccountControllerTest < Redmine::ControllerTest
with_settings :self_registration => '3' do
get :register
assert_response :success
- assert_template 'register'
- assert_not_nil assigns(:user)
assert_select 'input[name=?]', 'user[password]'
assert_select 'input[name=?]', 'user[password_confirmation]'
@@ -232,8 +227,7 @@ class AccountControllerTest < Redmine::ControllerTest
@request.env['HTTP_ACCEPT_LANGUAGE'] = 'fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3'
get :register
assert_response :success
- assert_not_nil assigns(:user)
- assert_equal 'fr', assigns(:user).language
+
assert_select 'select[name=?]', 'user[language]' do
assert_select 'option[value=fr][selected=selected]'
end
@@ -387,7 +381,6 @@ class AccountControllerTest < Redmine::ControllerTest
get :lost_password, :token => token.value
assert_response :success
- assert_template 'password_recovery'
assert_select 'input[type=hidden][name=token][value=?]', token.value
end
@@ -429,7 +422,6 @@ class AccountControllerTest < Redmine::ControllerTest
post :lost_password, :token => token.value, :new_password => 'newpass', :new_password_confirmation => 'wrongpass'
assert_response :success
- assert_template 'password_recovery'
assert_not_nil Token.find_by_id(token.id), "Token was deleted"
assert_select 'input[type=hidden][name=token][value=?]', token.value
diff --git a/test/functional/activities_controller_test.rb b/test/functional/activities_controller_test.rb
index fa3e44abf..5aacf6228 100644
--- a/test/functional/activities_controller_test.rb
+++ b/test/functional/activities_controller_test.rb
@@ -32,8 +32,6 @@ class ActivitiesControllerTest < Redmine::ControllerTest
def test_project_index
get :index, :id => 1, :with_subprojects => 0
assert_response :success
- assert_template 'index'
- assert_not_nil assigns(:events_by_day)
assert_select 'h3', :text => /#{2.days.ago.to_date.day}/
assert_select 'dl dt.issue-edit a', :text => /(#{IssueStatus.find(2).name})/
@@ -47,8 +45,6 @@ class ActivitiesControllerTest < Redmine::ControllerTest
def test_previous_project_index
get :index, :id => 1, :from => 2.days.ago.to_date
assert_response :success
- assert_template 'index'
- assert_not_nil assigns(:events_by_day)
assert_select 'h3', :text => /#{3.days.ago.to_date.day}/
assert_select 'dl dt.issue a', :text => /Cannot print recipes/
@@ -58,8 +54,6 @@ class ActivitiesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 1
get :index
assert_response :success
- assert_template 'index'
- assert_not_nil assigns(:events_by_day)
i5 = Issue.find(5)
d5 = User.find(1).time_to_date(i5.created_on)
@@ -72,8 +66,6 @@ class ActivitiesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 1
get :index, :user_id => 2
assert_response :success
- assert_template 'index'
- assert_not_nil assigns(:events_by_day)
assert_select 'h2 a[href="/users/2"]', :text => 'John Smith'
@@ -92,7 +84,6 @@ class ActivitiesControllerTest < Redmine::ControllerTest
def test_index_atom_feed
get :index, :format => 'atom', :with_subprojects => 0
assert_response :success
- assert_template 'common/feed'
assert_select 'feed' do
assert_select 'link[rel=self][href=?]', 'http://test.host/activity.atom?with_subprojects=0'
@@ -115,7 +106,6 @@ class ActivitiesControllerTest < Redmine::ControllerTest
:show_wiki_edits => 1
assert_response :success
- assert_template 'common/feed'
assert_select 'feed' do
assert_select 'link[rel=self][href=?]', 'http://test.host/activity.atom?show_changesets=1&show_documents=1&show_files=1&show_issues=1&show_messages=1&show_news=1&show_time_entries=1&show_wiki_edits=1&with_subprojects=0'
@@ -130,7 +120,6 @@ class ActivitiesControllerTest < Redmine::ControllerTest
with_settings :default_language => 'en' do
get :index, :format => 'atom', :show_issues => '1'
assert_response :success
- assert_template 'common/feed'
assert_select 'title', :text => /Issues/
end
@@ -140,22 +129,21 @@ class ActivitiesControllerTest < Redmine::ControllerTest
get :index, :user_id => 2, :format => 'atom'
assert_response :success
- assert_template 'common/feed'
assert_select 'title', :text => "Redmine: #{User.find(2).name}"
end
def test_index_should_show_private_notes_with_permission_only
- journal = Journal.create!(:journalized => Issue.find(2), :notes => 'Private notes with searchkeyword', :private_notes => true)
+ journal = Journal.create!(:journalized => Issue.find(2), :notes => 'Private notes', :private_notes => true)
@request.session[:user_id] = 2
get :index
assert_response :success
- assert_include journal, assigns(:events_by_day).values.flatten
+ assert_select 'dl', :text => /Private notes/
Role.find(1).remove_permission! :view_private_notes
get :index
assert_response :success
- assert_not_include journal, assigns(:events_by_day).values.flatten
+ assert_select 'dl', :text => /Private notes/, :count => 0
end
def test_index_with_submitted_scope_should_save_as_preference
@@ -174,6 +162,11 @@ class ActivitiesControllerTest < Redmine::ControllerTest
get :index
assert_response :success
- assert_equal %w(issues news), assigns(:activity).scope
+
+ assert_select '#activity_scope_form' do
+ assert_select 'input[checked=checked]', 2
+ assert_select 'input[name=show_issues][checked=checked]'
+ assert_select 'input[name=show_news][checked=checked]'
+ end
end
end
diff --git a/test/functional/admin_controller_test.rb b/test/functional/admin_controller_test.rb
index 4752fb389..70a8ca683 100644
--- a/test/functional/admin_controller_test.rb
+++ b/test/functional/admin_controller_test.rb
@@ -39,29 +39,21 @@ class AdminControllerTest < Redmine::ControllerTest
def test_projects
get :projects
assert_response :success
- assert_template 'projects'
- assert_not_nil assigns(:projects)
- # active projects only
- assert_nil assigns(:projects).detect {|u| !u.active?}
+ assert_select 'tr.project.closed', 0
end
def test_projects_with_status_filter
get :projects, :status => 1
assert_response :success
- assert_template 'projects'
- assert_not_nil assigns(:projects)
- # active projects only
- assert_nil assigns(:projects).detect {|u| !u.active?}
+ assert_select 'tr.project.closed', 0
end
def test_projects_with_name_filter
get :projects, :name => 'store', :status => ''
assert_response :success
- assert_template 'projects'
- projects = assigns(:projects)
- assert_not_nil projects
- assert_equal 1, projects.size
- assert_equal 'OnlineStore', projects.first.name
+
+ assert_select 'tr.project td.name', :text => 'OnlineStore'
+ assert_select 'tr.project', 1
end
def test_load_default_configuration_data
@@ -107,8 +99,7 @@ class AdminControllerTest < Redmine::ControllerTest
get :plugins
assert_response :success
- assert_template 'plugins'
- assert_equal [], assigns(:plugins)
+ assert_select '.nodata'
end
def test_plugins
@@ -125,7 +116,6 @@ class AdminControllerTest < Redmine::ControllerTest
get :plugins
assert_response :success
- assert_template 'plugins'
assert_select 'tr#plugin-foo' do
assert_select 'td span.name', :text => 'Foo plugin'
@@ -140,7 +130,6 @@ class AdminControllerTest < Redmine::ControllerTest
def test_info
get :info
assert_response :success
- assert_template 'info'
end
def test_admin_menu_plugin_extension
diff --git a/test/functional/attachments_controller_test.rb b/test/functional/attachments_controller_test.rb
index 08c31078a..66039cf67 100644
--- a/test/functional/attachments_controller_test.rb
+++ b/test/functional/attachments_controller_test.rb
@@ -38,7 +38,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest
# 060719210727_changeset_utf8.diff
get :show, :id => 14, :type => dt
assert_response :success
- assert_template 'diff'
+
assert_equal 'text/html', @response.content_type
assert_select 'th.filename', :text => /issues_controller.rb\t\(révision 1484\)/
assert_select 'td.line-code', :text => /Demande créée avec succès/
@@ -52,7 +52,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest
# 060719210727_changeset_iso8859-1.diff
get :show, :id => 5, :type => dt
assert_response :success
- assert_template 'diff'
+
assert_equal 'text/html', @response.content_type
assert_select 'th.filename', :text => /issues_controller.rb\t\(r\?vision 1484\)/
assert_select 'td.line-code', :text => /Demande cr\?\?e avec succ\?s/
@@ -67,7 +67,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest
# 060719210727_changeset_iso8859-1.diff
get :show, :id => 5, :type => dt
assert_response :success
- assert_template 'diff'
+
assert_equal 'text/html', @response.content_type
assert_select 'th.filename', :text => /issues_controller.rb\t\(révision 1484\)/
assert_select 'td.line-code', :text => /Demande créée avec succès/
@@ -82,16 +82,15 @@ class AttachmentsControllerTest < Redmine::ControllerTest
user1.preference.save
user = User.find(1)
assert_nil user.pref[:diff_type]
-
@request.session[:user_id] = 1 # admin
+
get :show, :id => 5
assert_response :success
- assert_template 'diff'
user.reload
assert_equal "inline", user.pref[:diff_type]
+
get :show, :id => 5, :type => 'sbs'
assert_response :success
- assert_template 'diff'
user.reload
assert_equal "sbs", user.pref[:diff_type]
end
@@ -106,7 +105,6 @@ class AttachmentsControllerTest < Redmine::ControllerTest
get :show, :id => a.id, :type => 'inline'
assert_response :success
- assert_template 'diff'
assert_equal 'text/html', @response.content_type
assert_select 'th.filename', :text => 'test1.txt'
end
@@ -114,7 +112,6 @@ class AttachmentsControllerTest < Redmine::ControllerTest
def test_show_text_file
get :show, :id => 4
assert_response :success
- assert_template 'file'
assert_equal 'text/html', @response.content_type
set_tmp_attachments_directory
end
@@ -131,7 +128,6 @@ class AttachmentsControllerTest < Redmine::ControllerTest
get :show, :id => a.id
assert_response :success
- assert_template 'file'
assert_equal 'text/html', @response.content_type
assert_select 'tr#L1' do
assert_select 'th.line-num', :text => '1'
@@ -150,7 +146,6 @@ class AttachmentsControllerTest < Redmine::ControllerTest
get :show, :id => a.id
assert_response :success
- assert_template 'file'
assert_equal 'text/html', @response.content_type
assert_select 'tr#L7' do
assert_select 'th.line-num', :text => '7'
@@ -170,7 +165,6 @@ class AttachmentsControllerTest < Redmine::ControllerTest
get :show, :id => a.id
assert_response :success
- assert_template 'file'
assert_equal 'text/html', @response.content_type
assert_select 'tr#L7' do
assert_select 'th.line-num', :text => '7'
@@ -180,12 +174,13 @@ class AttachmentsControllerTest < Redmine::ControllerTest
end
def test_show_text_file_should_show_other_if_too_big
+ @request.session[:user_id] = 2
with_settings :file_max_size_displayed => 512 do
Attachment.find(4).update_attribute :filesize, 754.kilobyte
get :show, :id => 4
assert_response :success
- assert_template 'other'
assert_equal 'text/html', @response.content_type
+ assert_select '.nodata', :text => 'No preview available'
end
set_tmp_attachments_directory
end
@@ -194,14 +189,13 @@ class AttachmentsControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
get :show, :id => 16
assert_response :success
- assert_template 'image'
assert_equal 'text/html', @response.content_type
assert_select 'img.filecontent', :src => attachments(:attachments_010).filename
end
def test_show_other
+ @request.session[:user_id] = 2
get :show, :id => 6
- assert_template 'other'
assert_equal 'text/html', @response.content_type
assert_select '.nodata', :text => 'No preview available'
set_tmp_attachments_directory
@@ -351,13 +345,12 @@ class AttachmentsControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
get :edit, :object_type => 'issues', :object_id => '2'
assert_response :success
- assert_template 'edit'
-
- container = Issue.find(2)
- assert_equal container, assigns(:container)
- assert_equal container.attachments.size, assigns(:attachments).size
assert_select 'form[action=?]', '/attachments/issues/2' do
+ Issue.find(2).attachments.each do |attachment|
+ assert_select "tr#attachment-#{attachment.id}"
+ end
+
assert_select 'tr#attachment-4' do
assert_select 'input[name=?][value=?]', 'attachments[4][filename]', 'source.rb'
assert_select 'input[name=?][value=?]', 'attachments[4][description]', 'This is a Ruby source file'
@@ -401,7 +394,6 @@ class AttachmentsControllerTest < Redmine::ControllerTest
}
assert_response :success
- assert_template 'edit'
assert_select_error /file cannot be blank/i
# The other attachment should not be updated
diff --git a/test/functional/auth_sources_controller_test.rb b/test/functional/auth_sources_controller_test.rb
index 521fcf817..1ad829655 100644
--- a/test/functional/auth_sources_controller_test.rb
+++ b/test/functional/auth_sources_controller_test.rb
@@ -26,21 +26,12 @@ class AuthSourcesControllerTest < Redmine::ControllerTest
def test_index
get :index
-
assert_response :success
- assert_template 'index'
- assert_not_nil assigns(:auth_sources)
end
def test_new
get :new
-
assert_response :success
- assert_template 'new'
-
- source = assigns(:auth_source)
- assert_equal AuthSourceLdap, source.class
- assert source.new_record?
assert_select 'form#auth_source_form' do
assert_select 'input[name=type][value=AuthSourceLdap]'
@@ -72,16 +63,13 @@ class AuthSourcesControllerTest < Redmine::ControllerTest
:auth_source => {:name => 'Test', :host => '',
:port => '389', :attr_login => 'cn'}
assert_response :success
- assert_template 'new'
end
assert_select_error /host cannot be blank/i
end
def test_edit
get :edit, :id => 1
-
assert_response :success
- assert_template 'edit'
assert_select 'form#auth_source_form' do
assert_select 'input[name=?]', 'auth_source[host]'
@@ -117,7 +105,6 @@ class AuthSourcesControllerTest < Redmine::ControllerTest
:auth_source => {:name => 'Renamed', :host => '',
:port => '389', :attr_login => 'uid'}
assert_response :success
- assert_template 'edit'
assert_select_error /host cannot be blank/i
end
diff --git a/test/functional/auto_completes_controller_test.rb b/test/functional/auto_completes_controller_test.rb
index 48a1c7758..5360eac9b 100644
--- a/test/functional/auto_completes_controller_test.rb
+++ b/test/functional/auto_completes_controller_test.rb
@@ -31,49 +31,43 @@ class AutoCompletesControllerTest < Redmine::ControllerTest
def test_issues_should_not_be_case_sensitive
get :issues, :project_id => 'ecookbook', :q => 'ReCiPe'
assert_response :success
- assert_not_nil assigns(:issues)
- assert assigns(:issues).detect {|issue| issue.subject.match /recipe/}
+ assert_include "recipe", response.body
end
def test_issues_should_accept_term_param
get :issues, :project_id => 'ecookbook', :term => 'ReCiPe'
assert_response :success
- assert_not_nil assigns(:issues)
- assert assigns(:issues).detect {|issue| issue.subject.match /recipe/}
+ assert_include "recipe", response.body
end
def test_issues_should_return_issue_with_given_id
get :issues, :project_id => 'subproject1', :q => '13'
assert_response :success
- assert_not_nil assigns(:issues)
- assert assigns(:issues).include?(Issue.find(13))
+ assert_include "Bug #13", response.body
end
def test_issues_should_return_issue_with_given_id_preceded_with_hash
get :issues, :project_id => 'subproject1', :q => '#13'
assert_response :success
- assert_not_nil assigns(:issues)
- assert assigns(:issues).include?(Issue.find(13))
+ assert_include "Bug #13", response.body
end
def test_auto_complete_with_scope_all_should_search_other_projects
get :issues, :project_id => 'ecookbook', :q => '13', :scope => 'all'
assert_response :success
- assert_not_nil assigns(:issues)
- assert assigns(:issues).include?(Issue.find(13))
+ assert_include "Bug #13", response.body
end
def test_auto_complete_without_project_should_search_all_projects
get :issues, :q => '13'
assert_response :success
- assert_not_nil assigns(:issues)
- assert assigns(:issues).include?(Issue.find(13))
+ assert_include "Bug #13", response.body
end
def test_auto_complete_without_scope_all_should_not_search_other_projects
get :issues, :project_id => 'ecookbook', :q => '13'
assert_response :success
- assert_equal [], assigns(:issues)
+ assert_not_include "Bug #13", response.body
end
def test_issues_should_return_json
diff --git a/test/functional/boards_controller_test.rb b/test/functional/boards_controller_test.rb
index d6c8e89f8..dcb32d708 100644
--- a/test/functional/boards_controller_test.rb
+++ b/test/functional/boards_controller_test.rb
@@ -27,9 +27,7 @@ class BoardsControllerTest < Redmine::ControllerTest
def test_index
get :index, :project_id => 1
assert_response :success
- assert_template 'index'
- assert_not_nil assigns(:boards)
- assert_not_nil assigns(:project)
+ assert_select 'table.boards'
end
def test_index_not_found
@@ -42,17 +40,18 @@ class BoardsControllerTest < Redmine::ControllerTest
get :index, :project_id => 1
assert_response :success
- assert_template 'show'
- assert_not_nil assigns(:topics)
+
+ assert_select 'table.boards', 0
+ assert_select 'table.messages'
end
def test_show
get :show, :project_id => 1, :id => 1
assert_response :success
- assert_template 'show'
- assert_not_nil assigns(:board)
- assert_not_nil assigns(:project)
- assert_not_nil assigns(:topics)
+
+ assert_select 'table.messages tbody' do
+ assert_select 'tr', Board.find(1).topics.count
+ end
end
def test_show_should_display_sticky_messages_first
@@ -62,11 +61,12 @@ class BoardsControllerTest < Redmine::ControllerTest
get :show, :project_id => 1, :id => 1
assert_response :success
- topics = assigns(:topics)
- assert_not_nil topics
- assert topics.size > 1, "topics size was #{topics.size}"
- assert topics.first.sticky?
- assert topics.first.updated_on < topics.second.updated_on
+ assert_select 'table.messages tbody' do
+ # row is here...
+ assert_select 'tr.sticky'
+ # ...and in first position
+ assert_select 'tr.sticky:first-child'
+ end
end
def test_show_should_display_message_with_last_reply_first
@@ -79,16 +79,17 @@ class BoardsControllerTest < Redmine::ControllerTest
get :show, :project_id => 1, :id => 1
assert_response :success
- topics = assigns(:topics)
- assert_not_nil topics
- assert_equal old_topic, topics.first
+
+ assert_select 'table.messages tbody' do
+ assert_select "tr#message-#{old_topic.id}"
+ assert_select "tr#message-#{old_topic.id}:first-child"
+ end
end
def test_show_with_permission_should_display_the_new_message_form
@request.session[:user_id] = 2
get :show, :project_id => 1, :id => 1
assert_response :success
- assert_template 'show'
assert_select 'form#message-form' do
assert_select 'input[name=?]', 'message[subject]'
@@ -98,10 +99,8 @@ class BoardsControllerTest < Redmine::ControllerTest
def test_show_atom
get :show, :project_id => 1, :id => 1, :format => 'atom'
assert_response :success
- assert_template 'common/feed'
- assert_not_nil assigns(:board)
- assert_not_nil assigns(:project)
- assert_not_nil assigns(:messages)
+
+ assert_select 'feed > entry > title', :text => 'Help: RE: post 2'
end
def test_show_not_found
@@ -113,7 +112,6 @@ class BoardsControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
get :new, :project_id => 1
assert_response :success
- assert_template 'new'
assert_select 'select[name=?]', 'board[parent_id]' do
assert_select 'option', (Project.find(1).boards.size + 1)
@@ -132,7 +130,6 @@ class BoardsControllerTest < Redmine::ControllerTest
get :new, :project_id => 1
assert_response :success
- assert_template 'new'
assert_select 'select[name=?]', 'board[parent_id]', 0
end
diff --git a/test/functional/calendars_controller_test.rb b/test/functional/calendars_controller_test.rb
index becf11945..453e51e23 100644
--- a/test/functional/calendars_controller_test.rb
+++ b/test/functional/calendars_controller_test.rb
@@ -34,22 +34,19 @@ class CalendarsControllerTest < Redmine::ControllerTest
def test_show
get :show, :project_id => 1
assert_response :success
- assert_template :partial => '_calendar'
- assert_not_nil assigns(:calendar)
end
def test_show_should_run_custom_queries
- @query = IssueQuery.create!(:name => 'Calendar', :visibility => IssueQuery::VISIBILITY_PUBLIC)
+ @query = IssueQuery.create!(:name => 'Calendar Query', :visibility => IssueQuery::VISIBILITY_PUBLIC)
get :show, :query_id => @query.id
assert_response :success
+ assert_select 'h2', :text => 'Calendar Query'
end
def test_cross_project_calendar
get :show
assert_response :success
- assert_template :partial => '_calendar'
- assert_not_nil assigns(:calendar)
end
def test_week_number_calculation
diff --git a/test/functional/context_menus_controller_test.rb b/test/functional/context_menus_controller_test.rb
index c674e5d97..58ca8d094 100644
--- a/test/functional/context_menus_controller_test.rb
+++ b/test/functional/context_menus_controller_test.rb
@@ -37,7 +37,6 @@ class ContextMenusControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
get :issues, :ids => [1]
assert_response :success
- assert_template 'context_menus/issues'
assert_select 'a.icon-edit[href=?]', '/issues/1/edit', :text => 'Edit'
assert_select 'a.icon-copy[href=?]', '/projects/ecookbook/issues/1/copy', :text => 'Copy'
@@ -59,7 +58,7 @@ class ContextMenusControllerTest < Redmine::ControllerTest
with_settings :default_language => 'en' do
get :issues, :ids => [1]
assert_response :success
- assert_template 'context_menus/issues'
+
assert_select 'a.icon-del.disabled[href="#"]', :text => 'Delete'
end
end
@@ -68,11 +67,8 @@ class ContextMenusControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
get :issues, :ids => [1, 2]
assert_response :success
- assert_template 'context_menus/issues'
- assert_not_nil assigns(:issues)
- assert_equal [1, 2], assigns(:issues).map(&:id).sort
- ids = assigns(:issues).map(&:id).sort.map {|i| "ids%5B%5D=#{i}"}.join('&')
+ ids = [1, 2].map {|i| "ids%5B%5D=#{i}"}.join('&')
assert_select 'a.icon-edit[href=?]', "/issues/bulk_edit?#{ids}", :text => 'Edit'
assert_select 'a.icon-copy[href=?]', "/issues/bulk_edit?copy=1{ids}", :text => 'Copy'
@@ -87,11 +83,8 @@ class ContextMenusControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
get :issues, :ids => [1, 2, 6]
assert_response :success
- assert_template 'context_menus/issues'
- assert_not_nil assigns(:issues)
- assert_equal [1, 2, 6], assigns(:issues).map(&:id).sort
- ids = assigns(:issues).map(&:id).sort.map {|i| "ids%5B%5D=#{i}"}.join('&')
+ ids = [1, 2, 6].map {|i| "ids%5B%5D=#{i}"}.join('&')
assert_select 'a.icon-edit[href=?]', "/issues/bulk_edit?#{ids}", :text => 'Edit'
assert_select 'a.icon-del[href=?]', "/issues?#{ids}", :text => 'Delete'
@@ -214,7 +207,6 @@ class ContextMenusControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
get :issues, :ids => [1]
assert_response :success
- assert_template 'context_menus/issues'
assert_select 'a[href=?]', '/issues/bulk_update?ids%5B%5D=1&issue%5Bassigned_to_id%5D=2', :text => / me /
end
@@ -225,9 +217,7 @@ class ContextMenusControllerTest < Redmine::ControllerTest
get :issues, :ids => [1, 4]
assert_response :success
- assert_template 'context_menus/issues'
- assert_include version, assigns(:versions)
assert_select 'a', :text => 'eCookbook - Shared'
end
@@ -245,7 +235,6 @@ class ContextMenusControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
get :time_entries, :ids => [1, 2]
assert_response :success
- assert_template 'context_menus/time_entries'
assert_select 'a:not(.disabled)', :text => 'Edit'
end
@@ -254,7 +243,6 @@ class ContextMenusControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
get :time_entries, :ids => [1]
assert_response :success
- assert_template 'context_menus/time_entries'
assert_select 'a:not(.disabled)', :text => 'Edit'
end
@@ -265,6 +253,7 @@ class ContextMenusControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
get :time_entries, :ids => [1, 2]
assert_response :success
+
assert_select "li.cf_#{field.id}" do
assert_select 'a[href="#"]', :text => "Field"
assert_select 'ul' do
@@ -284,7 +273,7 @@ class ContextMenusControllerTest < Redmine::ControllerTest
get :time_entries, :ids => ids
assert_response :success
- assert_template 'context_menus/time_entries'
+
assert_select 'a:not(.disabled)', :text => 'Edit'
end
@@ -294,7 +283,7 @@ class ContextMenusControllerTest < Redmine::ControllerTest
get :time_entries, :ids => [1, 2]
assert_response :success
- assert_template 'context_menus/time_entries'
+
assert_select 'a.disabled', :text => 'Edit'
end
end
diff --git a/test/functional/custom_field_enumerations_controller_test.rb b/test/functional/custom_field_enumerations_controller_test.rb
index c9fa39621..539600125 100644
--- a/test/functional/custom_field_enumerations_controller_test.rb
+++ b/test/functional/custom_field_enumerations_controller_test.rb
@@ -32,7 +32,10 @@ class CustomFieldEnumerationsControllerTest < Redmine::ControllerTest
def test_index
get :index, :custom_field_id => @field.id
assert_response :success
- assert_template 'index'
+
+ assert_select 'ul#custom_field_enumerations' do
+ assert_select 'li', 2
+ end
end
def test_create
@@ -91,8 +94,9 @@ class CustomFieldEnumerationsControllerTest < Redmine::ControllerTest
assert_no_difference 'CustomFieldEnumeration.count' do
delete :destroy, :custom_field_id => @field.id, :id => @foo.id
- assert_response 200
- assert_template 'destroy'
+ assert_response :success
+
+ assert_select 'select[name=?]', 'reassign_to_id'
end
end
diff --git a/test/functional/custom_fields_controller_test.rb b/test/functional/custom_fields_controller_test.rb
index b8d67b7b4..f13e7d0f8 100644
--- a/test/functional/custom_fields_controller_test.rb
+++ b/test/functional/custom_fields_controller_test.rb
@@ -38,27 +38,28 @@ class CustomFieldsControllerTest < Redmine::ControllerTest
def test_index
get :index
assert_response :success
- assert_template 'index'
+
+ assert_select 'table.custom_fields'
end
def test_new_without_type_should_render_select_type
get :new
assert_response :success
- assert_template 'select_type'
+
assert_select 'input[name=type]', CustomFieldsHelper::CUSTOM_FIELDS_TABS.size
assert_select 'input[name=type][checked=checked]', 1
end
def test_new_should_work_for_each_customized_class_and_format
custom_field_classes.each do |klass|
- Redmine::FieldFormat.available_formats.each do |format_name|
- get :new, :type => klass.name, :custom_field => {:field_format => format_name}
+ Redmine::FieldFormat.formats_for_custom_field_class(klass).each do |format|
+ get :new, :type => klass.name, :custom_field => {:field_format => format.name}
assert_response :success
- assert_template 'new'
- assert_kind_of klass, assigns(:custom_field)
- assert_equal format_name, assigns(:custom_field).format.name
+
assert_select 'form#custom_field_form' do
- assert_select 'select#custom_field_field_format[name=?]', 'custom_field[field_format]'
+ assert_select 'select[name=?]', 'custom_field[field_format]' do
+ assert_select 'option[value=?][selected=selected]', format.name
+ end
assert_select 'input[type=hidden][name=type][value=?]', klass.name
end
end
@@ -68,13 +69,16 @@ class CustomFieldsControllerTest < Redmine::ControllerTest
def test_new_should_have_string_default_format
get :new, :type => 'IssueCustomField'
assert_response :success
- assert_equal 'string', assigns(:custom_field).format.name
+
+ assert_select 'select[name=?]', 'custom_field[field_format]' do
+ assert_select 'option[value=?][selected=selected]', 'string'
+ end
end
def test_new_issue_custom_field
get :new, :type => 'IssueCustomField'
assert_response :success
- assert_template 'new'
+
assert_select 'form#custom_field_form' do
assert_select 'select#custom_field_field_format[name=?]', 'custom_field[field_format]' do
assert_select 'option[value=user]', :text => 'User'
@@ -89,7 +93,7 @@ class CustomFieldsControllerTest < Redmine::ControllerTest
def test_new_time_entry_custom_field_should_not_show_trackers_and_projects
get :new, :type => 'TimeEntryCustomField'
assert_response :success
- assert_template 'new'
+
assert_select 'form#custom_field_form' do
assert_select 'input[name=?]', 'custom_field[tracker_ids][]', 0
assert_select 'input[name=?]', 'custom_field[project_ids][]', 0
@@ -125,17 +129,16 @@ class CustomFieldsControllerTest < Redmine::ControllerTest
def test_new_js
xhr :get, :new, :type => 'IssueCustomField', :custom_field => {:field_format => 'list'}, :format => 'js'
assert_response :success
- assert_template 'new'
assert_equal 'text/javascript', response.content_type
- field = assigns(:custom_field)
- assert_equal 'list', field.field_format
+ assert_include '