mirror of
https://github.com/redmine/redmine.git
synced 2025-11-15 17:56:03 +01:00
Removes calls to #assert_template and #assigns in functional tests.
git-svn-id: http://svn.redmine.org/redmine/trunk@15695 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -46,7 +46,7 @@
|
||||
<% end %>
|
||||
|
||||
<% content_for :sidebar do %>
|
||||
<%= form_tag({}, :method => :get) do %>
|
||||
<%= form_tag({}, :method => :get, :id => 'activity_scope_form') do %>
|
||||
<h3><%= l(:label_activity) %></h3>
|
||||
<ul>
|
||||
<% @activity.event_types.each do |t| %>
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<% @topics.each do |topic| %>
|
||||
<tr class="message <%= cycle 'odd', 'even' %> <%= topic.sticky? ? 'sticky' : '' %> <%= topic.locked? ? 'locked' : '' %>">
|
||||
<tr id="message-<%= topic.id %>" class="message <%= cycle 'odd', 'even' %> <%= topic.sticky? ? 'sticky' : '' %> <%= topic.locked? ? 'locked' : '' %>">
|
||||
<td class="subject"><%= link_to topic.subject, board_message_path(@board, topic) %></td>
|
||||
<td class="author"><%= link_to_user(topic.author) %></td>
|
||||
<td class="created_on"><%= format_time(topic.created_on) %></td>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<% if @conflict_journals.present? %>
|
||||
<div class="conflict-details">
|
||||
<% @conflict_journals.sort_by(&:id).each do |journal| %>
|
||||
<div class="conflict-journal">
|
||||
<p><%= authoring journal.created_on, journal.user, :label => :label_updated_time_by %></p>
|
||||
<% if journal.details.any? %>
|
||||
<ul class="details">
|
||||
@@ -14,6 +15,7 @@
|
||||
<div class="wiki">
|
||||
<%= textilizable(journal, :notes) unless journal.notes.blank? %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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]'
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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 '<option selected=\"selected\" value=\"list\">List<\/option>', response.body
|
||||
end
|
||||
|
||||
def test_new_with_invalid_custom_field_class_should_render_select_type
|
||||
get :new, :type => 'UnknownCustomField'
|
||||
assert_response :success
|
||||
assert_template 'select_type'
|
||||
|
||||
assert_select 'input[type=radio][name=type]'
|
||||
end
|
||||
|
||||
def test_create_list_custom_field
|
||||
@@ -176,7 +179,7 @@ class CustomFieldsControllerTest < Redmine::ControllerTest
|
||||
post :create, :type => "IssueCustomField", :custom_field => {:name => ''}
|
||||
end
|
||||
assert_response :success
|
||||
assert_template 'new'
|
||||
assert_select_error /name cannot be blank/i
|
||||
end
|
||||
|
||||
def test_create_without_type_should_render_select_type
|
||||
@@ -184,13 +187,12 @@ class CustomFieldsControllerTest < Redmine::ControllerTest
|
||||
post :create, :custom_field => {:name => ''}
|
||||
end
|
||||
assert_response :success
|
||||
assert_template 'select_type'
|
||||
assert_select 'input[type=radio][name=type]'
|
||||
end
|
||||
|
||||
def test_edit
|
||||
get :edit, :id => 1
|
||||
assert_response :success
|
||||
assert_template 'edit'
|
||||
assert_select 'input[name=?][value=?]', 'custom_field[name]', 'Database'
|
||||
end
|
||||
|
||||
@@ -210,7 +212,7 @@ class CustomFieldsControllerTest < Redmine::ControllerTest
|
||||
def test_update_with_failure
|
||||
put :update, :id => 1, :custom_field => {:name => ''}
|
||||
assert_response :success
|
||||
assert_template 'edit'
|
||||
assert_select_error /name cannot be blank/i
|
||||
end
|
||||
|
||||
def test_destroy
|
||||
|
||||
@@ -33,8 +33,6 @@ class DocumentsControllerTest < Redmine::ControllerTest
|
||||
|
||||
get :index, :project_id => 'ecookbook'
|
||||
assert_response :success
|
||||
assert_template 'index'
|
||||
assert_not_nil assigns(:grouped)
|
||||
|
||||
# Default category selected in the new document form
|
||||
assert_select 'select[name=?]', 'document[category_id]' do
|
||||
@@ -74,7 +72,6 @@ LOREM
|
||||
|
||||
get :index, :project_id => 'ecookbook'
|
||||
assert_response :success
|
||||
assert_template 'index'
|
||||
|
||||
# should only truncate on new lines to avoid breaking wiki formatting
|
||||
assert_select '.wiki p', :text => (doc.description.split("\n").first + '...')
|
||||
@@ -84,14 +81,12 @@ LOREM
|
||||
def test_show
|
||||
get :show, :id => 1
|
||||
assert_response :success
|
||||
assert_template 'show'
|
||||
end
|
||||
|
||||
def test_new
|
||||
@request.session[:user_id] = 2
|
||||
get :new, :project_id => 1
|
||||
assert_response :success
|
||||
assert_template 'new'
|
||||
end
|
||||
|
||||
def test_create_with_one_attachment
|
||||
@@ -122,7 +117,7 @@ LOREM
|
||||
post :create, :project_id => 'ecookbook', :document => { :title => ''}
|
||||
end
|
||||
assert_response :success
|
||||
assert_template 'new'
|
||||
assert_select_error /title cannot be blank/i
|
||||
end
|
||||
|
||||
def test_create_non_default_category
|
||||
@@ -146,7 +141,6 @@ LOREM
|
||||
@request.session[:user_id] = 2
|
||||
get :edit, :id => 1
|
||||
assert_response :success
|
||||
assert_template 'edit'
|
||||
end
|
||||
|
||||
def test_update
|
||||
@@ -161,7 +155,7 @@ LOREM
|
||||
@request.session[:user_id] = 2
|
||||
put :update, :id => 1, :document => {:title => ''}
|
||||
assert_response :success
|
||||
assert_template 'edit'
|
||||
assert_select_error /title cannot be blank/i
|
||||
end
|
||||
|
||||
def test_destroy
|
||||
|
||||
@@ -28,7 +28,6 @@ class EmailAddressesControllerTest < Redmine::ControllerTest
|
||||
@request.session[:user_id] = 2
|
||||
get :index, :user_id => 2
|
||||
assert_response :success
|
||||
assert_template 'index'
|
||||
end
|
||||
|
||||
def test_index_with_additional_emails
|
||||
@@ -37,7 +36,6 @@ class EmailAddressesControllerTest < Redmine::ControllerTest
|
||||
|
||||
get :index, :user_id => 2
|
||||
assert_response :success
|
||||
assert_template 'index'
|
||||
assert_select '.email', :text => 'another@somenet.foo'
|
||||
end
|
||||
|
||||
@@ -47,7 +45,6 @@ class EmailAddressesControllerTest < Redmine::ControllerTest
|
||||
|
||||
xhr :get, :index, :user_id => 2
|
||||
assert_response :success
|
||||
assert_template 'index'
|
||||
assert_include 'another@somenet.foo', response.body
|
||||
end
|
||||
|
||||
@@ -55,7 +52,6 @@ class EmailAddressesControllerTest < Redmine::ControllerTest
|
||||
@request.session[:user_id] = 1
|
||||
get :index, :user_id => 2
|
||||
assert_response :success
|
||||
assert_template 'index'
|
||||
end
|
||||
|
||||
def test_index_by_another_user_should_be_denied
|
||||
@@ -88,7 +84,8 @@ class EmailAddressesControllerTest < Redmine::ControllerTest
|
||||
@request.session[:user_id] = 2
|
||||
assert_no_difference 'EmailAddress.count' do
|
||||
post :create, :user_id => 2, :email_address => {:address => 'invalid'}
|
||||
assert_response 200
|
||||
assert_response :success
|
||||
assert_select_error /email is invalid/i
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ class EnumerationsControllerTest < Redmine::ControllerTest
|
||||
def test_index
|
||||
get :index
|
||||
assert_response :success
|
||||
assert_template 'index'
|
||||
assert_select 'table.enumerations'
|
||||
end
|
||||
|
||||
def test_index_should_require_admin
|
||||
@@ -39,8 +39,7 @@ class EnumerationsControllerTest < Redmine::ControllerTest
|
||||
def test_new
|
||||
get :new, :type => 'IssuePriority'
|
||||
assert_response :success
|
||||
assert_template 'new'
|
||||
assert_kind_of IssuePriority, assigns(:enumeration)
|
||||
|
||||
assert_select 'input[name=?][value=?]', 'enumeration[type]', 'IssuePriority'
|
||||
assert_select 'input[name=?]', 'enumeration[name]'
|
||||
end
|
||||
@@ -64,13 +63,12 @@ class EnumerationsControllerTest < Redmine::ControllerTest
|
||||
post :create, :enumeration => {:type => 'IssuePriority', :name => ''}
|
||||
end
|
||||
assert_response :success
|
||||
assert_template 'new'
|
||||
assert_select_error /name cannot be blank/i
|
||||
end
|
||||
|
||||
def test_edit
|
||||
get :edit, :id => 6
|
||||
assert_response :success
|
||||
assert_template 'edit'
|
||||
assert_select 'input[name=?][value=?]', 'enumeration[name]', 'High'
|
||||
end
|
||||
|
||||
@@ -93,7 +91,7 @@ class EnumerationsControllerTest < Redmine::ControllerTest
|
||||
put :update, :id => 6, :enumeration => {:type => 'IssuePriority', :name => ''}
|
||||
end
|
||||
assert_response :success
|
||||
assert_template 'edit'
|
||||
assert_select_error /name cannot be blank/i
|
||||
end
|
||||
|
||||
def test_destroy_enumeration_not_in_use
|
||||
@@ -109,7 +107,7 @@ class EnumerationsControllerTest < Redmine::ControllerTest
|
||||
delete :destroy, :id => 4
|
||||
end
|
||||
assert_response :success
|
||||
assert_template 'destroy'
|
||||
|
||||
assert_not_nil Enumeration.find_by_id(4)
|
||||
assert_select 'select[name=reassign_to_id]' do
|
||||
assert_select 'option[value="6"]', :text => 'High'
|
||||
|
||||
@@ -39,8 +39,6 @@ class FilesControllerTest < Redmine::ControllerTest
|
||||
def test_index
|
||||
get :index, :project_id => 1
|
||||
assert_response :success
|
||||
assert_template 'index'
|
||||
assert_not_nil assigns(:containers)
|
||||
|
||||
# file attached to the project
|
||||
assert_select 'a[href=?]', '/attachments/download/8/project_file.zip', :text => 'project_file.zip'
|
||||
@@ -53,7 +51,6 @@ class FilesControllerTest < Redmine::ControllerTest
|
||||
@request.session[:user_id] = 2
|
||||
get :new, :project_id => 1
|
||||
assert_response :success
|
||||
assert_template 'new'
|
||||
|
||||
assert_select 'select[name=?]', 'version_id'
|
||||
end
|
||||
@@ -63,7 +60,6 @@ class FilesControllerTest < Redmine::ControllerTest
|
||||
@request.session[:user_id] = 2
|
||||
get :new, :project_id => 1
|
||||
assert_response :success
|
||||
assert_template 'new'
|
||||
|
||||
assert_select 'select[name=?]', 'version_id', 0
|
||||
end
|
||||
@@ -112,8 +108,7 @@ class FilesControllerTest < Redmine::ControllerTest
|
||||
|
||||
assert_no_difference 'Attachment.count' do
|
||||
post :create, :project_id => 1, :version_id => ''
|
||||
assert_response 200
|
||||
assert_template 'new'
|
||||
assert_response :success
|
||||
end
|
||||
assert_select 'div.error', 'File is invalid'
|
||||
end
|
||||
|
||||
@@ -32,8 +32,7 @@ class GanttsControllerTest < Redmine::ControllerTest
|
||||
i2.update_attribute(:due_date, 1.month.from_now)
|
||||
get :show, :project_id => 1
|
||||
assert_response :success
|
||||
assert_template 'gantts/show'
|
||||
assert_not_nil assigns(:gantt)
|
||||
|
||||
# Issue with start and due dates
|
||||
i = Issue.find(1)
|
||||
assert_not_nil i.due_date
|
||||
@@ -46,21 +45,19 @@ class GanttsControllerTest < Redmine::ControllerTest
|
||||
def test_gantt_at_minimal_zoom
|
||||
get :show, :project_id => 1, :zoom => 1
|
||||
assert_response :success
|
||||
assert_equal 1, assigns(:gantt).zoom
|
||||
assert_select 'input[type=hidden][name=zoom][value=?]', '1'
|
||||
end
|
||||
|
||||
def test_gantt_at_maximal_zoom
|
||||
get :show, :project_id => 1, :zoom => 4
|
||||
assert_response :success
|
||||
assert_equal 4, assigns(:gantt).zoom
|
||||
assert_select 'input[type=hidden][name=zoom][value=?]', '4'
|
||||
end
|
||||
|
||||
def test_gantt_should_work_without_issue_due_dates
|
||||
Issue.update_all("due_date = NULL")
|
||||
get :show, :project_id => 1
|
||||
assert_response :success
|
||||
assert_template 'gantts/show'
|
||||
assert_not_nil assigns(:gantt)
|
||||
end
|
||||
|
||||
def test_gantt_should_work_without_issue_and_version_due_dates
|
||||
@@ -68,23 +65,17 @@ class GanttsControllerTest < Redmine::ControllerTest
|
||||
Version.update_all("effective_date = NULL")
|
||||
get :show, :project_id => 1
|
||||
assert_response :success
|
||||
assert_template 'gantts/show'
|
||||
assert_not_nil assigns(:gantt)
|
||||
end
|
||||
|
||||
def test_gantt_should_work_cross_project
|
||||
get :show
|
||||
assert_response :success
|
||||
assert_template 'gantts/show'
|
||||
assert_not_nil assigns(:gantt)
|
||||
assert_not_nil assigns(:gantt).query
|
||||
assert_nil assigns(:gantt).project
|
||||
end
|
||||
|
||||
def test_gantt_should_not_disclose_private_projects
|
||||
get :show
|
||||
assert_response :success
|
||||
assert_template 'gantts/show'
|
||||
|
||||
assert_select 'a', :text => /eCookbook/
|
||||
# Root private project
|
||||
assert_select 'a', :text => /OnlineStore/, :count => 0
|
||||
@@ -101,9 +92,6 @@ class GanttsControllerTest < Redmine::ControllerTest
|
||||
get :show
|
||||
assert_response :success
|
||||
|
||||
relations = assigns(:gantt).relations
|
||||
assert_kind_of Hash, relations
|
||||
assert relations.present?
|
||||
assert_select 'div.task_todo[id=?][data-rels*=?]', "task-todo-issue-#{issue1.id}", issue2.id.to_s
|
||||
assert_select 'div.task_todo[id=?]:not([data-rels])', "task-todo-issue-#{issue2.id}"
|
||||
end
|
||||
@@ -113,7 +101,6 @@ class GanttsControllerTest < Redmine::ControllerTest
|
||||
assert_response :success
|
||||
assert_equal 'application/pdf', @response.content_type
|
||||
assert @response.body.starts_with?('%PDF')
|
||||
assert_not_nil assigns(:gantt)
|
||||
end
|
||||
|
||||
def test_gantt_should_export_to_pdf_cross_project
|
||||
@@ -121,7 +108,6 @@ class GanttsControllerTest < Redmine::ControllerTest
|
||||
assert_response :success
|
||||
assert_equal 'application/pdf', @response.content_type
|
||||
assert @response.body.starts_with?('%PDF')
|
||||
assert_not_nil assigns(:gantt)
|
||||
end
|
||||
|
||||
if Object.const_defined?(:Magick)
|
||||
|
||||
@@ -27,7 +27,7 @@ class GroupsControllerTest < Redmine::ControllerTest
|
||||
def test_index
|
||||
get :index
|
||||
assert_response :success
|
||||
assert_template 'index'
|
||||
assert_select 'table.groups'
|
||||
end
|
||||
|
||||
def test_index_should_show_user_count
|
||||
@@ -39,7 +39,6 @@ class GroupsControllerTest < Redmine::ControllerTest
|
||||
def test_show
|
||||
get :show, :id => 10
|
||||
assert_response :success
|
||||
assert_template 'show'
|
||||
end
|
||||
|
||||
def test_show_invalid_should_return_404
|
||||
@@ -50,7 +49,6 @@ class GroupsControllerTest < Redmine::ControllerTest
|
||||
def test_new
|
||||
get :new
|
||||
assert_response :success
|
||||
assert_template 'new'
|
||||
assert_select 'input[name=?]', 'group[name]'
|
||||
end
|
||||
|
||||
@@ -78,13 +76,12 @@ class GroupsControllerTest < Redmine::ControllerTest
|
||||
post :create, :group => {:name => ''}
|
||||
end
|
||||
assert_response :success
|
||||
assert_template 'new'
|
||||
assert_select_error /Name cannot be blank/i
|
||||
end
|
||||
|
||||
def test_edit
|
||||
get :edit, :id => 10
|
||||
assert_response :success
|
||||
assert_template 'edit'
|
||||
|
||||
assert_select 'div#tab-content-users'
|
||||
assert_select 'div#tab-content-memberships' do
|
||||
@@ -103,7 +100,7 @@ class GroupsControllerTest < Redmine::ControllerTest
|
||||
def test_update_with_failure
|
||||
put :update, :id => 10, :group => {:name => ''}
|
||||
assert_response :success
|
||||
assert_template 'edit'
|
||||
assert_select_error /Name cannot be blank/i
|
||||
end
|
||||
|
||||
def test_destroy
|
||||
@@ -116,7 +113,7 @@ class GroupsControllerTest < Redmine::ControllerTest
|
||||
def test_new_users
|
||||
get :new_users, :id => 10
|
||||
assert_response :success
|
||||
assert_template 'new_users'
|
||||
assert_select 'input[name=?]', 'user_search'
|
||||
end
|
||||
|
||||
def test_xhr_new_users
|
||||
@@ -135,7 +132,6 @@ class GroupsControllerTest < Redmine::ControllerTest
|
||||
assert_difference 'Group.find(10).users.count', 2 do
|
||||
xhr :post, :add_users, :id => 10, :user_ids => ['2', '3']
|
||||
assert_response :success
|
||||
assert_template 'add_users'
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
end
|
||||
assert_match /John Smith/, response.body
|
||||
@@ -151,7 +147,6 @@ class GroupsControllerTest < Redmine::ControllerTest
|
||||
assert_difference 'Group.find(10).users.count', -1 do
|
||||
xhr :delete, :remove_user, :id => 10, :user_id => '8'
|
||||
assert_response :success
|
||||
assert_template 'remove_user'
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
end
|
||||
end
|
||||
|
||||
@@ -44,7 +44,6 @@ class ImportsControllerTest < Redmine::ControllerTest
|
||||
def test_new_should_display_the_upload_form
|
||||
get :new
|
||||
assert_response :success
|
||||
assert_template 'new'
|
||||
assert_select 'input[name=?]', 'file'
|
||||
end
|
||||
|
||||
@@ -62,7 +61,10 @@ class ImportsControllerTest < Redmine::ControllerTest
|
||||
import = generate_import
|
||||
get :settings, :id => import.to_param
|
||||
assert_response :success
|
||||
assert_template 'settings'
|
||||
assert_select 'select[name=?]', 'import_settings[separator]'
|
||||
assert_select 'select[name=?]', 'import_settings[wrapper]'
|
||||
assert_select 'select[name=?]', 'import_settings[encoding]'
|
||||
assert_select 'select[name=?]', 'import_settings[date_format]'
|
||||
end
|
||||
|
||||
def test_post_settings_should_update_settings
|
||||
@@ -107,7 +109,6 @@ class ImportsControllerTest < Redmine::ControllerTest
|
||||
|
||||
get :mapping, :id => import.to_param
|
||||
assert_response :success
|
||||
assert_template 'mapping'
|
||||
|
||||
assert_select 'select[name=?]', 'import_settings[mapping][subject]' do
|
||||
assert_select 'option', 4
|
||||
@@ -139,7 +140,7 @@ class ImportsControllerTest < Redmine::ControllerTest
|
||||
|
||||
get :run, :id => import
|
||||
assert_response :success
|
||||
assert_template 'run'
|
||||
assert_select '#import-progress'
|
||||
end
|
||||
|
||||
def test_post_run_should_import_the_file
|
||||
@@ -183,7 +184,7 @@ class ImportsControllerTest < Redmine::ControllerTest
|
||||
|
||||
get :show, :id => import.to_param
|
||||
assert_response :success
|
||||
assert_template 'show'
|
||||
|
||||
assert_select 'ul#saved-items'
|
||||
assert_select 'ul#saved-items li', import.saved_items.count
|
||||
assert_select 'table#unsaved-items', 0
|
||||
@@ -197,7 +198,7 @@ class ImportsControllerTest < Redmine::ControllerTest
|
||||
|
||||
get :show, :id => import.to_param
|
||||
assert_response :success
|
||||
assert_template 'show'
|
||||
|
||||
assert_select 'table#unsaved-items'
|
||||
assert_select 'table#unsaved-items tbody tr', import.unsaved_items.count
|
||||
end
|
||||
|
||||
@@ -30,7 +30,6 @@ class IssueCategoriesControllerTest < Redmine::ControllerTest
|
||||
@request.session[:user_id] = 2 # manager
|
||||
get :new, :project_id => '1'
|
||||
assert_response :success
|
||||
assert_template 'new'
|
||||
assert_select 'input[name=?]', 'issue_category[name]'
|
||||
end
|
||||
|
||||
@@ -39,7 +38,6 @@ class IssueCategoriesControllerTest < Redmine::ControllerTest
|
||||
xhr :get, :new, :project_id => '1'
|
||||
|
||||
assert_response :success
|
||||
assert_template 'new'
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
end
|
||||
|
||||
@@ -58,7 +56,7 @@ class IssueCategoriesControllerTest < Redmine::ControllerTest
|
||||
@request.session[:user_id] = 2
|
||||
post :create, :project_id => '1', :issue_category => {:name => ''}
|
||||
assert_response :success
|
||||
assert_template 'new'
|
||||
assert_select_error /Name cannot be blank/i
|
||||
end
|
||||
|
||||
def test_create_from_issue_form
|
||||
@@ -70,7 +68,6 @@ class IssueCategoriesControllerTest < Redmine::ControllerTest
|
||||
assert_equal 'New category', category.name
|
||||
|
||||
assert_response :success
|
||||
assert_template 'create'
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
end
|
||||
|
||||
@@ -81,15 +78,14 @@ class IssueCategoriesControllerTest < Redmine::ControllerTest
|
||||
end
|
||||
|
||||
assert_response :success
|
||||
assert_template 'new'
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_include 'Name cannot be blank', response.body
|
||||
end
|
||||
|
||||
def test_edit
|
||||
@request.session[:user_id] = 2
|
||||
get :edit, :id => 2
|
||||
assert_response :success
|
||||
assert_template 'edit'
|
||||
assert_select 'input[name=?][value=?]', 'issue_category[name]', 'Recipes'
|
||||
end
|
||||
|
||||
@@ -104,7 +100,7 @@ class IssueCategoriesControllerTest < Redmine::ControllerTest
|
||||
def test_update_failure
|
||||
put :update, :id => 2, :issue_category => { :name => '' }
|
||||
assert_response :success
|
||||
assert_template 'edit'
|
||||
assert_select_error /Name cannot be blank/i
|
||||
end
|
||||
|
||||
def test_update_not_found
|
||||
@@ -121,8 +117,8 @@ class IssueCategoriesControllerTest < Redmine::ControllerTest
|
||||
def test_destroy_category_in_use
|
||||
delete :destroy, :id => 1
|
||||
assert_response :success
|
||||
assert_template 'destroy'
|
||||
assert_not_nil IssueCategory.find_by_id(1)
|
||||
assert_select 'select[name=?]', 'reassign_to_id'
|
||||
end
|
||||
|
||||
def test_destroy_category_in_use_with_reassignment
|
||||
|
||||
@@ -59,14 +59,13 @@ class IssueRelationsControllerTest < Redmine::ControllerTest
|
||||
assert_difference 'IssueRelation.count' do
|
||||
xhr :post, :create, :issue_id => 3, :relation => {:issue_to_id => '1', :relation_type => 'relates', :delay => ''}
|
||||
assert_response :success
|
||||
assert_template 'create'
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
end
|
||||
relation = IssueRelation.order('id DESC').first
|
||||
assert_equal 3, relation.issue_from_id
|
||||
assert_equal 1, relation.issue_to_id
|
||||
|
||||
assert_match /Bug #1/, response.body
|
||||
assert_include 'Bug #1', response.body
|
||||
end
|
||||
|
||||
def test_create_should_accept_id_with_hash
|
||||
@@ -104,7 +103,7 @@ class IssueRelationsControllerTest < Redmine::ControllerTest
|
||||
xhr :post, :create, :issue_id => issue2.id,
|
||||
:relation => {:issue_to_id => issue1.id, :relation_type => 'follows', :delay => ''}
|
||||
end
|
||||
assert_match /Followed issue/, response.body
|
||||
assert_include 'Followed issue', response.body
|
||||
end
|
||||
|
||||
def test_should_create_relations_with_visible_issues_only
|
||||
@@ -122,11 +121,9 @@ class IssueRelationsControllerTest < Redmine::ControllerTest
|
||||
xhr :post, :create, :issue_id => 3, :relation => {:issue_to_id => '999', :relation_type => 'relates', :delay => ''}
|
||||
|
||||
assert_response :success
|
||||
assert_template 'create'
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
end
|
||||
|
||||
assert_match /errorExplanation/, response.body
|
||||
assert_include 'Related issue cannot be blank', response.body
|
||||
end
|
||||
|
||||
def test_destroy
|
||||
@@ -152,9 +149,8 @@ class IssueRelationsControllerTest < Redmine::ControllerTest
|
||||
xhr :delete, :destroy, :id => '2'
|
||||
|
||||
assert_response :success
|
||||
assert_template 'destroy'
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_match /relation-2/, response.body
|
||||
assert_include 'relation-2', response.body
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -28,7 +28,7 @@ class IssueStatusesControllerTest < Redmine::ControllerTest
|
||||
def test_index
|
||||
get :index
|
||||
assert_response :success
|
||||
assert_template 'index'
|
||||
assert_select 'table.issue_statuses'
|
||||
end
|
||||
|
||||
def test_index_by_anonymous_should_redirect_to_login_form
|
||||
@@ -46,7 +46,7 @@ class IssueStatusesControllerTest < Redmine::ControllerTest
|
||||
def test_new
|
||||
get :new
|
||||
assert_response :success
|
||||
assert_template 'new'
|
||||
assert_select 'input[name=?]', 'issue_status[name]'
|
||||
end
|
||||
|
||||
def test_create
|
||||
@@ -61,14 +61,13 @@ class IssueStatusesControllerTest < Redmine::ControllerTest
|
||||
def test_create_with_failure
|
||||
post :create, :issue_status => {:name => ''}
|
||||
assert_response :success
|
||||
assert_template 'new'
|
||||
assert_select_error /name cannot be blank/i
|
||||
end
|
||||
|
||||
def test_edit
|
||||
get :edit, :id => '3'
|
||||
assert_response :success
|
||||
assert_template 'edit'
|
||||
assert_select 'input[name=?][value=?]', 'issue_status[name]', 'Resolved'
|
||||
end
|
||||
|
||||
def test_update
|
||||
@@ -81,7 +80,6 @@ class IssueStatusesControllerTest < Redmine::ControllerTest
|
||||
def test_update_with_failure
|
||||
put :update, :id => '3', :issue_status => {:name => ''}
|
||||
assert_response :success
|
||||
assert_template 'edit'
|
||||
assert_select_error /name cannot be blank/i
|
||||
end
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -68,7 +68,6 @@ class IssuesControllerTransactionTest < Redmine::ControllerTest
|
||||
end
|
||||
|
||||
assert_response :success
|
||||
assert_template 'edit'
|
||||
|
||||
assert_select 'div.conflict'
|
||||
assert_select 'input[name=?][value=?]', 'conflict_resolution', 'overwrite'
|
||||
@@ -101,7 +100,7 @@ class IssuesControllerTransactionTest < Redmine::ControllerTest
|
||||
end
|
||||
|
||||
assert_response :success
|
||||
assert_template 'edit'
|
||||
|
||||
attachment = Attachment.order('id DESC').first
|
||||
assert_select 'input[name=?][value=?]', 'attachments[p0][token]', attachment.token
|
||||
assert_select 'input[name=?][value=?]', 'attachments[p0][filename]', 'testfile.txt'
|
||||
@@ -117,6 +116,7 @@ class IssuesControllerTransactionTest < Redmine::ControllerTest
|
||||
:notes => '',
|
||||
:lock_version => (issue.lock_version - 1)
|
||||
}
|
||||
assert_response :success
|
||||
|
||||
assert_select 'div.conflict'
|
||||
assert_select 'input[name=conflict_resolution][value=overwrite]'
|
||||
@@ -134,11 +134,9 @@ class IssuesControllerTransactionTest < Redmine::ControllerTest
|
||||
:lock_version => 2
|
||||
},
|
||||
:last_journal_id => 1
|
||||
assert_response :success
|
||||
|
||||
assert_not_nil assigns(:conflict_journals)
|
||||
assert_equal 1, assigns(:conflict_journals).size
|
||||
assert_equal 2, assigns(:conflict_journals).first.id
|
||||
|
||||
assert_select '.conflict-journal', 1
|
||||
assert_select 'div.conflict', :text => /Some notes with Redmine links/
|
||||
end
|
||||
|
||||
@@ -152,9 +150,9 @@ class IssuesControllerTransactionTest < Redmine::ControllerTest
|
||||
:lock_version => 2
|
||||
},
|
||||
:last_journal_id => ''
|
||||
assert_response :success
|
||||
|
||||
assert_not_nil assigns(:conflict_journals)
|
||||
assert_equal 2, assigns(:conflict_journals).size
|
||||
assert_select '.conflict-journal', 2
|
||||
assert_select 'div.conflict', :text => /Some notes with Redmine links/
|
||||
assert_select 'div.conflict', :text => /Journal notes/
|
||||
end
|
||||
@@ -164,11 +162,13 @@ class IssuesControllerTransactionTest < Redmine::ControllerTest
|
||||
|
||||
@request.session[:user_id] = 2
|
||||
put :update, :id => 1, :issue => {:fixed_version_id => 4, :lock_version => 2}, :last_journal_id => ''
|
||||
assert_include journal, assigns(:conflict_journals)
|
||||
assert_response :success
|
||||
assert_select '.conflict-journal', :text => /Privates notes/
|
||||
|
||||
Role.find(1).remove_permission! :view_private_notes
|
||||
put :update, :id => 1, :issue => {:fixed_version_id => 4, :lock_version => 2}, :last_journal_id => ''
|
||||
assert_not_include journal, assigns(:conflict_journals)
|
||||
assert_response :success
|
||||
assert_select '.conflict-journal', :text => /Privates notes/, :count => 0
|
||||
end
|
||||
|
||||
def test_update_stale_issue_with_overwrite_conflict_resolution_should_update
|
||||
|
||||
@@ -213,14 +213,14 @@ class IssuesCustomFieldsVisibilityTest < Redmine::ControllerTest
|
||||
|
||||
get :index, :sort => "cf_#{@field2.id}"
|
||||
# ValueB is not visible to user and ignored while sorting
|
||||
assert_equal %w(ValueB ValueA ValueC), assigns(:issues).map{|i| i.custom_field_value(@field2)}
|
||||
assert_equal %w(ValueB ValueA ValueC), issues_in_list.map{|i| i.custom_field_value(@field2)}
|
||||
|
||||
get :index, :set_filter => '1', "cf_#{@field2.id}" => '*'
|
||||
assert_equal %w(ValueA ValueC), assigns(:issues).map{|i| i.custom_field_value(@field2)}
|
||||
assert_equal %w(ValueA ValueC), issues_in_list.map{|i| i.custom_field_value(@field2)}
|
||||
|
||||
CustomField.update_all(:field_format => 'list')
|
||||
get :index, :group => "cf_#{@field2.id}"
|
||||
assert_equal %w(ValueA ValueC), assigns(:issues).map{|i| i.custom_field_value(@field2)}
|
||||
assert_equal %w(ValueA ValueC), issues_in_list.map{|i| i.custom_field_value(@field2)}
|
||||
end
|
||||
|
||||
def test_create_should_send_notifications_according_custom_fields_visibility
|
||||
|
||||
@@ -28,7 +28,6 @@ class JournalsControllerTest < Redmine::ControllerTest
|
||||
def test_index
|
||||
get :index, :project_id => 1
|
||||
assert_response :success
|
||||
assert_not_nil assigns(:journals)
|
||||
assert_equal 'application/atom+xml', @response.content_type
|
||||
end
|
||||
|
||||
@@ -43,12 +42,12 @@ class JournalsControllerTest < Redmine::ControllerTest
|
||||
|
||||
get :index, :project_id => 1
|
||||
assert_response :success
|
||||
assert_include journal, assigns(:journals)
|
||||
assert_select 'entry>id', :text => "http://test.host/issues/2?journal_id=#{journal.id}"
|
||||
|
||||
Role.find(1).remove_permission! :view_private_notes
|
||||
get :index, :project_id => 1
|
||||
assert_response :success
|
||||
assert_not_include journal, assigns(:journals)
|
||||
assert_select 'entry>id', :text => "http://test.host/issues/2?journal_id=#{journal.id}", :count => 0
|
||||
end
|
||||
|
||||
def test_index_should_show_visible_custom_fields_only
|
||||
@@ -94,7 +93,6 @@ class JournalsControllerTest < Redmine::ControllerTest
|
||||
def test_diff_for_description_change
|
||||
get :diff, :id => 3, :detail_id => 4
|
||||
assert_response :success
|
||||
assert_template 'diff'
|
||||
|
||||
assert_select 'span.diff_out', :text => /removed/
|
||||
assert_select 'span.diff_in', :text => /added/
|
||||
@@ -108,7 +106,6 @@ class JournalsControllerTest < Redmine::ControllerTest
|
||||
|
||||
get :diff, :id => journal.id, :detail_id => detail.id
|
||||
assert_response :success
|
||||
assert_template 'diff'
|
||||
|
||||
assert_select 'span.diff_out', :text => /Foo/
|
||||
assert_select 'span.diff_in', :text => /Bar/
|
||||
@@ -127,7 +124,6 @@ class JournalsControllerTest < Redmine::ControllerTest
|
||||
def test_diff_should_default_to_description_diff
|
||||
get :diff, :id => 3
|
||||
assert_response :success
|
||||
assert_template 'diff'
|
||||
|
||||
assert_select 'span.diff_out', :text => /removed/
|
||||
assert_select 'span.diff_in', :text => /added/
|
||||
@@ -137,7 +133,7 @@ class JournalsControllerTest < Redmine::ControllerTest
|
||||
@request.session[:user_id] = 2
|
||||
xhr :get, :new, :id => 6
|
||||
assert_response :success
|
||||
assert_template 'new'
|
||||
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_include '> This is an issue', response.body
|
||||
end
|
||||
@@ -152,7 +148,6 @@ class JournalsControllerTest < Redmine::ControllerTest
|
||||
@request.session[:user_id] = 2
|
||||
xhr :get, :new, :id => 6, :journal_id => 4
|
||||
assert_response :success
|
||||
assert_template 'new'
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_include '> A comment with a private version', response.body
|
||||
end
|
||||
@@ -163,7 +158,6 @@ class JournalsControllerTest < Redmine::ControllerTest
|
||||
|
||||
xhr :get, :new, :id => 2, :journal_id => journal.id
|
||||
assert_response :success
|
||||
assert_template 'new'
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_include '> Privates notes', response.body
|
||||
|
||||
@@ -176,7 +170,6 @@ class JournalsControllerTest < Redmine::ControllerTest
|
||||
@request.session[:user_id] = 1
|
||||
xhr :get, :edit, :id => 2
|
||||
assert_response :success
|
||||
assert_template 'edit'
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_include 'textarea', response.body
|
||||
end
|
||||
@@ -188,7 +181,6 @@ class JournalsControllerTest < Redmine::ControllerTest
|
||||
|
||||
xhr :get, :edit, :id => journal.id
|
||||
assert_response :success
|
||||
assert_template 'edit'
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_include 'textarea', response.body
|
||||
|
||||
@@ -201,7 +193,6 @@ class JournalsControllerTest < Redmine::ControllerTest
|
||||
@request.session[:user_id] = 1
|
||||
xhr :post, :update, :id => 2, :journal => {:notes => 'Updated notes'}
|
||||
assert_response :success
|
||||
assert_template 'update'
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'Updated notes', Journal.find(2).notes
|
||||
assert_include 'journal-2-notes', response.body
|
||||
@@ -211,7 +202,6 @@ class JournalsControllerTest < Redmine::ControllerTest
|
||||
@request.session[:user_id] = 1
|
||||
xhr :post, :update, :id => 2, :journal => {:private_notes => '1'}
|
||||
assert_response :success
|
||||
assert_template 'update'
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal true, Journal.find(2).private_notes
|
||||
assert_include 'change-2', response.body
|
||||
@@ -223,7 +213,6 @@ class JournalsControllerTest < Redmine::ControllerTest
|
||||
@request.session[:user_id] = 1
|
||||
xhr :post, :update, :id => 2, :journal => {:private_notes => '0'}
|
||||
assert_response :success
|
||||
assert_template 'update'
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal false, Journal.find(2).private_notes
|
||||
assert_include 'change-2', response.body
|
||||
@@ -246,7 +235,6 @@ class JournalsControllerTest < Redmine::ControllerTest
|
||||
assert_difference 'Journal.count', -1 do
|
||||
xhr :post, :update, :id => 2, :journal => {:notes => ''}
|
||||
assert_response :success
|
||||
assert_template 'update'
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
end
|
||||
assert_nil Journal.find_by_id(2)
|
||||
|
||||
@@ -93,7 +93,6 @@ class MembersControllerTest < Redmine::ControllerTest
|
||||
assert_difference 'Member.count', 3 do
|
||||
xhr :post, :create, :project_id => 1, :membership => {:role_ids => [1], :user_ids => [7, 8, 9]}
|
||||
assert_response :success
|
||||
assert_template 'create'
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
end
|
||||
assert User.find(7).member_of?(Project.find(1))
|
||||
@@ -106,7 +105,6 @@ class MembersControllerTest < Redmine::ControllerTest
|
||||
assert_no_difference 'Member.count' do
|
||||
xhr :post, :create, :project_id => 1, :membership => {:role_ids => [], :user_ids => [7, 8, 9]}
|
||||
assert_response :success
|
||||
assert_template 'create'
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
end
|
||||
assert_match /alert/, response.body, "Alert message not sent"
|
||||
@@ -143,7 +141,6 @@ class MembersControllerTest < Redmine::ControllerTest
|
||||
assert_no_difference 'Member.count' do
|
||||
xhr :put, :update, :id => 2, :membership => {:role_ids => [1], :user_id => 3}
|
||||
assert_response :success
|
||||
assert_template 'update'
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
end
|
||||
member = Member.find(2)
|
||||
@@ -186,7 +183,6 @@ class MembersControllerTest < Redmine::ControllerTest
|
||||
assert_difference 'Member.count', -1 do
|
||||
xhr :delete, :destroy, :id => 2
|
||||
assert_response :success
|
||||
assert_template 'destroy'
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
end
|
||||
assert_nil Member.find_by_id(2)
|
||||
|
||||
@@ -282,6 +282,29 @@ module Redmine
|
||||
end
|
||||
|
||||
class ControllerTest < ActionController::TestCase
|
||||
# Returns the issues that are displayed in the list in the same order
|
||||
def issues_in_list
|
||||
ids = css_select('tr.issue td.id').map(&:text).map(&:to_i)
|
||||
Issue.where(:id => ids).sort_by {|issue| ids.index(issue.id)}
|
||||
end
|
||||
|
||||
# Return the columns that are displayed in the list
|
||||
def columns_in_issues_list
|
||||
css_select('table.issues thead th:not(.checkbox)').map(&:text)
|
||||
end
|
||||
|
||||
# Verifies that the query filters match the expected filters
|
||||
def assert_query_filters(expected_filters)
|
||||
response.body =~ /initFilters\(\);\s*((addFilter\(.+\);\s*)*)/
|
||||
filter_init = $1.to_s
|
||||
|
||||
expected_filters.each do |field, operator, values|
|
||||
s = "addFilter(#{field.to_json}, #{operator.to_json}, #{Array(values).to_json});"
|
||||
assert_include s, filter_init
|
||||
end
|
||||
assert_equal expected_filters.size, filter_init.scan("addFilter").size, "filters counts don't match"
|
||||
end
|
||||
|
||||
def process(method, path, parameters={}, session={}, flash={})
|
||||
if parameters.key?(:params) || parameters.key?(:session)
|
||||
raise ArgumentError if session.present?
|
||||
|
||||
Reference in New Issue
Block a user