summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2017-07-23 11:26:04 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2017-07-23 11:26:04 +0000
commitd74f0bfd5c53962e332c2dd4d30dafaa1105b92b (patch)
treef3eaf66d67c3a87fb34340561bf188d364de623c /test
parent41bb302594b48152b87c92f196c915f499093bbf (diff)
downloadredmine-d74f0bfd5c53962e332c2dd4d30dafaa1105b92b.tar.gz
redmine-d74f0bfd5c53962e332c2dd4d30dafaa1105b92b.zip
Merged rails-5.1 branch (#23630).
git-svn-id: http://svn.redmine.org/redmine/trunk@16859 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/extra/redmine_pm/test_case.rb2
-rw-r--r--test/functional/issues_controller_test.rb4
-rw-r--r--test/functional/issues_controller_transaction_test.rb2
-rw-r--r--test/functional/project_enumerations_controller_test.rb2
-rw-r--r--test/functional/repositories_bazaar_controller_test.rb3
-rw-r--r--test/functional/repositories_controller_test.rb3
-rw-r--r--test/functional/repositories_cvs_controller_test.rb3
-rw-r--r--test/functional/repositories_darcs_controller_test.rb3
-rw-r--r--test/functional/repositories_filesystem_controller_test.rb3
-rw-r--r--test/functional/repositories_git_controller_test.rb3
-rw-r--r--test/functional/repositories_mercurial_controller_test.rb3
-rw-r--r--test/functional/repositories_subversion_controller_test.rb3
-rw-r--r--test/functional/users_controller_test.rb6
-rw-r--r--test/functional/welcome_controller_test.rb7
-rw-r--r--test/integration/api_test/attachments_test.rb2
-rw-r--r--test/integration/application_test.rb4
-rw-r--r--test/integration/lib/redmine/field_format/attachment_format_test.rb2
-rw-r--r--test/integration/routing/attachments_test.rb3
-rw-r--r--test/integration/routing/repositories_test.rb94
-rw-r--r--test/integration/routing/welcome_test.rb2
-rw-r--r--test/integration/welcome_test.rb28
-rw-r--r--test/test_helper.rb40
-rw-r--r--test/ui/base.rb2
-rw-r--r--test/unit/attachment_test.rb4
-rw-r--r--test/unit/attachment_transaction_test.rb2
-rw-r--r--test/unit/issue_nested_set_concurrency_test.rb2
-rw-r--r--test/unit/issue_test.rb4
-rw-r--r--test/unit/issue_transaction_test.rb2
-rw-r--r--test/unit/lib/redmine/views/builders/json_test.rb2
-rw-r--r--test/unit/lib/redmine/views/builders/xml_test.rb2
-rw-r--r--test/unit/project_nested_set_concurrency_test.rb2
31 files changed, 123 insertions, 121 deletions
diff --git a/test/extra/redmine_pm/test_case.rb b/test/extra/redmine_pm/test_case.rb
index 163a15055..1235c2a70 100644
--- a/test/extra/redmine_pm/test_case.rb
+++ b/test/extra/redmine_pm/test_case.rb
@@ -23,7 +23,7 @@ module RedminePmTest
# Cannot use transactional fixtures here: database
# will be accessed from Redmine.pm with its own connection
- self.use_transactional_fixtures = false
+ self.use_transactional_tests = false
def test_dummy
end
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb
index 02cdf85e3..34d353263 100644
--- a/test/functional/issues_controller_test.rb
+++ b/test/functional/issues_controller_test.rb
@@ -6426,7 +6426,7 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 1
with_settings :gravatar_enabled => '1' do
- get :show, :id => issue.id
+ get :show, :params => {:id => issue.id}
assert_select 'div.gravatar-with-child' do
assert_select 'img.gravatar', 1
end
@@ -6440,7 +6440,7 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 1
with_settings :gravatar_enabled => '1' do
- get :show, :id => issue.id
+ get :show, :params => {:id => issue.id}
assert_select 'div.gravatar-with-child' do
assert_select 'img.gravatar', 2
assert_select 'img.gravatar-child', 1
diff --git a/test/functional/issues_controller_transaction_test.rb b/test/functional/issues_controller_transaction_test.rb
index 67c9d0f78..28ac868b3 100644
--- a/test/functional/issues_controller_transaction_test.rb
+++ b/test/functional/issues_controller_transaction_test.rb
@@ -44,7 +44,7 @@ class IssuesControllerTransactionTest < Redmine::ControllerTest
:journal_details,
:queries
- self.use_transactional_fixtures = false
+ self.use_transactional_tests = false
def setup
User.current = nil
diff --git a/test/functional/project_enumerations_controller_test.rb b/test/functional/project_enumerations_controller_test.rb
index f98d85965..2d87b13a7 100644
--- a/test/functional/project_enumerations_controller_test.rb
+++ b/test/functional/project_enumerations_controller_test.rb
@@ -29,7 +29,7 @@ class ProjectEnumerationsControllerTest < Redmine::ControllerTest
:custom_fields_trackers, :custom_values,
:time_entries
- self.use_transactional_fixtures = false
+ self.use_transactional_tests = false
def setup
@request.session[:user_id] = nil
diff --git a/test/functional/repositories_bazaar_controller_test.rb b/test/functional/repositories_bazaar_controller_test.rb
index ebfc35fd8..ee9021abd 100644
--- a/test/functional/repositories_bazaar_controller_test.rb
+++ b/test/functional/repositories_bazaar_controller_test.rb
@@ -17,7 +17,7 @@
require File.expand_path('../../test_helper', __FILE__)
-class RepositoriesBazaarControllerTest < Redmine::ControllerTest
+class RepositoriesBazaarControllerTest < Redmine::RepositoryControllerTest
tests RepositoriesController
fixtures :projects, :users, :email_addresses, :roles, :members, :member_roles,
@@ -29,6 +29,7 @@ class RepositoriesBazaarControllerTest < Redmine::ControllerTest
CHAR_1_UTF8_HEX = "\xc3\x9c".dup.force_encoding('UTF-8')
def setup
+ super
User.current = nil
@project = Project.find(PRJ_ID)
@repository = Repository::Bazaar.create(
diff --git a/test/functional/repositories_controller_test.rb b/test/functional/repositories_controller_test.rb
index d51efc5be..e76a2f8c4 100644
--- a/test/functional/repositories_controller_test.rb
+++ b/test/functional/repositories_controller_test.rb
@@ -17,12 +17,13 @@
require File.expand_path('../../test_helper', __FILE__)
-class RepositoriesControllerTest < Redmine::ControllerTest
+class RepositoriesControllerTest < Redmine::RepositoryControllerTest
fixtures :projects, :users, :email_addresses, :roles, :members, :member_roles, :enabled_modules,
:repositories, :issues, :issue_statuses, :changesets, :changes,
:issue_categories, :enumerations, :custom_fields, :custom_values, :trackers
def setup
+ super
User.current = nil
end
diff --git a/test/functional/repositories_cvs_controller_test.rb b/test/functional/repositories_cvs_controller_test.rb
index b2429e441..c9f26719a 100644
--- a/test/functional/repositories_cvs_controller_test.rb
+++ b/test/functional/repositories_cvs_controller_test.rb
@@ -17,7 +17,7 @@
require File.expand_path('../../test_helper', __FILE__)
-class RepositoriesCvsControllerTest < Redmine::ControllerTest
+class RepositoriesCvsControllerTest < Redmine::RepositoryControllerTest
tests RepositoriesController
fixtures :projects, :users, :email_addresses, :roles, :members, :member_roles,
@@ -31,6 +31,7 @@ class RepositoriesCvsControllerTest < Redmine::ControllerTest
NUM_REV = 7
def setup
+ super
Setting.default_language = 'en'
User.current = nil
diff --git a/test/functional/repositories_darcs_controller_test.rb b/test/functional/repositories_darcs_controller_test.rb
index dc2800f85..7b71da4dc 100644
--- a/test/functional/repositories_darcs_controller_test.rb
+++ b/test/functional/repositories_darcs_controller_test.rb
@@ -17,7 +17,7 @@
require File.expand_path('../../test_helper', __FILE__)
-class RepositoriesDarcsControllerTest < Redmine::ControllerTest
+class RepositoriesDarcsControllerTest < Redmine::RepositoryControllerTest
tests RepositoriesController
fixtures :projects, :users, :email_addresses, :roles, :members, :member_roles,
@@ -28,6 +28,7 @@ class RepositoriesDarcsControllerTest < Redmine::ControllerTest
NUM_REV = 6
def setup
+ super
User.current = nil
@project = Project.find(PRJ_ID)
@repository = Repository::Darcs.create(
diff --git a/test/functional/repositories_filesystem_controller_test.rb b/test/functional/repositories_filesystem_controller_test.rb
index 8cd12be20..1dd133c58 100644
--- a/test/functional/repositories_filesystem_controller_test.rb
+++ b/test/functional/repositories_filesystem_controller_test.rb
@@ -17,7 +17,7 @@
require File.expand_path('../../test_helper', __FILE__)
-class RepositoriesFilesystemControllerTest < Redmine::ControllerTest
+class RepositoriesFilesystemControllerTest < Redmine::RepositoryControllerTest
tests RepositoriesController
fixtures :projects, :users, :email_addresses, :roles, :members, :member_roles,
@@ -27,6 +27,7 @@ class RepositoriesFilesystemControllerTest < Redmine::ControllerTest
PRJ_ID = 3
def setup
+ super
@ruby19_non_utf8_pass = Encoding.default_external.to_s != 'UTF-8'
User.current = nil
Setting.enabled_scm << 'Filesystem' unless Setting.enabled_scm.include?('Filesystem')
diff --git a/test/functional/repositories_git_controller_test.rb b/test/functional/repositories_git_controller_test.rb
index c7cd7bce2..f1261fa5c 100644
--- a/test/functional/repositories_git_controller_test.rb
+++ b/test/functional/repositories_git_controller_test.rb
@@ -17,7 +17,7 @@
require File.expand_path('../../test_helper', __FILE__)
-class RepositoriesGitControllerTest < Redmine::ControllerTest
+class RepositoriesGitControllerTest < Redmine::RepositoryControllerTest
tests RepositoriesController
fixtures :projects, :users, :email_addresses, :roles, :members, :member_roles,
@@ -39,6 +39,7 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest
JRUBY_SKIP_STR = "TODO: This test fails in JRuby"
def setup
+ super
@ruby19_non_utf8_pass = Encoding.default_external.to_s != 'UTF-8'
User.current = nil
diff --git a/test/functional/repositories_mercurial_controller_test.rb b/test/functional/repositories_mercurial_controller_test.rb
index aab018d60..7b7e98a14 100644
--- a/test/functional/repositories_mercurial_controller_test.rb
+++ b/test/functional/repositories_mercurial_controller_test.rb
@@ -17,7 +17,7 @@
require File.expand_path('../../test_helper', __FILE__)
-class RepositoriesMercurialControllerTest < Redmine::ControllerTest
+class RepositoriesMercurialControllerTest < Redmine::RepositoryControllerTest
tests RepositoriesController
fixtures :projects, :users, :email_addresses, :roles, :members, :member_roles,
@@ -31,6 +31,7 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest
ruby19_non_utf8_pass = Encoding.default_external.to_s != 'UTF-8'
def setup
+ super
User.current = nil
@project = Project.find(PRJ_ID)
@repository = Repository::Mercurial.create(
diff --git a/test/functional/repositories_subversion_controller_test.rb b/test/functional/repositories_subversion_controller_test.rb
index ef8fcb777..f8f4b8f9d 100644
--- a/test/functional/repositories_subversion_controller_test.rb
+++ b/test/functional/repositories_subversion_controller_test.rb
@@ -17,7 +17,7 @@
require File.expand_path('../../test_helper', __FILE__)
-class RepositoriesSubversionControllerTest < Redmine::ControllerTest
+class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest
tests RepositoriesController
fixtures :projects, :users, :email_addresses, :roles, :members, :member_roles, :enabled_modules,
@@ -28,6 +28,7 @@ class RepositoriesSubversionControllerTest < Redmine::ControllerTest
NUM_REV = 11
def setup
+ super
Setting.default_language = 'en'
User.current = nil
diff --git a/test/functional/users_controller_test.rb b/test/functional/users_controller_test.rb
index f5eb79a3f..42dae0f50 100644
--- a/test/functional/users_controller_test.rb
+++ b/test/functional/users_controller_test.rb
@@ -259,7 +259,7 @@ class UsersControllerTest < Redmine::ControllerTest
def test_create_with_failure
assert_no_difference 'User.count' do
- post :create, :params => {:user => {}}
+ post :create, :params => {:user => {:login => 'foo'}}
end
assert_response :success
assert_select_error /Email cannot be blank/
@@ -268,7 +268,9 @@ class UsersControllerTest < Redmine::ControllerTest
def test_create_with_failure_sould_preserve_preference
assert_no_difference 'User.count' do
post :create, :params => {
- :user => {},
+ :user => {
+ :login => 'foo'
+ },
:pref => {
'no_self_notified' => '1',
'hide_mail' => '1',
diff --git a/test/functional/welcome_controller_test.rb b/test/functional/welcome_controller_test.rb
index 710eb9ace..38533edac 100644
--- a/test/functional/welcome_controller_test.rb
+++ b/test/functional/welcome_controller_test.rb
@@ -77,13 +77,6 @@ class WelcomeControllerTest < Redmine::ControllerTest
end
end
- def test_robots
- get :robots
- assert_response :success
- assert_equal 'text/plain', @response.content_type
- assert @response.body.match(%r{^Disallow: /projects/ecookbook/issues\r?$})
- end
-
def test_warn_on_leaving_unsaved_turn_on
user = User.find(2)
user.pref.warn_on_leaving_unsaved = '1'
diff --git a/test/integration/api_test/attachments_test.rb b/test/integration/api_test/attachments_test.rb
index 0eda0b073..4983a3d64 100644
--- a/test/integration/api_test/attachments_test.rb
+++ b/test/integration/api_test/attachments_test.rb
@@ -71,7 +71,7 @@ class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base
test "GET /attachments/download/:id/:filename should deny access without credentials" do
get '/attachments/download/7/archive.zip'
- assert_response 302
+ assert_response 401
set_tmp_attachments_directory
end
diff --git a/test/integration/application_test.rb b/test/integration/application_test.rb
index 2b572a238..7990b4265 100644
--- a/test/integration/application_test.rb
+++ b/test/integration/application_test.rb
@@ -63,9 +63,9 @@ class ApplicationTest < Redmine::IntegrationTest
assert_nil session[:user_id]
end
- def test_missing_template_should_respond_with_404
+ def test_missing_template_should_respond_with_4xx
get '/login.png'
- assert_response 404
+ assert_response 406
end
def test_invalid_token_should_call_custom_handler
diff --git a/test/integration/lib/redmine/field_format/attachment_format_test.rb b/test/integration/lib/redmine/field_format/attachment_format_test.rb
index 2510b7c64..759a73b17 100644
--- a/test/integration/lib/redmine/field_format/attachment_format_test.rb
+++ b/test/integration/lib/redmine/field_format/attachment_format_test.rb
@@ -85,7 +85,7 @@ class AttachmentFieldFormatTest < Redmine::IntegrationTest
# preview the attachment
get link.attr('href')
assert_response :success
- assert_template :file
+ assert_select 'h2', :text => 'testfile.txt'
end
def test_create_without_attachment
diff --git a/test/integration/routing/attachments_test.rb b/test/integration/routing/attachments_test.rb
index cf417cee5..096591f2d 100644
--- a/test/integration/routing/attachments_test.rb
+++ b/test/integration/routing/attachments_test.rb
@@ -20,7 +20,8 @@ require File.expand_path('../../../test_helper', __FILE__)
class RoutingAttachmentsTest < Redmine::RoutingTest
def test_attachments
should_route 'GET /attachments/1' => 'attachments#show', :id => '1'
- should_route 'GET /attachments/1/filename.ext' => 'attachments#show', :id => '1', :filename => 'filename.ext'
+ should_route 'GET /attachments/1/filename.ext' => 'attachments#show', :id => '1', :filename => 'filename.ext', :format => 'html'
+ should_route 'GET /attachments/1/filename.txt' => 'attachments#show', :id => '1', :filename => 'filename.txt', :format => 'html'
should_route 'GET /attachments/download/1' => 'attachments#download', :id => '1'
should_route 'GET /attachments/download/1/filename.ext' => 'attachments#download', :id => '1', :filename => 'filename.ext'
diff --git a/test/integration/routing/repositories_test.rb b/test/integration/routing/repositories_test.rb
index e0b9d9e6a..337686169 100644
--- a/test/integration/routing/repositories_test.rb
+++ b/test/integration/routing/repositories_test.rb
@@ -18,15 +18,15 @@
require File.expand_path('../../../test_helper', __FILE__)
class RoutingRepositoriesTest < Redmine::RoutingTest
+
def setup
- @path_hash = repository_path_hash(%w[path to file.c])
- assert_equal "path/to/file.c", @path_hash[:path]
- assert_equal "path/to/file.c", @path_hash[:param]
+ @paths = ['path/to/file.c', 'path/to/index.html']
end
def test_repositories_resources
should_route 'GET /projects/foo/repositories/new' => 'repositories#new', :project_id => 'foo'
should_route 'POST /projects/foo/repositories' => 'repositories#create', :project_id => 'foo'
+
should_route 'GET /repositories/1/edit' => 'repositories#edit', :id => '1'
should_route 'PUT /repositories/1' => 'repositories#update', :id => '1'
should_route 'DELETE /repositories/1' => 'repositories#destroy', :id => '1'
@@ -53,19 +53,15 @@ class RoutingRepositoriesTest < Redmine::RoutingTest
should_route 'GET /projects/foo/repository/revisions.atom' => 'repositories#revisions', :id => 'foo', :format => 'atom'
should_route 'GET /projects/foo/repository/revisions/2457' => 'repositories#revision', :id => 'foo', :rev => '2457'
- should_route 'GET /projects/foo/repository/revisions/2457/show' => 'repositories#show', :id => 'foo', :rev => '2457'
- should_route 'GET /projects/foo/repository/revisions/2457/diff' => 'repositories#diff', :id => 'foo', :rev => '2457'
-
- should_route "GET /projects/foo/repository/revisions/2457/show/#{@path_hash[:path]}" => 'repositories#show',
- :id => 'foo', :rev => '2457', :path => @path_hash[:param]
- should_route "GET /projects/foo/repository/revisions/2457/diff/#{@path_hash[:path]}" => 'repositories#diff',
- :id => 'foo', :rev => '2457', :path => @path_hash[:param]
- should_route "GET /projects/foo/repository/revisions/2457/entry/#{@path_hash[:path]}" => 'repositories#entry',
- :id => 'foo', :rev => '2457', :path => @path_hash[:param]
- should_route "GET /projects/foo/repository/revisions/2457/raw/#{@path_hash[:path]}" => 'repositories#raw',
- :id => 'foo', :rev => '2457', :path => @path_hash[:param]
- should_route "GET /projects/foo/repository/revisions/2457/annotate/#{@path_hash[:path]}" => 'repositories#annotate',
- :id => 'foo', :rev => '2457', :path => @path_hash[:param]
+ should_route 'GET /projects/foo/repository/revisions/2457/show' => 'repositories#show', :id => 'foo', :rev => '2457', :format => 'html'
+ should_route 'GET /projects/foo/repository/revisions/2457/diff' => 'repositories#diff', :id => 'foo', :rev => '2457', :format => 'html'
+
+ %w(show diff entry raw annotate).each do |action|
+ @paths.each do |path|
+ should_route "GET /projects/foo/repository/revisions/2457/#{action}/#{path}" => "repositories##{action}",
+ :id => 'foo', :rev => '2457', :path => path, :format => 'html'
+ end
+ end
end
def test_repositories_revisions_with_repository_id
@@ -74,53 +70,37 @@ class RoutingRepositoriesTest < Redmine::RoutingTest
should_route 'GET /projects/foo/repository/foo/revisions.atom' => 'repositories#revisions', :id => 'foo', :repository_id => 'foo', :format => 'atom'
should_route 'GET /projects/foo/repository/foo/revisions/2457' => 'repositories#revision', :id => 'foo', :repository_id => 'foo', :rev => '2457'
- should_route 'GET /projects/foo/repository/foo/revisions/2457/show' => 'repositories#show', :id => 'foo', :repository_id => 'foo', :rev => '2457'
- should_route 'GET /projects/foo/repository/foo/revisions/2457/diff' => 'repositories#diff', :id => 'foo', :repository_id => 'foo', :rev => '2457'
-
- should_route "GET /projects/foo/repository/foo/revisions/2457/show/#{@path_hash[:path]}" => 'repositories#show',
- :id => 'foo', :repository_id => 'foo', :rev => '2457', :path => @path_hash[:param]
- should_route "GET /projects/foo/repository/foo/revisions/2457/diff/#{@path_hash[:path]}" => 'repositories#diff',
- :id => 'foo', :repository_id => 'foo', :rev => '2457', :path => @path_hash[:param]
- should_route "GET /projects/foo/repository/foo/revisions/2457/entry/#{@path_hash[:path]}" => 'repositories#entry',
- :id => 'foo', :repository_id => 'foo', :rev => '2457', :path => @path_hash[:param]
- should_route "GET /projects/foo/repository/foo/revisions/2457/raw/#{@path_hash[:path]}" => 'repositories#raw',
- :id => 'foo', :repository_id => 'foo', :rev => '2457', :path => @path_hash[:param]
- should_route "GET /projects/foo/repository/foo/revisions/2457/annotate/#{@path_hash[:path]}" => 'repositories#annotate',
- :id => 'foo', :repository_id => 'foo', :rev => '2457', :path => @path_hash[:param]
+ should_route 'GET /projects/foo/repository/foo/revisions/2457/show' => 'repositories#show', :id => 'foo', :repository_id => 'foo', :rev => '2457', :format => 'html'
+ should_route 'GET /projects/foo/repository/foo/revisions/2457/diff' => 'repositories#diff', :id => 'foo', :repository_id => 'foo', :rev => '2457', :format => 'html'
+
+ %w(show diff entry raw annotate).each do |action|
+ @paths.each do |path|
+ should_route "GET /projects/foo/repository/foo/revisions/2457/#{action}/#{path}" => "repositories##{action}",
+ :id => 'foo', :repository_id => 'foo', :rev => '2457', :path => path, :format => 'html'
+ end
+ end
end
def test_repositories_non_revisions_path
- should_route 'GET /projects/foo/repository/changes' => 'repositories#changes', :id => 'foo'
-
- should_route "GET /projects/foo/repository/changes/#{@path_hash[:path]}" => 'repositories#changes',
- :id => 'foo', :path => @path_hash[:param]
- should_route "GET /projects/foo/repository/diff/#{@path_hash[:path]}" => 'repositories#diff',
- :id => 'foo', :path => @path_hash[:param]
- should_route "GET /projects/foo/repository/browse/#{@path_hash[:path]}" => 'repositories#browse',
- :id => 'foo', :path => @path_hash[:param]
- should_route "GET /projects/foo/repository/entry/#{@path_hash[:path]}" => 'repositories#entry',
- :id => 'foo', :path => @path_hash[:param]
- should_route "GET /projects/foo/repository/raw/#{@path_hash[:path]}" => 'repositories#raw',
- :id => 'foo', :path => @path_hash[:param]
- should_route "GET /projects/foo/repository/annotate/#{@path_hash[:path]}" => 'repositories#annotate',
- :id => 'foo', :path => @path_hash[:param]
+ should_route 'GET /projects/foo/repository/changes' => 'repositories#changes', :id => 'foo', :format => 'html'
+
+ %w(changes diff browse entry raw annotate).each do |action|
+ @paths.each do |path|
+ should_route "GET /projects/foo/repository/#{action}/#{path}" => "repositories##{action}",
+ :id => 'foo', :path => path, :format => 'html'
+ end
+ end
end
def test_repositories_non_revisions_path_with_repository_id
- should_route 'GET /projects/foo/repository/svn/changes' => 'repositories#changes', :id => 'foo', :repository_id => 'svn'
-
- should_route "GET /projects/foo/repository/svn/changes/#{@path_hash[:path]}" => 'repositories#changes',
- :id => 'foo', :repository_id => 'svn', :path => @path_hash[:param]
- should_route "GET /projects/foo/repository/svn/diff/#{@path_hash[:path]}" => 'repositories#diff',
- :id => 'foo', :repository_id => 'svn', :path => @path_hash[:param]
- should_route "GET /projects/foo/repository/svn/browse/#{@path_hash[:path]}" => 'repositories#browse',
- :id => 'foo', :repository_id => 'svn', :path => @path_hash[:param]
- should_route "GET /projects/foo/repository/svn/entry/#{@path_hash[:path]}" => 'repositories#entry',
- :id => 'foo', :repository_id => 'svn', :path => @path_hash[:param]
- should_route "GET /projects/foo/repository/svn/raw/#{@path_hash[:path]}" => 'repositories#raw',
- :id => 'foo', :repository_id => 'svn', :path => @path_hash[:param]
- should_route "GET /projects/foo/repository/svn/annotate/#{@path_hash[:path]}" => 'repositories#annotate',
- :id => 'foo', :repository_id => 'svn', :path => @path_hash[:param]
+ should_route 'GET /projects/foo/repository/svn/changes' => 'repositories#changes', :id => 'foo', :repository_id => 'svn', :format => 'html'
+
+ %w(changes diff browse entry raw annotate).each do |action|
+ @paths.each do |path|
+ should_route "GET /projects/foo/repository/svn/#{action}/#{path}" => "repositories##{action}",
+ :id => 'foo', :repository_id => 'svn', :path => path, :format => 'html'
+ end
+ end
end
def test_repositories_related_issues
diff --git a/test/integration/routing/welcome_test.rb b/test/integration/routing/welcome_test.rb
index 68aaf5a13..ad064f35d 100644
--- a/test/integration/routing/welcome_test.rb
+++ b/test/integration/routing/welcome_test.rb
@@ -20,6 +20,6 @@ require File.expand_path('../../../test_helper', __FILE__)
class RoutingWelcomeTest < Redmine::RoutingTest
def test_welcome
should_route 'GET /' => 'welcome#index'
- should_route 'GET /robots.txt' => 'welcome#robots'
+ should_route 'GET /robots.txt' => 'welcome#robots', :format => 'txt'
end
end
diff --git a/test/integration/welcome_test.rb b/test/integration/welcome_test.rb
new file mode 100644
index 000000000..3577fe059
--- /dev/null
+++ b/test/integration/welcome_test.rb
@@ -0,0 +1,28 @@
+# Redmine - project management software
+# Copyright (C) 2006-2017 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+require File.expand_path('../../test_helper', __FILE__)
+
+class WelcomeTest < Redmine::IntegrationTest
+
+ def test_robots
+ get '/robots.txt'
+ assert_response :success
+ assert_equal 'text/plain', @response.content_type
+ assert @response.body.match(%r{^Disallow: /projects/ecookbook/issues\r?$})
+ end
+end
diff --git a/test/test_helper.rb b/test/test_helper.rb
index ffb2d7055..34aebd4d2 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -49,7 +49,7 @@ end
class ActiveSupport::TestCase
include ActionDispatch::TestProcess
- self.use_transactional_fixtures = true
+ self.use_transactional_tests = true
self.use_instantiated_fixtures = false
def uploaded_test_file(name, mime)
@@ -324,16 +324,16 @@ module Redmine
end
assert_equal expected_filters.size, filter_init.scan("addFilter").size, "filters counts don't match"
end
+ end
- def process(action, http_method = 'GET', *args)
- parameters, session, flash = *args
- if args.size == 1 && parameters[:xhr] == true
- xhr http_method.downcase.to_sym, action, parameters.except(:xhr)
- elsif parameters && (parameters.key?(:params) || parameters.key?(:session) || parameters.key?(:flash))
- super action, http_method, parameters[:params], parameters[:session], parameters[:flash]
- else
- super
- end
+ class RepositoryControllerTest < ControllerTest
+ def setup
+ super
+ # We need to explicitly set Accept header to html otherwise
+ # requests that ends with a known format like:
+ # GET /projects/foo/repository/entry/image.png would be
+ # treated as image/png requests, resulting in a 406 error.
+ request.env["HTTP_ACCEPT"] = "text/html"
end
end
@@ -344,21 +344,13 @@ module Redmine
assert_nil session[:user_id]
assert_response :success
- post "/login", :username => login, :password => password
+ post "/login", :params => {
+ :username => login,
+ :password => password
+ }
assert_equal login, User.find(session[:user_id]).login
end
- %w(get post patch put delete head).each do |http_method|
- class_eval %Q"
- def #{http_method}(path, parameters = nil, headers_or_env = nil)
- if headers_or_env.nil? && parameters.is_a?(Hash) && (parameters.key?(:params) || parameters.key?(:headers))
- super path, parameters[:params], parameters[:headers]
- else
- super
- end
- end"
- end
-
def credentials(user, password=nil)
{'HTTP_AUTHORIZATION' => ActionController::HttpAuthentication::Basic.encode_credentials(user, password || user)}
end
@@ -390,7 +382,9 @@ module Redmine
def upload(format, content, credentials)
set_tmp_attachments_directory
assert_difference 'Attachment.count' do
- post "/uploads.#{format}", content, {"CONTENT_TYPE" => 'application/octet-stream'}.merge(credentials)
+ post "/uploads.#{format}",
+ :params => content,
+ :headers => {"CONTENT_TYPE" => 'application/octet-stream'}.merge(credentials)
assert_response :created
end
data = response_data
diff --git a/test/ui/base.rb b/test/ui/base.rb
index 556e35a46..d4ecff985 100644
--- a/test/ui/base.rb
+++ b/test/ui/base.rb
@@ -77,7 +77,7 @@ module Redmine
# Stop ActiveRecord from wrapping tests in transactions
# Transactional fixtures do not work with Selenium tests, because Capybara
# uses a separate server thread, which the transactions would be hidden
- self.use_transactional_fixtures = false
+ self.use_transactional_tests = false
# Should not depend on locale since Redmine displays login page
# using default browser locale which depend on system locale for "real" browsers drivers
diff --git a/test/unit/attachment_test.rb b/test/unit/attachment_test.rb
index e55c60b86..dcad6f23d 100644
--- a/test/unit/attachment_test.rb
+++ b/test/unit/attachment_test.rb
@@ -23,10 +23,6 @@ class AttachmentTest < ActiveSupport::TestCase
fixtures :users, :email_addresses, :projects, :roles, :members, :member_roles,
:enabled_modules, :issues, :trackers, :attachments
- # TODO: remove this with Rails 5 that supports after_commit callbacks
- # in transactional fixtures (https://github.com/rails/rails/pull/18458)
- self.use_transactional_fixtures = false
-
def setup
set_tmp_attachments_directory
end
diff --git a/test/unit/attachment_transaction_test.rb b/test/unit/attachment_transaction_test.rb
index 44776c8f5..b0f13332f 100644
--- a/test/unit/attachment_transaction_test.rb
+++ b/test/unit/attachment_transaction_test.rb
@@ -23,7 +23,7 @@ class AttachmentTest < ActiveSupport::TestCase
fixtures :users, :email_addresses, :projects, :roles, :members, :member_roles,
:enabled_modules, :issues, :trackers, :attachments
- self.use_transactional_fixtures = false
+ self.use_transactional_tests = false
def setup
set_tmp_attachments_directory
diff --git a/test/unit/issue_nested_set_concurrency_test.rb b/test/unit/issue_nested_set_concurrency_test.rb
index 4345fffc7..2f8daf8c8 100644
--- a/test/unit/issue_nested_set_concurrency_test.rb
+++ b/test/unit/issue_nested_set_concurrency_test.rb
@@ -24,7 +24,7 @@ class IssueNestedSetConcurrencyTest < ActiveSupport::TestCase
:issue_statuses,
:enumerations
- self.use_transactional_fixtures = false
+ self.use_transactional_tests = false
def setup
skip if sqlite?
diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb
index df242a169..a01d2e3e1 100644
--- a/test/unit/issue_test.rb
+++ b/test/unit/issue_test.rb
@@ -3045,14 +3045,14 @@ class IssueTest < ActiveSupport::TestCase
assert_equal IssueStatus.find(3), issue.status
end
- def test_assigned_to_was_with_a_group
+ def test_previous_assignee_with_a_group
group = Group.find(10)
Member.create!(:project_id => 1, :principal => group, :role_ids => [1])
with_settings :issue_group_assignment => '1' do
issue = Issue.generate!(:assigned_to => group)
issue.reload.assigned_to = nil
- assert_equal group, issue.assigned_to_was
+ assert_equal group, issue.previous_assignee
end
end
diff --git a/test/unit/issue_transaction_test.rb b/test/unit/issue_transaction_test.rb
index bb30df5d2..f944ffe8e 100644
--- a/test/unit/issue_transaction_test.rb
+++ b/test/unit/issue_transaction_test.rb
@@ -27,7 +27,7 @@ class IssueTransactionTest < ActiveSupport::TestCase
:custom_fields, :custom_fields_projects, :custom_fields_trackers, :custom_values,
:time_entries
- self.use_transactional_fixtures = false
+ self.use_transactional_tests = false
def test_invalid_move_to_another_project
lft1 = new_issue_lft
diff --git a/test/unit/lib/redmine/views/builders/json_test.rb b/test/unit/lib/redmine/views/builders/json_test.rb
index 8a0bd1032..b1b50b80a 100644
--- a/test/unit/lib/redmine/views/builders/json_test.rb
+++ b/test/unit/lib/redmine/views/builders/json_test.rb
@@ -87,7 +87,7 @@ class Redmine::Views::Builders::JsonTest < ActiveSupport::TestCase
end
def assert_json_output(expected, &block)
- builder = Redmine::Views::Builders::Json.new(ActionDispatch::TestRequest.new, ActionDispatch::TestResponse.new)
+ builder = Redmine::Views::Builders::Json.new(ActionDispatch::TestRequest.create, ActionDispatch::TestResponse.create)
block.call(builder)
assert_equal(expected, ActiveSupport::JSON.decode(builder.output))
end
diff --git a/test/unit/lib/redmine/views/builders/xml_test.rb b/test/unit/lib/redmine/views/builders/xml_test.rb
index cdc1ec2cf..46b5755b0 100644
--- a/test/unit/lib/redmine/views/builders/xml_test.rb
+++ b/test/unit/lib/redmine/views/builders/xml_test.rb
@@ -60,7 +60,7 @@ class Redmine::Views::Builders::XmlTest < ActiveSupport::TestCase
end
def assert_xml_output(expected, &block)
- builder = Redmine::Views::Builders::Xml.new(ActionDispatch::TestRequest.new, ActionDispatch::TestResponse.new)
+ builder = Redmine::Views::Builders::Xml.new(ActionDispatch::TestRequest.create, ActionDispatch::TestResponse.create)
block.call(builder)
assert_equal('<?xml version="1.0" encoding="UTF-8"?>' + expected, builder.output)
end
diff --git a/test/unit/project_nested_set_concurrency_test.rb b/test/unit/project_nested_set_concurrency_test.rb
index b67e5b3e3..430aab175 100644
--- a/test/unit/project_nested_set_concurrency_test.rb
+++ b/test/unit/project_nested_set_concurrency_test.rb
@@ -18,7 +18,7 @@
require File.expand_path('../../test_helper', __FILE__)
class ProjectNestedSetConcurrencyTest < ActiveSupport::TestCase
- self.use_transactional_fixtures = false
+ self.use_transactional_tests = false
def setup
CustomField.delete_all