summaryrefslogtreecommitdiffstats
path: root/test/functional
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2017-05-31 17:32:34 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2017-05-31 17:32:34 +0000
commitb834e81d7f41121fc6d9bef95ee090f8f466493e (patch)
tree61fddb6214c64e96fddd504301029bdb382ba439 /test/functional
parent1d4300b674f739d671a8be22d3ea617922f16517 (diff)
downloadredmine-b834e81d7f41121fc6d9bef95ee090f8f466493e.tar.gz
redmine-b834e81d7f41121fc6d9bef95ee090f8f466493e.zip
Use Rails 5 syntax for functional tests.
git-svn-id: http://svn.redmine.org/redmine/trunk@16585 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/account_controller_openid_test.rb57
-rw-r--r--test/functional/account_controller_test.rb183
-rw-r--r--test/functional/activities_controller_test.rb68
-rw-r--r--test/functional/admin_controller_test.rb17
-rw-r--r--test/functional/attachments_controller_test.rb217
-rw-r--r--test/functional/auth_sources_controller_test.rb82
-rw-r--r--test/functional/auto_completes_controller_test.rb58
-rw-r--r--test/functional/boards_controller_test.rb117
-rw-r--r--test/functional/calendars_controller_test.rb18
-rw-r--r--test/functional/comments_controller_test.rb26
-rw-r--r--test/functional/context_menus_controller_test.rb76
-rw-r--r--test/functional/custom_field_enumerations_controller_test.rb55
-rw-r--r--test/functional/custom_fields_controller_test.rb163
-rw-r--r--test/functional/documents_controller_test.rb99
-rw-r--r--test/functional/email_addresses_controller_test.rb92
-rw-r--r--test/functional/enumerations_controller_test.rb64
-rw-r--r--test/functional/files_controller_test.rb37
-rw-r--r--test/functional/gantts_controller_test.rb36
-rw-r--r--test/functional/groups_controller_test.rb91
-rw-r--r--test/functional/imports_controller_test.rb88
-rw-r--r--test/functional/issue_categories_controller_test.rb83
-rw-r--r--test/functional/issue_relations_controller_test.rb104
-rw-r--r--test/functional/issue_statuses_controller_test.rb42
-rw-r--r--test/functional/issues_controller_test.rb2832
-rw-r--r--test/functional/issues_controller_transaction_test.rb201
-rw-r--r--test/functional/issues_custom_fields_visibility_test.rb114
-rw-r--r--test/functional/journals_controller_test.rb129
-rw-r--r--test/functional/mail_handler_controller_test.rb34
-rw-r--r--test/functional/members_controller_test.rb138
-rw-r--r--test/functional/messages_controller_test.rb140
-rw-r--r--test/functional/my_controller_test.rb108
-rw-r--r--test/functional/news_controller_test.rb99
-rw-r--r--test/functional/previews_controller_test.rb77
-rw-r--r--test/functional/principal_memberships_controller_test.rb155
-rw-r--r--test/functional/project_enumerations_controller_test.rb61
-rw-r--r--test/functional/projects_controller_test.rb451
-rw-r--r--test/functional/queries_controller_test.rb346
-rw-r--r--test/functional/reports_controller_test.rb19
-rw-r--r--test/functional/repositories_bazaar_controller_test.rb63
-rw-r--r--test/functional/repositories_controller_test.rb165
-rw-r--r--test/functional/repositories_cvs_controller_test.rb63
-rw-r--r--test/functional/repositories_darcs_controller_test.rb37
-rw-r--r--test/functional/repositories_filesystem_controller_test.rb39
-rw-r--r--test/functional/repositories_git_controller_test.rb178
-rw-r--r--test/functional/repositories_mercurial_controller_test.rb147
-rw-r--r--test/functional/repositories_subversion_controller_test.rb121
-rw-r--r--test/functional/sessions_controller_test.rb44
-rw-r--r--test/functional/versions_controller_test.rb10
-rw-r--r--test/functional/watchers_controller_test.rb72
-rw-r--r--test/functional/wiki_controller_test.rb14
-rw-r--r--test/functional/wikis_controller_test.rb6
51 files changed, 5800 insertions, 1936 deletions
diff --git a/test/functional/account_controller_openid_test.rb b/test/functional/account_controller_openid_test.rb
index b76e4bca2..7e467fd3d 100644
--- a/test/functional/account_controller_openid_test.rb
+++ b/test/functional/account_controller_openid_test.rb
@@ -41,13 +41,17 @@ class AccountControllerOpenidTest < Redmine::ControllerTest
existing_user.login = 'cool_user'
assert existing_user.save!
- post :login, :openid_url => existing_user.identity_url
+ post :login, :params => {
+ :openid_url => existing_user.identity_url
+ }
assert_redirected_to '/my/page'
end
def test_login_with_invalid_openid_provider
Setting.self_registration = '0'
- post :login, :openid_url => 'http;//openid.example.com/good_user'
+ post :login, :params => {
+ :openid_url => 'http;//openid.example.com/good_user'
+ }
assert_redirected_to home_url
end
@@ -61,13 +65,17 @@ class AccountControllerOpenidTest < Redmine::ControllerTest
existing_user.login = 'cool_user'
assert existing_user.save!
- post :login, :openid_url => existing_user.identity_url
+ post :login, :params => {
+ :openid_url => existing_user.identity_url
+ }
assert_redirected_to '/login'
end
def test_login_with_openid_with_new_user_created
Setting.self_registration = '3'
- post :login, :openid_url => 'http://openid.example.com/good_user'
+ post :login, :params => {
+ :openid_url => 'http://openid.example.com/good_user'
+ }
assert_redirected_to '/my/account'
user = User.find_by_login('cool_user')
assert user
@@ -77,7 +85,9 @@ class AccountControllerOpenidTest < Redmine::ControllerTest
def test_login_with_openid_with_new_user_and_self_registration_off
Setting.self_registration = '0'
- post :login, :openid_url => 'http://openid.example.com/good_user'
+ post :login, :params => {
+ :openid_url => 'http://openid.example.com/good_user'
+ }
assert_redirected_to home_url
user = User.find_by_login('cool_user')
assert_nil user
@@ -85,7 +95,9 @@ class AccountControllerOpenidTest < Redmine::ControllerTest
def test_login_with_openid_with_new_user_created_with_email_activation_should_have_a_token
Setting.self_registration = '1'
- post :login, :openid_url => 'http://openid.example.com/good_user'
+ post :login, :params => {
+ :openid_url => 'http://openid.example.com/good_user'
+ }
assert_redirected_to '/login'
user = User.find_by_login('cool_user')
assert user
@@ -96,7 +108,9 @@ class AccountControllerOpenidTest < Redmine::ControllerTest
def test_login_with_openid_with_new_user_created_with_manual_activation
Setting.self_registration = '2'
- post :login, :openid_url => 'http://openid.example.com/good_user'
+ post :login, :params => {
+ :openid_url => 'http://openid.example.com/good_user'
+ }
assert_redirected_to '/login'
user = User.find_by_login('cool_user')
assert user
@@ -109,7 +123,9 @@ class AccountControllerOpenidTest < Redmine::ControllerTest
existing_user.login = 'cool_user'
assert existing_user.save!
- post :login, :openid_url => 'http://openid.example.com/good_user'
+ post :login, :params => {
+ :openid_url => 'http://openid.example.com/good_user'
+ }
assert_response :success
assert_select 'input[name=?][value=?]', 'user[identity_url]', 'http://openid.example.com/good_user'
@@ -118,7 +134,9 @@ class AccountControllerOpenidTest < Redmine::ControllerTest
def test_login_with_openid_with_new_user_with_missing_information_should_register
Setting.self_registration = '3'
- post :login, :openid_url => 'http://openid.example.com/good_blank_user'
+ post :login, :params => {
+ :openid_url => 'http://openid.example.com/good_blank_user'
+ }
assert_response :success
assert_select 'input[name=?]', 'user[login]'
@@ -141,15 +159,18 @@ class AccountControllerOpenidTest < Redmine::ControllerTest
Setting.self_registration = '3'
assert_difference 'User.count' do
- post :register, :user => {
- :login => 'good_blank_user',
- :password => '',
- :password_confirmation => '',
- :firstname => 'Cool',
- :lastname => 'User',
- :mail => 'user@somedomain.com',
- :identity_url => 'http://openid.example.com/good_blank_user'
- }
+ post :register, :params => {
+ :user => {
+ :login => 'good_blank_user',
+ :password => '',
+ :password_confirmation => '',
+ :firstname => 'Cool',
+ :lastname => 'User',
+ :mail => 'user@somedomain.com',
+ :identity_url => 'http://openid.example.com/good_blank_user'
+
+ }
+ }
assert_response 302
end
diff --git a/test/functional/account_controller_test.rb b/test/functional/account_controller_test.rb
index 01affec56..6bb6fddf9 100644
--- a/test/functional/account_controller_test.rb
+++ b/test/functional/account_controller_test.rb
@@ -36,7 +36,9 @@ class AccountControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
@request.env["HTTP_REFERER"] = 'http://test.host/issues/show/1'
- get :login, :back_url => 'http://test.host/issues/show/1'
+ get :login, :params => {
+ :back_url => 'http://test.host/issues/show/1'
+ }
assert_redirected_to '/issues/show/1'
assert_equal 2, @request.session[:user_id]
end
@@ -66,7 +68,11 @@ class AccountControllerTest < Redmine::ControllerTest
'/'
]
back_urls.each do |back_url|
- post :login, :username => 'jsmith', :password => 'jsmith', :back_url => back_url
+ post :login, :params => {
+ :username => 'jsmith',
+ :password => 'jsmith',
+ :back_url => back_url
+ }
assert_redirected_to back_url
end
end
@@ -80,7 +86,11 @@ class AccountControllerTest < Redmine::ControllerTest
'/redmine'
]
back_urls.each do |back_url|
- post :login, :username => 'jsmith', :password => 'jsmith', :back_url => back_url
+ post :login, :params => {
+ :username => 'jsmith',
+ :password => 'jsmith',
+ :back_url => back_url
+ }
assert_redirected_to back_url
end
ensure
@@ -93,7 +103,11 @@ class AccountControllerTest < Redmine::ControllerTest
'//test.foo/fake'
]
back_urls.each do |back_url|
- post :login, :username => 'jsmith', :password => 'jsmith', :back_url => back_url
+ post :login, :params => {
+ :username => 'jsmith',
+ :password => 'jsmith',
+ :back_url => back_url
+ }
assert_redirected_to '/my/page'
end
end
@@ -120,7 +134,11 @@ class AccountControllerTest < Redmine::ControllerTest
'.test.foo'
]
back_urls.each do |back_url|
- post :login, :username => 'jsmith', :password => 'jsmith', :back_url => back_url
+ post :login, :params => {
+ :username => 'jsmith',
+ :password => 'jsmith',
+ :back_url => back_url
+ }
assert_redirected_to '/my/page'
end
ensure
@@ -128,7 +146,10 @@ class AccountControllerTest < Redmine::ControllerTest
end
def test_login_with_wrong_password
- post :login, :username => 'admin', :password => 'bad'
+ post :login, :params => {
+ :username => 'admin',
+ :password => 'bad'
+ }
assert_response :success
assert_select 'div.flash.error', :text => /Invalid user or password/
@@ -140,7 +161,10 @@ class AccountControllerTest < Redmine::ControllerTest
def test_login_with_locked_account_should_fail
User.find(2).update_attribute :status, User::STATUS_LOCKED
- post :login, :username => 'jsmith', :password => 'jsmith'
+ post :login, :params => {
+ :username => 'jsmith',
+ :password => 'jsmith'
+ }
assert_redirected_to '/login'
assert_include 'locked', flash[:error]
assert_nil @request.session[:user_id]
@@ -150,7 +174,10 @@ class AccountControllerTest < Redmine::ControllerTest
User.find(2).update_attribute :status, User::STATUS_REGISTERED
with_settings :self_registration => '2', :default_language => 'en' do
- post :login, :username => 'jsmith', :password => 'jsmith'
+ post :login, :params => {
+ :username => 'jsmith',
+ :password => 'jsmith'
+ }
assert_redirected_to '/login'
assert_include 'pending administrator approval', flash[:error]
end
@@ -160,7 +187,10 @@ class AccountControllerTest < Redmine::ControllerTest
User.find(2).update_attribute :status, User::STATUS_REGISTERED
with_settings :self_registration => '1', :default_language => 'en' do
- post :login, :username => 'jsmith', :password => 'jsmith'
+ post :login, :params => {
+ :username => 'jsmith',
+ :password => 'jsmith'
+ }
assert_redirected_to '/login'
assert_equal 2, @request.session[:registered_user_id]
assert_include 'new activation email', flash[:error]
@@ -172,7 +202,10 @@ class AccountControllerTest < Redmine::ControllerTest
User.find(2).update_attribute :auth_source_id, source.id
AuthSource.any_instance.stubs(:authenticate).raises(AuthSourceException.new("Something wrong"))
- post :login, :username => 'jsmith', :password => 'jsmith'
+ post :login, :params => {
+ :username => 'jsmith',
+ :password => 'jsmith'
+ }
assert_response 500
assert_select_error /Something wrong/
end
@@ -180,7 +213,10 @@ class AccountControllerTest < Redmine::ControllerTest
def test_login_should_reset_session
@controller.expects(:reset_session).once
- post :login, :username => 'jsmith', :password => 'jsmith'
+ post :login, :params => {
+ :username => 'jsmith',
+ :password => 'jsmith'
+ }
assert_response 302
end
@@ -257,14 +293,17 @@ class AccountControllerTest < Redmine::ControllerTest
def test_post_register_with_registration_on
with_settings :self_registration => '3' do
assert_difference 'User.count' do
- post :register, :user => {
- :login => 'register',
- :password => 'secret123',
- :password_confirmation => 'secret123',
- :firstname => 'John',
- :lastname => 'Doe',
- :mail => 'register@example.com'
- }
+ post :register, :params => {
+ :user => {
+ :login => 'register',
+ :password => 'secret123',
+ :password_confirmation => 'secret123',
+ :firstname => 'John',
+ :lastname => 'Doe',
+ :mail => 'register@example.com'
+
+ }
+ }
assert_redirected_to '/my/account'
end
user = User.order('id DESC').first
@@ -280,14 +319,17 @@ class AccountControllerTest < Redmine::ControllerTest
def test_post_register_with_registration_off_should_redirect
with_settings :self_registration => '0' do
assert_no_difference 'User.count' do
- post :register, :user => {
- :login => 'register',
- :password => 'test',
- :password_confirmation => 'test',
- :firstname => 'John',
- :lastname => 'Doe',
- :mail => 'register@example.com'
- }
+ post :register, :params => {
+ :user => {
+ :login => 'register',
+ :password => 'test',
+ :password_confirmation => 'test',
+ :firstname => 'John',
+ :lastname => 'Doe',
+ :mail => 'register@example.com'
+
+ }
+ }
assert_redirected_to '/'
end
end
@@ -296,14 +338,21 @@ class AccountControllerTest < Redmine::ControllerTest
def test_post_register_should_create_user_with_hide_mail_preference
with_settings :default_users_hide_mail => '0' do
user = new_record(User) do
- post :register, :user => {
- :login => 'register',
- :password => 'secret123', :password_confirmation => 'secret123',
- :firstname => 'John', :lastname => 'Doe',
- :mail => 'register@example.com'
- }, :pref => {
- :hide_mail => '1'
- }
+ post :register, :params => {
+ :user => {
+ :login => 'register',
+ :password => 'secret123',
+ :password_confirmation => 'secret123',
+ :firstname => 'John',
+ :lastname => 'Doe',
+ :mail => 'register@example.com'
+
+ },
+ :pref => {
+ :hide_mail => '1'
+
+ }
+ }
end
assert_equal true, user.pref.hide_mail
end
@@ -320,7 +369,9 @@ class AccountControllerTest < Redmine::ControllerTest
ActionMailer::Base.deliveries.clear
assert_difference 'ActionMailer::Base.deliveries.size' do
assert_difference 'Token.count' do
- post :lost_password, :mail => 'JSmith@somenet.foo'
+ post :lost_password, :params => {
+ :mail => 'JSmith@somenet.foo'
+ }
assert_redirected_to '/login'
end
end
@@ -340,7 +391,9 @@ class AccountControllerTest < Redmine::ControllerTest
assert_difference 'ActionMailer::Base.deliveries.size' do
assert_difference 'Token.count' do
- post :lost_password, :mail => 'ANOTHERaddress@foo.bar'
+ post :lost_password, :params => {
+ :mail => 'ANOTHERaddress@foo.bar'
+ }
assert_redirected_to '/login'
end
end
@@ -351,7 +404,9 @@ class AccountControllerTest < Redmine::ControllerTest
def test_lost_password_for_unknown_user_should_fail
Token.delete_all
assert_no_difference 'Token.count' do
- post :lost_password, :mail => 'invalid@somenet.foo'
+ post :lost_password, :params => {
+ :mail => 'invalid@somenet.foo'
+ }
assert_response :success
end
end
@@ -361,7 +416,9 @@ class AccountControllerTest < Redmine::ControllerTest
assert User.find(2).lock!
assert_no_difference 'Token.count' do
- post :lost_password, :mail => 'JSmith@somenet.foo'
+ post :lost_password, :params => {
+ :mail => 'JSmith@somenet.foo'
+ }
assert_redirected_to '/account/lost_password'
end
end
@@ -370,7 +427,9 @@ class AccountControllerTest < Redmine::ControllerTest
User.any_instance.stubs(:change_password_allowed?).returns(false)
assert_no_difference 'Token.count' do
- post :lost_password, :mail => 'JSmith@somenet.foo'
+ post :lost_password, :params => {
+ :mail => 'JSmith@somenet.foo'
+ }
assert_response :success
end
end
@@ -379,7 +438,9 @@ class AccountControllerTest < Redmine::ControllerTest
user = User.find(2)
token = Token.create!(:action => 'recovery', :user => user)
- get :lost_password, :token => token.value
+ get :lost_password, :params => {
+ :token => token.value
+ }
assert_redirected_to '/account/lost_password'
assert_equal token.value, request.session[:password_recovery_token]
@@ -397,7 +458,9 @@ class AccountControllerTest < Redmine::ControllerTest
end
def test_get_lost_password_with_invalid_token_should_redirect
- get :lost_password, :token => "abcdef"
+ get :lost_password, :params => {
+ :token => "abcdef"
+ }
assert_redirected_to '/'
end
@@ -406,7 +469,11 @@ class AccountControllerTest < Redmine::ControllerTest
user = User.find(2)
token = Token.create!(:action => 'recovery', :user => user)
- post :lost_password, :token => token.value, :new_password => 'newpass123', :new_password_confirmation => 'newpass123'
+ post :lost_password, :params => {
+ :token => token.value,
+ :new_password => 'newpass123',
+ :new_password_confirmation => 'newpass123'
+ }
assert_redirected_to '/login'
user.reload
assert user.check_password?('newpass123')
@@ -422,7 +489,11 @@ class AccountControllerTest < Redmine::ControllerTest
token = Token.create!(:action => 'recovery', :user => user)
user.lock!
- post :lost_password, :token => token.value, :new_password => 'newpass123', :new_password_confirmation => 'newpass123'
+ post :lost_password, :params => {
+ :token => token.value,
+ :new_password => 'newpass123',
+ :new_password_confirmation => 'newpass123'
+ }
assert_redirected_to '/'
assert ! user.check_password?('newpass123')
end
@@ -431,7 +502,11 @@ class AccountControllerTest < Redmine::ControllerTest
user = User.find(2)
token = Token.create!(:action => 'recovery', :user => user)
- post :lost_password, :token => token.value, :new_password => 'newpass', :new_password_confirmation => 'wrongpass'
+ post :lost_password, :params => {
+ :token => token.value,
+ :new_password => 'newpass',
+ :new_password_confirmation => 'wrongpass'
+ }
assert_response :success
assert_not_nil Token.find_by_id(token.id), "Token was deleted"
@@ -445,7 +520,11 @@ class AccountControllerTest < Redmine::ControllerTest
user.save!
token = Token.create!(:action => 'recovery', :user => user)
- post :lost_password, :token => token.value, :new_password => 'originalpassword', :new_password_confirmation => 'originalpassword'
+ post :lost_password, :params => {
+ :token => token.value,
+ :new_password => 'originalpassword',
+ :new_password_confirmation => 'originalpassword'
+ }
assert_response :success
assert_not_nil Token.find_by_id(token.id), "Token was deleted"
@@ -460,14 +539,22 @@ class AccountControllerTest < Redmine::ControllerTest
user.save!
token = Token.create!(:action => 'recovery', :user => user)
- post :lost_password, :token => token.value, :new_password => 'newpassword', :new_password_confirmation => 'newpassword'
+ post :lost_password, :params => {
+ :token => token.value,
+ :new_password => 'newpassword',
+ :new_password_confirmation => 'newpassword'
+ }
assert_redirected_to '/login'
assert_equal false, user.reload.must_change_passwd
end
def test_post_lost_password_with_invalid_token_should_redirect
- post :lost_password, :token => "abcdef", :new_password => 'newpass', :new_password_confirmation => 'newpass'
+ post :lost_password, :params => {
+ :token => "abcdef",
+ :new_password => 'newpass',
+ :new_password_confirmation => 'newpass'
+ }
assert_redirected_to '/'
end
diff --git a/test/functional/activities_controller_test.rb b/test/functional/activities_controller_test.rb
index 230e46192..e92373739 100644
--- a/test/functional/activities_controller_test.rb
+++ b/test/functional/activities_controller_test.rb
@@ -30,7 +30,10 @@ class ActivitiesControllerTest < Redmine::ControllerTest
def test_project_index
- get :index, :id => 1, :with_subprojects => 0
+ get :index, :params => {
+ :id => 1,
+ :with_subprojects => 0
+ }
assert_response :success
assert_select 'h3', :text => /#{2.days.ago.to_date.day}/
@@ -38,12 +41,17 @@ class ActivitiesControllerTest < Redmine::ControllerTest
end
def test_project_index_with_invalid_project_id_should_respond_404
- get :index, :id => 299
+ get :index, :params => {
+ :id => 299
+ }
assert_response 404
end
def test_previous_project_index
- get :index, :id => 1, :from => 2.days.ago.to_date
+ get :index, :params => {
+ :id => 1,
+ :from => 2.days.ago.to_date
+ }
assert_response :success
assert_select 'h3', :text => /#{3.days.ago.to_date.day}/
@@ -64,7 +72,9 @@ class ActivitiesControllerTest < Redmine::ControllerTest
def test_user_index
@request.session[:user_id] = 1
- get :index, :user_id => 2
+ get :index, :params => {
+ :user_id => 2
+ }
assert_response :success
assert_select 'h2 a[href="/users/2"]', :text => 'John Smith'
@@ -77,12 +87,17 @@ class ActivitiesControllerTest < Redmine::ControllerTest
end
def test_user_index_with_invalid_user_id_should_respond_404
- get :index, :user_id => 299
+ get :index, :params => {
+ :user_id => 299
+ }
assert_response 404
end
def test_index_atom_feed
- get :index, :format => 'atom', :with_subprojects => 0
+ get :index, :params => {
+ :format => 'atom',
+ :with_subprojects => 0
+ }
assert_response :success
assert_select 'feed' do
@@ -95,15 +110,18 @@ class ActivitiesControllerTest < Redmine::ControllerTest
end
def test_index_atom_feed_with_explicit_selection
- get :index, :format => 'atom', :with_subprojects => 0,
- :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
+ get :index, :params => {
+ :format => 'atom',
+ :with_subprojects => 0,
+ :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
+ }
assert_response :success
@@ -118,7 +136,10 @@ class ActivitiesControllerTest < Redmine::ControllerTest
def test_index_atom_feed_with_one_item_type
with_settings :default_language => 'en' do
- get :index, :format => 'atom', :show_issues => '1'
+ get :index, :params => {
+ :format => 'atom',
+ :show_issues => '1'
+ }
assert_response :success
assert_select 'title', :text => /Issues/
@@ -126,7 +147,10 @@ class ActivitiesControllerTest < Redmine::ControllerTest
end
def test_index_atom_feed_with_user
- get :index, :user_id => 2, :format => 'atom'
+ get :index, :params => {
+ :user_id => 2,
+ :format => 'atom'
+ }
assert_response :success
assert_select 'title', :text => "Redmine: #{User.find(2).name}"
@@ -149,7 +173,11 @@ class ActivitiesControllerTest < Redmine::ControllerTest
def test_index_with_submitted_scope_should_save_as_preference
@request.session[:user_id] = 2
- get :index, :show_issues => '1', :show_messages => '1', :submit => 'Apply'
+ get :index, :params => {
+ :show_issues => '1',
+ :show_messages => '1',
+ :submit => 'Apply'
+ }
assert_response :success
assert_equal %w(issues messages), User.find(2).pref.activity_scope.sort
end
@@ -182,7 +210,9 @@ class ActivitiesControllerTest < Redmine::ControllerTest
def test_index_up_to_yesterday_should_show_next_page_link
@request.session[:user_id] = 2
- get :index, :from => (User.find(2).today-1)
+ get :index, :params => {
+ :from => (User.find(2).today-1)
+ }
assert_response :success
assert_select '.pagination a', :text => /Previous/
assert_select '.pagination a', :text => /Next/
diff --git a/test/functional/admin_controller_test.rb b/test/functional/admin_controller_test.rb
index 70a8ca683..523a8efaf 100644
--- a/test/functional/admin_controller_test.rb
+++ b/test/functional/admin_controller_test.rb
@@ -43,13 +43,18 @@ class AdminControllerTest < Redmine::ControllerTest
end
def test_projects_with_status_filter
- get :projects, :status => 1
+ get :projects, :params => {
+ :status => 1
+ }
assert_response :success
assert_select 'tr.project.closed', 0
end
def test_projects_with_name_filter
- get :projects, :name => 'store', :status => ''
+ get :projects, :params => {
+ :name => 'store',
+ :status => ''
+ }
assert_response :success
assert_select 'tr.project td.name', :text => 'OnlineStore'
@@ -58,7 +63,9 @@ class AdminControllerTest < Redmine::ControllerTest
def test_load_default_configuration_data
delete_configuration_data
- post :default_configuration, :lang => 'fr'
+ post :default_configuration, :params => {
+ :lang => 'fr'
+ }
assert_response :redirect
assert_nil flash[:error]
assert IssueStatus.find_by_name('Nouveau')
@@ -67,7 +74,9 @@ class AdminControllerTest < Redmine::ControllerTest
def test_load_default_configuration_data_should_rescue_error
delete_configuration_data
Redmine::DefaultData::Loader.stubs(:load).raises(Exception.new("Something went wrong"))
- post :default_configuration, :lang => 'fr'
+ post :default_configuration, :params => {
+ :lang => 'fr'
+ }
assert_response :redirect
assert_not_nil flash[:error]
assert_match /Something went wrong/, flash[:error]
diff --git a/test/functional/attachments_controller_test.rb b/test/functional/attachments_controller_test.rb
index 665eb1d9d..3eba761ae 100644
--- a/test/functional/attachments_controller_test.rb
+++ b/test/functional/attachments_controller_test.rb
@@ -36,7 +36,10 @@ class AttachmentsControllerTest < Redmine::ControllerTest
def test_show_diff
['inline', 'sbs'].each do |dt|
# 060719210727_changeset_utf8.diff
- get :show, :id => 14, :type => dt
+ get :show, :params => {
+ :id => 14,
+ :type => dt
+ }
assert_response :success
assert_equal 'text/html', @response.content_type
@@ -50,7 +53,10 @@ class AttachmentsControllerTest < Redmine::ControllerTest
with_settings :repositories_encodings => 'UTF-8' do
['inline', 'sbs'].each do |dt|
# 060719210727_changeset_iso8859-1.diff
- get :show, :id => 5, :type => dt
+ get :show, :params => {
+ :id => 5,
+ :type => dt
+ }
assert_response :success
assert_equal 'text/html', @response.content_type
@@ -65,7 +71,10 @@ class AttachmentsControllerTest < Redmine::ControllerTest
with_settings :repositories_encodings => 'UTF-8,ISO-8859-1' do
['inline', 'sbs'].each do |dt|
# 060719210727_changeset_iso8859-1.diff
- get :show, :id => 5, :type => dt
+ get :show, :params => {
+ :id => 5,
+ :type => dt
+ }
assert_response :success
assert_equal 'text/html', @response.content_type
@@ -84,12 +93,17 @@ class AttachmentsControllerTest < Redmine::ControllerTest
assert_nil user.pref[:diff_type]
@request.session[:user_id] = 1 # admin
- get :show, :id => 5
+ get :show, :params => {
+ :id => 5
+ }
assert_response :success
user.reload
assert_equal "inline", user.pref[:diff_type]
- get :show, :id => 5, :type => 'sbs'
+ get :show, :params => {
+ :id => 5,
+ :type => 'sbs'
+ }
assert_response :success
user.reload
assert_equal "sbs", user.pref[:diff_type]
@@ -103,14 +117,19 @@ class AttachmentsControllerTest < Redmine::ControllerTest
assert a.save
assert_equal 'hg-export.diff', a.filename
- get :show, :id => a.id, :type => 'inline'
+ get :show, :params => {
+ :id => a.id,
+ :type => 'inline'
+ }
assert_response :success
assert_equal 'text/html', @response.content_type
assert_select 'th.filename', :text => 'test1.txt'
end
def test_show_text_file
- get :show, :id => 4
+ get :show, :params => {
+ :id => 4
+ }
assert_response :success
assert_equal 'text/html', @response.content_type
set_tmp_attachments_directory
@@ -126,7 +145,9 @@ class AttachmentsControllerTest < Redmine::ControllerTest
str_japanese = "\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e".force_encoding('UTF-8')
- get :show, :id => a.id
+ get :show, :params => {
+ :id => a.id
+ }
assert_response :success
assert_equal 'text/html', @response.content_type
assert_select 'tr#L1' do
@@ -144,7 +165,9 @@ class AttachmentsControllerTest < Redmine::ControllerTest
assert a.save
assert_equal 'iso8859-1.txt', a.filename
- get :show, :id => a.id
+ get :show, :params => {
+ :id => a.id
+ }
assert_response :success
assert_equal 'text/html', @response.content_type
assert_select 'tr#L7' do
@@ -163,7 +186,9 @@ class AttachmentsControllerTest < Redmine::ControllerTest
assert a.save
assert_equal 'iso8859-1.txt', a.filename
- get :show, :id => a.id
+ get :show, :params => {
+ :id => a.id
+ }
assert_response :success
assert_equal 'text/html', @response.content_type
assert_select 'tr#L7' do
@@ -177,7 +202,9 @@ class AttachmentsControllerTest < Redmine::ControllerTest
@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
+ get :show, :params => {
+ :id => 4
+ }
assert_response :success
assert_equal 'text/html', @response.content_type
assert_select '.nodata', :text => 'No preview available'
@@ -187,7 +214,9 @@ class AttachmentsControllerTest < Redmine::ControllerTest
def test_show_image
@request.session[:user_id] = 2
- get :show, :id => 16
+ get :show, :params => {
+ :id => 16
+ }
assert_response :success
assert_equal 'text/html', @response.content_type
assert_select 'img.filecontent', :src => attachments(:attachments_010).filename
@@ -195,21 +224,27 @@ class AttachmentsControllerTest < Redmine::ControllerTest
def test_show_other
@request.session[:user_id] = 2
- get :show, :id => 6
+ get :show, :params => {
+ :id => 6
+ }
assert_equal 'text/html', @response.content_type
assert_select '.nodata', :text => 'No preview available'
set_tmp_attachments_directory
end
def test_show_file_from_private_issue_without_permission
- get :show, :id => 15
+ get :show, :params => {
+ :id => 15
+ }
assert_redirected_to '/login?back_url=http%3A%2F%2Ftest.host%2Fattachments%2F15'
set_tmp_attachments_directory
end
def test_show_file_from_private_issue_with_permission
@request.session[:user_id] = 2
- get :show, :id => 15
+ get :show, :params => {
+ :id => 15
+ }
assert_response :success
assert_select 'h2', :text => /private.diff/
set_tmp_attachments_directory
@@ -220,7 +255,9 @@ class AttachmentsControllerTest < Redmine::ControllerTest
attachment = Attachment.create!(:file => uploaded_test_file("testfile.txt", "text/plain"), :author_id => 2)
@request.session[:user_id] = 2
- get :show, :id => attachment.id
+ get :show, :params => {
+ :id => attachment.id
+ }
assert_response 200
end
@@ -229,24 +266,32 @@ class AttachmentsControllerTest < Redmine::ControllerTest
attachment = Attachment.create!(:file => uploaded_test_file("testfile.txt", "text/plain"), :author_id => 2)
@request.session[:user_id] = 3
- get :show, :id => attachment.id
+ get :show, :params => {
+ :id => attachment.id
+ }
assert_response 403
end
def test_show_invalid_should_respond_with_404
- get :show, :id => 999
+ get :show, :params => {
+ :id => 999
+ }
assert_response 404
end
def test_download_text_file
- get :download, :id => 4
+ get :download, :params => {
+ :id => 4
+ }
assert_response :success
assert_equal 'application/x-ruby', @response.content_type
etag = @response.etag
assert_not_nil etag
@request.env["HTTP_IF_NONE_MATCH"] = etag
- get :download, :id => 4
+ get :download, :params => {
+ :id => 4
+ }
assert_response 304
set_tmp_attachments_directory
@@ -260,21 +305,27 @@ class AttachmentsControllerTest < Redmine::ControllerTest
:container => Issue.find(1)
)
- get :download, :id => attachment.id
+ get :download, :params => {
+ :id => attachment.id
+ }
assert_response :success
assert_equal 'text/javascript', @response.content_type
end
def test_download_version_file_with_issue_tracking_disabled
Project.find(1).disable_module! :issue_tracking
- get :download, :id => 9
+ get :download, :params => {
+ :id => 9
+ }
assert_response :success
end
def test_download_should_assign_content_type_if_blank
Attachment.find(4).update_attribute(:content_type, '')
- get :download, :id => 4
+ get :download, :params => {
+ :id => 4
+ }
assert_response :success
assert_equal 'text/x-ruby', @response.content_type
set_tmp_attachments_directory
@@ -283,20 +334,26 @@ class AttachmentsControllerTest < Redmine::ControllerTest
def test_download_should_assign_better_content_type_than_application_octet_stream
Attachment.find(4).update! :content_type => "application/octet-stream"
- get :download, :id => 4
+ get :download, :params => {
+ :id => 4
+ }
assert_response :success
assert_equal 'text/x-ruby', @response.content_type
set_tmp_attachments_directory
end
def test_download_missing_file
- get :download, :id => 2
+ get :download, :params => {
+ :id => 2
+ }
assert_response 404
set_tmp_attachments_directory
end
def test_download_should_be_denied_without_permission
- get :download, :id => 7
+ get :download, :params => {
+ :id => 7
+ }
assert_redirected_to '/login?back_url=http%3A%2F%2Ftest.host%2Fattachments%2Fdownload%2F7'
set_tmp_attachments_directory
end
@@ -305,7 +362,9 @@ class AttachmentsControllerTest < Redmine::ControllerTest
def test_thumbnail
Attachment.clear_thumbnails
@request.session[:user_id] = 2
- get :thumbnail, :id => 16
+ get :thumbnail, :params => {
+ :id => 16
+ }
assert_response :success
assert_equal 'image/png', response.content_type
@@ -313,7 +372,9 @@ class AttachmentsControllerTest < Redmine::ControllerTest
assert_not_nil etag
@request.env["HTTP_IF_NONE_MATCH"] = etag
- get :thumbnail, :id => 16
+ get :thumbnail, :params => {
+ :id => 16
+ }
assert_response 304
end
@@ -321,20 +382,28 @@ class AttachmentsControllerTest < Redmine::ControllerTest
Redmine::Thumbnail.expects(:generate).with {|source, target, size| size == 800}
@request.session[:user_id] = 2
- get :thumbnail, :id => 16, :size => 2000
+ get :thumbnail, :params => {
+ :id => 16,
+ :size => 2000
+ }
end
def test_thumbnail_should_round_size
Redmine::Thumbnail.expects(:generate).with {|source, target, size| size == 250}
@request.session[:user_id] = 2
- get :thumbnail, :id => 16, :size => 260
+ get :thumbnail, :params => {
+ :id => 16,
+ :size => 260
+ }
end
def test_thumbnail_should_return_404_for_non_image_attachment
@request.session[:user_id] = 2
- get :thumbnail, :id => 15
+ get :thumbnail, :params => {
+ :id => 15
+ }
assert_response 404
end
@@ -342,12 +411,16 @@ class AttachmentsControllerTest < Redmine::ControllerTest
Attachment.any_instance.stubs(:thumbnail).returns(nil)
@request.session[:user_id] = 2
- get :thumbnail, :id => 16
+ get :thumbnail, :params => {
+ :id => 16
+ }
assert_response 404
end
def test_thumbnail_should_be_denied_without_permission
- get :thumbnail, :id => 16
+ get :thumbnail, :params => {
+ :id => 16
+ }
assert_redirected_to '/login?back_url=http%3A%2F%2Ftest.host%2Fattachments%2Fthumbnail%2F16'
end
else
@@ -356,7 +429,10 @@ class AttachmentsControllerTest < Redmine::ControllerTest
def test_edit_all
@request.session[:user_id] = 2
- get :edit_all, :object_type => 'issues', :object_id => '2'
+ get :edit_all, :params => {
+ :object_type => 'issues',
+ :object_id => '2'
+ }
assert_response :success
assert_select 'form[action=?]', '/attachments/issues/2' do
@@ -372,25 +448,45 @@ class AttachmentsControllerTest < Redmine::ControllerTest
end
def test_edit_all_with_invalid_container_class_should_return_404
- get :edit_all, :object_type => 'nuggets', :object_id => '3'
+ get :edit_all, :params => {
+ :object_type => 'nuggets',
+ :object_id => '3'
+ }
assert_response 404
end
def test_edit_all_with_invalid_object_should_return_404
- get :edit_all, :object_type => 'issues', :object_id => '999'
+ get :edit_all, :params => {
+ :object_type => 'issues',
+ :object_id => '999'
+ }
assert_response 404
end
def test_edit_all_for_object_that_is_not_visible_should_return_403
- get :edit_all, :object_type => 'issues', :object_id => '4'
+ get :edit_all, :params => {
+ :object_type => 'issues',
+ :object_id => '4'
+ }
assert_response 403
end
def test_update_all
@request.session[:user_id] = 2
- patch :update_all, :object_type => 'issues', :object_id => '2', :attachments => {
- '1' => {:filename => 'newname.text', :description => ''},
- '4' => {:filename => 'newname.rb', :description => 'Renamed'},
+ patch :update_all, :params => {
+ :object_type => 'issues',
+ :object_id => '2',
+ :attachments => {
+ '1' => {
+ :filename => 'newname.text',
+ :description => ''
+ },
+ '4' => {
+ :filename => 'newname.rb',
+ :description => 'Renamed'
+ },
+
+ }
}
assert_response 302
@@ -401,9 +497,20 @@ class AttachmentsControllerTest < Redmine::ControllerTest
def test_update_all_with_failure
@request.session[:user_id] = 2
- patch :update_all, :object_type => 'issues', :object_id => '3', :attachments => {
- '1' => {:filename => '', :description => ''},
- '4' => {:filename => 'newname.rb', :description => 'Renamed'},
+ patch :update_all, :params => {
+ :object_type => 'issues',
+ :object_id => '3',
+ :attachments => {
+ '1' => {
+ :filename => '',
+ :description => ''
+ },
+ '4' => {
+ :filename => 'newname.rb',
+ :description => 'Renamed'
+ },
+
+ }
}
assert_response :success
@@ -422,7 +529,9 @@ class AttachmentsControllerTest < Redmine::ControllerTest
assert_difference 'issue.attachments.count', -1 do
assert_difference 'Journal.count' do
- delete :destroy, :id => 1
+ delete :destroy, :params => {
+ :id => 1
+ }
assert_redirected_to '/projects/ecookbook'
end
end
@@ -439,7 +548,9 @@ class AttachmentsControllerTest < Redmine::ControllerTest
set_tmp_attachments_directory
@request.session[:user_id] = 2
assert_difference 'Attachment.count', -1 do
- delete :destroy, :id => 3
+ delete :destroy, :params => {
+ :id => 3
+ }
assert_response 302
end
end
@@ -448,7 +559,9 @@ class AttachmentsControllerTest < Redmine::ControllerTest
set_tmp_attachments_directory
@request.session[:user_id] = 2
assert_difference 'Attachment.count', -1 do
- delete :destroy, :id => 8
+ delete :destroy, :params => {
+ :id => 8
+ }
assert_response 302
end
end
@@ -457,7 +570,9 @@ class AttachmentsControllerTest < Redmine::ControllerTest
set_tmp_attachments_directory
@request.session[:user_id] = 2
assert_difference 'Attachment.count', -1 do
- delete :destroy, :id => 9
+ delete :destroy, :params => {
+ :id => 9
+ }
assert_response 302
end
end
@@ -467,7 +582,9 @@ class AttachmentsControllerTest < Redmine::ControllerTest
set_tmp_attachments_directory
@request.session[:user_id] = 2
assert_difference 'Attachment.count', -1 do
- delete :destroy, :id => 9
+ delete :destroy, :params => {
+ :id => 9
+ }
assert_response 302
end
end
@@ -475,7 +592,9 @@ class AttachmentsControllerTest < Redmine::ControllerTest
def test_destroy_without_permission
set_tmp_attachments_directory
assert_no_difference 'Attachment.count' do
- delete :destroy, :id => 3
+ delete :destroy, :params => {
+ :id => 3
+ }
end
assert_response 302
assert Attachment.find_by_id(3)
diff --git a/test/functional/auth_sources_controller_test.rb b/test/functional/auth_sources_controller_test.rb
index 1ad829655..b3fbef0a5 100644
--- a/test/functional/auth_sources_controller_test.rb
+++ b/test/functional/auth_sources_controller_test.rb
@@ -40,13 +40,23 @@ class AuthSourcesControllerTest < Redmine::ControllerTest
end
def test_new_with_invalid_type_should_respond_with_404
- get :new, :type => 'foo'
+ get :new, :params => {
+ :type => 'foo'
+ }
assert_response 404
end
def test_create
assert_difference 'AuthSourceLdap.count' do
- post :create, :type => 'AuthSourceLdap', :auth_source => {:name => 'Test', :host => '127.0.0.1', :port => '389', :attr_login => 'cn'}
+ post :create, :params => {
+ :type => 'AuthSourceLdap',
+ :auth_source => {
+ :name => 'Test',
+ :host => '127.0.0.1',
+ :port => '389',
+ :attr_login => 'cn'
+ }
+ }
assert_redirected_to '/auth_sources'
end
@@ -59,16 +69,24 @@ class AuthSourcesControllerTest < Redmine::ControllerTest
def test_create_with_failure
assert_no_difference 'AuthSourceLdap.count' do
- post :create, :type => 'AuthSourceLdap',
- :auth_source => {:name => 'Test', :host => '',
- :port => '389', :attr_login => 'cn'}
+ post :create, :params => {
+ :type => 'AuthSourceLdap',
+ :auth_source => {
+ :name => 'Test',
+ :host => '',
+ :port => '389',
+ :attr_login => 'cn'
+ }
+ }
assert_response :success
end
assert_select_error /host cannot be blank/i
end
def test_edit
- get :edit, :id => 1
+ get :edit, :params => {
+ :id => 1
+ }
assert_response :success
assert_select 'form#auth_source_form' do
@@ -79,21 +97,31 @@ class AuthSourcesControllerTest < Redmine::ControllerTest
def test_edit_should_not_contain_password
AuthSource.find(1).update_column :account_password, 'secret'
- get :edit, :id => 1
+ get :edit, :params => {
+ :id => 1
+ }
assert_response :success
assert_select 'input[value=secret]', 0
assert_select 'input[name=dummy_password][value^=xxxxxx]'
end
def test_edit_invalid_should_respond_with_404
- get :edit, :id => 99
+ get :edit, :params => {
+ :id => 99
+ }
assert_response 404
end
def test_update
- put :update, :id => 1,
- :auth_source => {:name => 'Renamed', :host => '192.168.0.10',
- :port => '389', :attr_login => 'uid'}
+ put :update, :params => {
+ :id => 1,
+ :auth_source => {
+ :name => 'Renamed',
+ :host => '192.168.0.10',
+ :port => '389',
+ :attr_login => 'uid'
+ }
+ }
assert_redirected_to '/auth_sources'
source = AuthSourceLdap.find(1)
assert_equal 'Renamed', source.name
@@ -101,16 +129,24 @@ class AuthSourcesControllerTest < Redmine::ControllerTest
end
def test_update_with_failure
- put :update, :id => 1,
- :auth_source => {:name => 'Renamed', :host => '',
- :port => '389', :attr_login => 'uid'}
+ put :update, :params => {
+ :id => 1,
+ :auth_source => {
+ :name => 'Renamed',
+ :host => '',
+ :port => '389',
+ :attr_login => 'uid'
+ }
+ }
assert_response :success
assert_select_error /host cannot be blank/i
end
def test_destroy
assert_difference 'AuthSourceLdap.count', -1 do
- delete :destroy, :id => 1
+ delete :destroy, :params => {
+ :id => 1
+ }
assert_redirected_to '/auth_sources'
end
end
@@ -119,7 +155,9 @@ class AuthSourcesControllerTest < Redmine::ControllerTest
User.find(2).update_attribute :auth_source_id, 1
assert_no_difference 'AuthSourceLdap.count' do
- delete :destroy, :id => 1
+ delete :destroy, :params => {
+ :id => 1
+ }
assert_redirected_to '/auth_sources'
end
end
@@ -127,7 +165,9 @@ class AuthSourcesControllerTest < Redmine::ControllerTest
def test_test_connection
AuthSourceLdap.any_instance.stubs(:test_connection).returns(true)
- get :test_connection, :id => 1
+ get :test_connection, :params => {
+ :id => 1
+ }
assert_redirected_to '/auth_sources'
assert_not_nil flash[:notice]
assert_match /successful/i, flash[:notice]
@@ -136,7 +176,9 @@ class AuthSourcesControllerTest < Redmine::ControllerTest
def test_test_connection_with_failure
AuthSourceLdap.any_instance.stubs(:initialize_ldap_con).raises(Net::LDAP::LdapError.new("Something went wrong"))
- get :test_connection, :id => 1
+ get :test_connection, :params => {
+ :id => 1
+ }
assert_redirected_to '/auth_sources'
assert_not_nil flash[:error]
assert_include 'Something went wrong', flash[:error]
@@ -148,7 +190,9 @@ class AuthSourcesControllerTest < Redmine::ControllerTest
{:login => 'Smith', :firstname => 'John', :lastname => 'Doe', :mail => 'foo2@example.net', :auth_source_id => 1}
])
- get :autocomplete_for_new_user, :term => 'foo'
+ get :autocomplete_for_new_user, :params => {
+ :term => 'foo'
+ }
assert_response :success
assert_equal 'application/json', response.content_type
json = ActiveSupport::JSON.decode(response.body)
diff --git a/test/functional/auto_completes_controller_test.rb b/test/functional/auto_completes_controller_test.rb
index d02addc1a..5b8260c75 100644
--- a/test/functional/auto_completes_controller_test.rb
+++ b/test/functional/auto_completes_controller_test.rb
@@ -29,49 +29,73 @@ class AutoCompletesControllerTest < Redmine::ControllerTest
:journals, :journal_details
def test_issues_should_not_be_case_sensitive
- get :issues, :project_id => 'ecookbook', :q => 'ReCiPe'
+ get :issues, :params => {
+ :project_id => 'ecookbook',
+ :q => 'ReCiPe'
+ }
assert_response :success
assert_include "recipe", response.body
end
def test_issues_should_accept_term_param
- get :issues, :project_id => 'ecookbook', :term => 'ReCiPe'
+ get :issues, :params => {
+ :project_id => 'ecookbook',
+ :term => 'ReCiPe'
+ }
assert_response :success
assert_include "recipe", response.body
end
def test_issues_should_return_issue_with_given_id
- get :issues, :project_id => 'subproject1', :q => '13'
+ get :issues, :params => {
+ :project_id => 'subproject1',
+ :q => '13'
+ }
assert_response :success
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'
+ get :issues, :params => {
+ :project_id => 'subproject1',
+ :q => '#13'
+ }
assert_response :success
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'
+ get :issues, :params => {
+ :project_id => 'ecookbook',
+ :q => '13',
+ :scope => 'all'
+ }
assert_response :success
assert_include "Bug #13", response.body
end
def test_auto_complete_without_project_should_search_all_projects
- get :issues, :q => '13'
+ get :issues, :params => {
+ :q => '13'
+ }
assert_response :success
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'
+ get :issues, :params => {
+ :project_id => 'ecookbook',
+ :q => '13'
+ }
assert_response :success
assert_not_include "Bug #13", response.body
end
def test_issues_should_return_json
- get :issues, :project_id => 'subproject1', :q => '13'
+ get :issues, :params => {
+ :project_id => 'subproject1',
+ :q => '13'
+ }
assert_response :success
json = ActiveSupport::JSON.decode(response.body)
assert_kind_of Array, json
@@ -83,21 +107,33 @@ class AutoCompletesControllerTest < Redmine::ControllerTest
end
def test_auto_complete_with_status_o_should_return_open_issues_only
- get :issues, :project_id => 'ecookbook', :q => 'issue', :status => 'o'
+ get :issues, :params => {
+ :project_id => 'ecookbook',
+ :q => 'issue',
+ :status => 'o'
+ }
assert_response :success
assert_include "Issue due today", response.body
assert_not_include "closed", response.body
end
def test_auto_complete_with_status_c_should_return_closed_issues_only
- get :issues, :project_id => 'ecookbook', :q => 'issue', :status => 'c'
+ get :issues, :params => {
+ :project_id => 'ecookbook',
+ :q => 'issue',
+ :status => 'c'
+ }
assert_response :success
assert_include "closed", response.body
assert_not_include "Issue due today", response.body
end
def test_auto_complete_with_issue_id_should_not_return_that_issue
- get :issues, :project_id => 'ecookbook', :q => 'issue', :issue_id => '12'
+ get :issues, :params => {
+ :project_id => 'ecookbook',
+ :q => 'issue',
+ :issue_id => '12'
+ }
assert_response :success
assert_include "issue", response.body
assert_not_include "Bug #12: Closed issue on a locked version", response.body
diff --git a/test/functional/boards_controller_test.rb b/test/functional/boards_controller_test.rb
index f395769ec..0b500249d 100644
--- a/test/functional/boards_controller_test.rb
+++ b/test/functional/boards_controller_test.rb
@@ -25,20 +25,26 @@ class BoardsControllerTest < Redmine::ControllerTest
end
def test_index
- get :index, :project_id => 1
+ get :index, :params => {
+ :project_id => 1
+ }
assert_response :success
assert_select 'table.boards'
end
def test_index_not_found
- get :index, :project_id => 97
+ get :index, :params => {
+ :project_id => 97
+ }
assert_response 404
end
def test_index_should_show_messages_if_only_one_board
Project.find(1).boards.to_a.slice(1..-1).each(&:destroy)
- get :index, :project_id => 1
+ get :index, :params => {
+ :project_id => 1
+ }
assert_response :success
assert_select 'table.boards', 0
@@ -46,7 +52,10 @@ class BoardsControllerTest < Redmine::ControllerTest
end
def test_show
- get :show, :project_id => 1, :id => 1
+ get :show, :params => {
+ :project_id => 1,
+ :id => 1
+ }
assert_response :success
assert_select 'table.messages tbody' do
@@ -58,7 +67,10 @@ class BoardsControllerTest < Redmine::ControllerTest
Message.update_all(:sticky => 0)
Message.where({:id => 1}).update_all({:sticky => 1})
- get :show, :project_id => 1, :id => 1
+ get :show, :params => {
+ :project_id => 1,
+ :id => 1
+ }
assert_response :success
assert_select 'table.messages tbody' do
@@ -77,7 +89,10 @@ class BoardsControllerTest < Redmine::ControllerTest
reply = Message.new(:board_id => 1, :subject => 'New reply', :content => 'New reply', :author_id => 2)
old_topic.children << reply
- get :show, :project_id => 1, :id => 1
+ get :show, :params => {
+ :project_id => 1,
+ :id => 1
+ }
assert_response :success
assert_select 'table.messages tbody' do
@@ -88,7 +103,10 @@ class BoardsControllerTest < Redmine::ControllerTest
def test_show_with_permission_should_display_the_new_message_form
@request.session[:user_id] = 2
- get :show, :project_id => 1, :id => 1
+ get :show, :params => {
+ :project_id => 1,
+ :id => 1
+ }
assert_response :success
assert_select 'form#message-form' do
@@ -97,20 +115,29 @@ class BoardsControllerTest < Redmine::ControllerTest
end
def test_show_atom
- get :show, :project_id => 1, :id => 1, :format => 'atom'
+ get :show, :params => {
+ :project_id => 1,
+ :id => 1,
+ :format => 'atom'
+ }
assert_response :success
assert_select 'feed > entry > title', :text => 'Help: RE: post 2'
end
def test_show_not_found
- get :index, :project_id => 1, :id => 97
+ get :index, :params => {
+ :project_id => 1,
+ :id => 97
+ }
assert_response 404
end
def test_new
@request.session[:user_id] = 2
- get :new, :project_id => 1
+ get :new, :params => {
+ :project_id => 1
+ }
assert_response :success
assert_select 'select[name=?]', 'board[parent_id]' do
@@ -128,7 +155,9 @@ class BoardsControllerTest < Redmine::ControllerTest
Project.find(1).boards.delete_all
@request.session[:user_id] = 2
- get :new, :project_id => 1
+ get :new, :params => {
+ :project_id => 1
+ }
assert_response :success
assert_select 'select[name=?]', 'board[parent_id]', 0
@@ -137,7 +166,13 @@ class BoardsControllerTest < Redmine::ControllerTest
def test_create
@request.session[:user_id] = 2
assert_difference 'Board.count' do
- post :create, :project_id => 1, :board => { :name => 'Testing', :description => 'Testing board creation'}
+ post :create, :params => {
+ :project_id => 1,
+ :board => {
+ :name => 'Testing',
+ :description => 'Testing board creation'
+ }
+ }
end
assert_redirected_to '/projects/ecookbook/settings/boards'
board = Board.order('id DESC').first
@@ -148,7 +183,14 @@ class BoardsControllerTest < Redmine::ControllerTest
def test_create_with_parent
@request.session[:user_id] = 2
assert_difference 'Board.count' do
- post :create, :project_id => 1, :board => { :name => 'Testing', :description => 'Testing', :parent_id => 2}
+ post :create, :params => {
+ :project_id => 1,
+ :board => {
+ :name => 'Testing',
+ :description => 'Testing',
+ :parent_id => 2
+ }
+ }
end
assert_redirected_to '/projects/ecookbook/settings/boards'
board = Board.order('id DESC').first
@@ -158,7 +200,13 @@ class BoardsControllerTest < Redmine::ControllerTest
def test_create_with_failure
@request.session[:user_id] = 2
assert_no_difference 'Board.count' do
- post :create, :project_id => 1, :board => { :name => '', :description => 'Testing board creation'}
+ post :create, :params => {
+ :project_id => 1,
+ :board => {
+ :name => '',
+ :description => 'Testing board creation'
+ }
+ }
end
assert_response :success
assert_select_error /Name cannot be blank/
@@ -166,7 +214,10 @@ class BoardsControllerTest < Redmine::ControllerTest
def test_edit
@request.session[:user_id] = 2
- get :edit, :project_id => 1, :id => 2
+ get :edit, :params => {
+ :project_id => 1,
+ :id => 2
+ }
assert_response :success
assert_select 'input[name=?][value=?]', 'board[name]', 'Discussion'
end
@@ -174,7 +225,10 @@ class BoardsControllerTest < Redmine::ControllerTest
def test_edit_with_parent
board = Board.generate!(:project_id => 1, :parent_id => 2)
@request.session[:user_id] = 2
- get :edit, :project_id => 1, :id => board.id
+ get :edit, :params => {
+ :project_id => 1,
+ :id => board.id
+ }
assert_response :success
assert_select 'select[name=?]', 'board[parent_id]' do
@@ -185,7 +239,14 @@ class BoardsControllerTest < Redmine::ControllerTest
def test_update
@request.session[:user_id] = 2
assert_no_difference 'Board.count' do
- put :update, :project_id => 1, :id => 2, :board => { :name => 'Testing', :description => 'Testing board update'}
+ put :update, :params => {
+ :project_id => 1,
+ :id => 2,
+ :board => {
+ :name => 'Testing',
+ :description => 'Testing board update'
+ }
+ }
end
assert_redirected_to '/projects/ecookbook/settings/boards'
assert_equal 'Testing', Board.find(2).name
@@ -193,7 +254,13 @@ class BoardsControllerTest < Redmine::ControllerTest
def test_update_position
@request.session[:user_id] = 2
- put :update, :project_id => 1, :id => 2, :board => { :position => 1}
+ put :update, :params => {
+ :project_id => 1,
+ :id => 2,
+ :board => {
+ :position => 1
+ }
+ }
assert_redirected_to '/projects/ecookbook/settings/boards'
board = Board.find(2)
assert_equal 1, board.position
@@ -201,7 +268,14 @@ class BoardsControllerTest < Redmine::ControllerTest
def test_update_with_failure
@request.session[:user_id] = 2
- put :update, :project_id => 1, :id => 2, :board => { :name => '', :description => 'Testing board update'}
+ put :update, :params => {
+ :project_id => 1,
+ :id => 2,
+ :board => {
+ :name => '',
+ :description => 'Testing board update'
+ }
+ }
assert_response :success
assert_select_error /Name cannot be blank/
end
@@ -209,7 +283,10 @@ class BoardsControllerTest < Redmine::ControllerTest
def test_destroy
@request.session[:user_id] = 2
assert_difference 'Board.count', -1 do
- delete :destroy, :project_id => 1, :id => 2
+ delete :destroy, :params => {
+ :project_id => 1,
+ :id => 2
+ }
end
assert_redirected_to '/projects/ecookbook/settings/boards'
assert_nil Board.find_by_id(2)
diff --git a/test/functional/calendars_controller_test.rb b/test/functional/calendars_controller_test.rb
index 453e51e23..7c3a5ffcd 100644
--- a/test/functional/calendars_controller_test.rb
+++ b/test/functional/calendars_controller_test.rb
@@ -32,14 +32,18 @@ class CalendarsControllerTest < Redmine::ControllerTest
:enumerations
def test_show
- get :show, :project_id => 1
+ get :show, :params => {
+ :project_id => 1
+ }
assert_response :success
end
def test_show_should_run_custom_queries
@query = IssueQuery.create!(:name => 'Calendar Query', :visibility => IssueQuery::VISIBILITY_PUBLIC)
- get :show, :query_id => @query.id
+ get :show, :params => {
+ :query_id => @query.id
+ }
assert_response :success
assert_select 'h2', :text => 'Calendar Query'
end
@@ -51,7 +55,10 @@ class CalendarsControllerTest < Redmine::ControllerTest
def test_week_number_calculation
with_settings :start_of_week => 7 do
- get :show, :month => '1', :year => '2010'
+ get :show, :params => {
+ :month => '1',
+ :year => '2010'
+ }
assert_response :success
end
@@ -68,7 +75,10 @@ class CalendarsControllerTest < Redmine::ControllerTest
end
with_settings :start_of_week => 1 do
- get :show, :month => '1', :year => '2010'
+ get :show, :params => {
+ :month => '1',
+ :year => '2010'
+ }
assert_response :success
end
diff --git a/test/functional/comments_controller_test.rb b/test/functional/comments_controller_test.rb
index 9ba469eed..466617b8c 100644
--- a/test/functional/comments_controller_test.rb
+++ b/test/functional/comments_controller_test.rb
@@ -26,7 +26,12 @@ class CommentsControllerTest < Redmine::ControllerTest
def test_add_comment
@request.session[:user_id] = 2
- post :create, :id => 1, :comment => { :comments => 'This is a test comment' }
+ post :create, :params => {
+ :id => 1,
+ :comment => {
+ :comments => 'This is a test comment'
+ }
+ }
assert_redirected_to '/news/1'
comment = News.find(1).comments.last
@@ -38,7 +43,12 @@ class CommentsControllerTest < Redmine::ControllerTest
def test_empty_comment_should_not_be_added
@request.session[:user_id] = 2
assert_no_difference 'Comment.count' do
- post :create, :id => 1, :comment => { :comments => '' }
+ post :create, :params => {
+ :id => 1,
+ :comment => {
+ :comments => ''
+ }
+ }
assert_response :redirect
assert_redirected_to '/news/1'
end
@@ -48,7 +58,12 @@ class CommentsControllerTest < Redmine::ControllerTest
News.any_instance.stubs(:commentable?).returns(false)
@request.session[:user_id] = 2
assert_no_difference 'Comment.count' do
- post :create, :id => 1, :comment => { :comments => 'This is a test comment' }
+ post :create, :params => {
+ :id => 1,
+ :comment => {
+ :comments => 'This is a test comment'
+ }
+ }
assert_response 403
end
end
@@ -56,7 +71,10 @@ class CommentsControllerTest < Redmine::ControllerTest
def test_destroy_comment
comments_count = News.find(1).comments.size
@request.session[:user_id] = 2
- delete :destroy, :id => 1, :comment_id => 2
+ delete :destroy, :params => {
+ :id => 1,
+ :comment_id => 2
+ }
assert_redirected_to '/news/1'
assert_nil Comment.find_by_id(2)
assert_equal comments_count - 1, News.find(1).comments.size
diff --git a/test/functional/context_menus_controller_test.rb b/test/functional/context_menus_controller_test.rb
index 58ca8d094..0f91f00cb 100644
--- a/test/functional/context_menus_controller_test.rb
+++ b/test/functional/context_menus_controller_test.rb
@@ -35,7 +35,9 @@ class ContextMenusControllerTest < Redmine::ControllerTest
def test_context_menu_one_issue
@request.session[:user_id] = 2
- get :issues, :ids => [1]
+ get :issues, :params => {
+ :ids => [1]
+ }
assert_response :success
assert_select 'a.icon-edit[href=?]', '/issues/1/edit', :text => 'Edit'
@@ -56,7 +58,9 @@ class ContextMenusControllerTest < Redmine::ControllerTest
def test_context_menu_one_issue_by_anonymous
with_settings :default_language => 'en' do
- get :issues, :ids => [1]
+ get :issues, :params => {
+ :ids => [1]
+ }
assert_response :success
assert_select 'a.icon-del.disabled[href="#"]', :text => 'Delete'
@@ -65,7 +69,9 @@ class ContextMenusControllerTest < Redmine::ControllerTest
def test_context_menu_multiple_issues_of_same_project
@request.session[:user_id] = 2
- get :issues, :ids => [1, 2]
+ get :issues, :params => {
+ :ids => [1, 2]
+ }
assert_response :success
ids = [1, 2].map {|i| "ids%5B%5D=#{i}"}.join('&')
@@ -81,7 +87,9 @@ class ContextMenusControllerTest < Redmine::ControllerTest
def test_context_menu_multiple_issues_of_different_projects
@request.session[:user_id] = 2
- get :issues, :ids => [1, 2, 6]
+ get :issues, :params => {
+ :ids => [1, 2, 6]
+ }
assert_response :success
ids = [1, 2, 6].map {|i| "ids%5B%5D=#{i}"}.join('&')
@@ -98,7 +106,9 @@ class ContextMenusControllerTest < Redmine::ControllerTest
field = IssueCustomField.create!(:name => 'List', :field_format => 'list',
:possible_values => ['Foo', 'Bar'], :is_for_all => true, :tracker_ids => [1, 2, 3])
@request.session[:user_id] = 2
- get :issues, :ids => [1]
+ get :issues, :params => {
+ :ids => [1]
+ }
assert_select "li.cf_#{field.id}" do
assert_select 'a[href="#"]', :text => 'List'
@@ -114,7 +124,9 @@ class ContextMenusControllerTest < Redmine::ControllerTest
field = IssueCustomField.create!(:name => 'List', :is_required => true, :field_format => 'list',
:possible_values => ['Foo', 'Bar'], :is_for_all => true, :tracker_ids => [1, 2, 3])
@request.session[:user_id] = 2
- get :issues, :ids => [1, 2]
+ get :issues, :params => {
+ :ids => [1, 2]
+ }
assert_select "li.cf_#{field.id}" do
assert_select 'a[href="#"]', :text => 'List'
@@ -132,7 +144,9 @@ class ContextMenusControllerTest < Redmine::ControllerTest
issue.custom_field_values = {field.id => 'Bar'}
issue.save!
@request.session[:user_id] = 2
- get :issues, :ids => [1]
+ get :issues, :params => {
+ :ids => [1]
+ }
assert_select "li.cf_#{field.id}" do
assert_select 'a[href="#"]', :text => 'List'
@@ -147,7 +161,9 @@ class ContextMenusControllerTest < Redmine::ControllerTest
field = IssueCustomField.create!(:name => 'Bool', :field_format => 'bool',
:is_for_all => true, :tracker_ids => [1, 2, 3])
@request.session[:user_id] = 2
- get :issues, :ids => [1]
+ get :issues, :params => {
+ :ids => [1]
+ }
assert_select "li.cf_#{field.id}" do
assert_select 'a[href="#"]', :text => 'Bool'
@@ -164,7 +180,9 @@ class ContextMenusControllerTest < Redmine::ControllerTest
field = IssueCustomField.create!(:name => 'User', :field_format => 'user',
:is_for_all => true, :tracker_ids => [1, 2, 3])
@request.session[:user_id] = 2
- get :issues, :ids => [1]
+ get :issues, :params => {
+ :ids => [1]
+ }
assert_select "li.cf_#{field.id}" do
assert_select 'a[href="#"]', :text => 'User'
@@ -179,7 +197,9 @@ class ContextMenusControllerTest < Redmine::ControllerTest
def test_context_menu_should_include_version_custom_fields
field = IssueCustomField.create!(:name => 'Version', :field_format => 'version', :is_for_all => true, :tracker_ids => [1, 2, 3])
@request.session[:user_id] = 2
- get :issues, :ids => [1]
+ get :issues, :params => {
+ :ids => [1]
+ }
assert_select "li.cf_#{field.id}" do
assert_select 'a[href="#"]', :text => 'Version'
@@ -197,7 +217,9 @@ class ContextMenusControllerTest < Redmine::ControllerTest
issue = Issue.generate!(:project_id => 1, :tracker_id => 1)
@request.session[:user_id] = 2
- get :issues, :ids => [issue.id]
+ get :issues, :params => {
+ :ids => [issue.id]
+ }
assert_select "li.cf_#{enabled_cf.id}"
assert_select "li.cf_#{disabled_cf.id}", 0
@@ -205,7 +227,9 @@ class ContextMenusControllerTest < Redmine::ControllerTest
def test_context_menu_by_assignable_user_should_include_assigned_to_me_link
@request.session[:user_id] = 2
- get :issues, :ids => [1]
+ get :issues, :params => {
+ :ids => [1]
+ }
assert_response :success
assert_select 'a[href=?]', '/issues/bulk_update?ids%5B%5D=1&issue%5Bassigned_to_id%5D=2', :text => / me /
@@ -215,14 +239,18 @@ class ContextMenusControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
version = Version.create!(:name => 'Shared', :sharing => 'system', :project_id => 1)
- get :issues, :ids => [1, 4]
+ get :issues, :params => {
+ :ids => [1, 4]
+ }
assert_response :success
assert_select 'a', :text => 'eCookbook - Shared'
end
def test_context_menu_with_issue_that_is_not_visible_should_fail
- get :issues, :ids => [1, 4] # issue 4 is not visible
+ get :issues, :params => {
+ :ids => [1, 4] # issue 4 is not visible
+ }
assert_response 302
end
@@ -233,7 +261,9 @@ class ContextMenusControllerTest < Redmine::ControllerTest
def test_time_entries_context_menu
@request.session[:user_id] = 2
- get :time_entries, :ids => [1, 2]
+ get :time_entries, :params => {
+ :ids => [1, 2]
+ }
assert_response :success
assert_select 'a:not(.disabled)', :text => 'Edit'
@@ -241,7 +271,9 @@ class ContextMenusControllerTest < Redmine::ControllerTest
def test_context_menu_for_one_time_entry
@request.session[:user_id] = 2
- get :time_entries, :ids => [1]
+ get :time_entries, :params => {
+ :ids => [1]
+ }
assert_response :success
assert_select 'a:not(.disabled)', :text => 'Edit'
@@ -251,7 +283,9 @@ class ContextMenusControllerTest < Redmine::ControllerTest
field = TimeEntryCustomField.generate!(:name => "Field", :field_format => "list", :possible_values => ["foo", "bar"])
@request.session[:user_id] = 2
- get :time_entries, :ids => [1, 2]
+ get :time_entries, :params => {
+ :ids => [1, 2]
+ }
assert_response :success
assert_select "li.cf_#{field.id}" do
@@ -271,7 +305,9 @@ class ContextMenusControllerTest < Redmine::ControllerTest
Role.find_by_name('Manager').add_permission! :edit_own_time_entries
ids = (0..1).map {TimeEntry.generate!(:user => User.find(2)).id}
- get :time_entries, :ids => ids
+ get :time_entries, :params => {
+ :ids => ids
+ }
assert_response :success
assert_select 'a:not(.disabled)', :text => 'Edit'
@@ -281,7 +317,9 @@ class ContextMenusControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
Role.find_by_name('Manager').remove_permission! :edit_time_entries
- get :time_entries, :ids => [1, 2]
+ get :time_entries, :params => {
+ :ids => [1, 2]
+ }
assert_response :success
assert_select 'a.disabled', :text => 'Edit'
diff --git a/test/functional/custom_field_enumerations_controller_test.rb b/test/functional/custom_field_enumerations_controller_test.rb
index 539600125..913517ae1 100644
--- a/test/functional/custom_field_enumerations_controller_test.rb
+++ b/test/functional/custom_field_enumerations_controller_test.rb
@@ -30,7 +30,9 @@ class CustomFieldEnumerationsControllerTest < Redmine::ControllerTest
end
def test_index
- get :index, :custom_field_id => @field.id
+ get :index, :params => {
+ :custom_field_id => @field.id
+ }
assert_response :success
assert_select 'ul#custom_field_enumerations' do
@@ -40,7 +42,12 @@ class CustomFieldEnumerationsControllerTest < Redmine::ControllerTest
def test_create
assert_difference 'CustomFieldEnumeration.count' do
- post :create, :custom_field_id => @field.id, :custom_field_enumeration => { :name => 'Baz' }
+ post :create, :params => {
+ :custom_field_id => @field.id,
+ :custom_field_enumeration => {
+ :name => 'Baz'
+ }
+ }
assert_redirected_to "/custom_fields/#{@field.id}/enumerations"
end
@@ -53,16 +60,34 @@ class CustomFieldEnumerationsControllerTest < Redmine::ControllerTest
def test_create_xhr
assert_difference 'CustomFieldEnumeration.count' do
- xhr :post, :create, :custom_field_id => @field.id, :custom_field_enumeration => { :name => 'Baz' }
+ post :create, :params => {
+ :custom_field_id => @field.id,
+ :custom_field_enumeration => {
+ :name => 'Baz'
+ }
+ },
+ :xhr => true
assert_response :success
end
end
def test_update_each
- put :update_each, :custom_field_id => @field.id, :custom_field_enumerations => {
- @bar.id => {:position => "1", :name => "Baz", :active => "1"},
- @foo.id => {:position => "2", :name => "Foo", :active => "0"}
- }
+ put :update_each, :params => {
+ :custom_field_id => @field.id,
+ :custom_field_enumerations => {
+ @bar.id => {
+ :position => "1",
+ :name => "Baz",
+ :active => "1"
+ },
+ @foo.id => {
+ :position => "2",
+ :name => "Foo",
+ :active => "0"
+ }
+
+ }
+ }
assert_response 302
@bar.reload
@@ -78,7 +103,10 @@ class CustomFieldEnumerationsControllerTest < Redmine::ControllerTest
def test_destroy
assert_difference 'CustomFieldEnumeration.count', -1 do
- delete :destroy, :custom_field_id => @field.id, :id => @foo.id
+ delete :destroy, :params => {
+ :custom_field_id => @field.id,
+ :id => @foo.id
+ }
assert_redirected_to "/custom_fields/#{@field.id}/enumerations"
end
@@ -93,7 +121,10 @@ class CustomFieldEnumerationsControllerTest < Redmine::ControllerTest
group.save!
assert_no_difference 'CustomFieldEnumeration.count' do
- delete :destroy, :custom_field_id => @field.id, :id => @foo.id
+ delete :destroy, :params => {
+ :custom_field_id => @field.id,
+ :id => @foo.id
+ }
assert_response :success
assert_select 'select[name=?]', 'reassign_to_id'
@@ -106,7 +137,11 @@ class CustomFieldEnumerationsControllerTest < Redmine::ControllerTest
group.save!
assert_difference 'CustomFieldEnumeration.count', -1 do
- delete :destroy, :custom_field_id => @field.id, :id => @foo.id, :reassign_to_id => @bar.id
+ delete :destroy, :params => {
+ :custom_field_id => @field.id,
+ :id => @foo.id,
+ :reassign_to_id => @bar.id
+ }
assert_response 302
end
diff --git a/test/functional/custom_fields_controller_test.rb b/test/functional/custom_fields_controller_test.rb
index 70fbb837e..f0227b12a 100644
--- a/test/functional/custom_fields_controller_test.rb
+++ b/test/functional/custom_fields_controller_test.rb
@@ -53,7 +53,12 @@ class CustomFieldsControllerTest < Redmine::ControllerTest
def test_new_should_work_for_each_customized_class_and_format
custom_field_classes.each do |klass|
Redmine::FieldFormat.formats_for_custom_field_class(klass).each do |format|
- get :new, :type => klass.name, :custom_field => {:field_format => format.name}
+ get :new, :params => {
+ :type => klass.name,
+ :custom_field => {
+ :field_format => format.name
+ }
+ }
assert_response :success
assert_select 'form#custom_field_form' do
@@ -67,7 +72,9 @@ class CustomFieldsControllerTest < Redmine::ControllerTest
end
def test_new_should_have_string_default_format
- get :new, :type => 'IssueCustomField'
+ get :new, :params => {
+ :type => 'IssueCustomField'
+ }
assert_response :success
assert_select 'select[name=?]', 'custom_field[field_format]' do
@@ -76,7 +83,9 @@ class CustomFieldsControllerTest < Redmine::ControllerTest
end
def test_new_issue_custom_field
- get :new, :type => 'IssueCustomField'
+ get :new, :params => {
+ :type => 'IssueCustomField'
+ }
assert_response :success
assert_select 'form#custom_field_form' do
@@ -91,7 +100,9 @@ class CustomFieldsControllerTest < Redmine::ControllerTest
end
def test_new_time_entry_custom_field_should_not_show_trackers_and_projects
- get :new, :type => 'TimeEntryCustomField'
+ get :new, :params => {
+ :type => 'TimeEntryCustomField'
+ }
assert_response :success
assert_select 'form#custom_field_form' do
@@ -101,19 +112,34 @@ class CustomFieldsControllerTest < Redmine::ControllerTest
end
def test_default_value_should_be_an_input_for_string_custom_field
- get :new, :type => 'IssueCustomField', :custom_field => {:field_format => 'string'}
+ get :new, :params => {
+ :type => 'IssueCustomField',
+ :custom_field => {
+ :field_format => 'string'
+ }
+ }
assert_response :success
assert_select 'input[name=?]', 'custom_field[default_value]'
end
def test_default_value_should_be_a_textarea_for_text_custom_field
- get :new, :type => 'IssueCustomField', :custom_field => {:field_format => 'text'}
+ get :new, :params => {
+ :type => 'IssueCustomField',
+ :custom_field => {
+ :field_format => 'text'
+ }
+ }
assert_response :success
assert_select 'textarea[name=?]', 'custom_field[default_value]'
end
def test_default_value_should_be_a_checkbox_for_bool_custom_field
- get :new, :type => 'IssueCustomField', :custom_field => {:field_format => 'bool'}
+ get :new, :params => {
+ :type => 'IssueCustomField',
+ :custom_field => {
+ :field_format => 'bool'
+ }
+ }
assert_response :success
assert_select 'select[name=?]', 'custom_field[default_value]' do
assert_select 'option', 3
@@ -121,27 +147,54 @@ class CustomFieldsControllerTest < Redmine::ControllerTest
end
def test_default_value_should_not_be_present_for_user_custom_field
- get :new, :type => 'IssueCustomField', :custom_field => {:field_format => 'user'}
+ get :new, :params => {
+ :type => 'IssueCustomField',
+ :custom_field => {
+ :field_format => 'user'
+ }
+ }
assert_response :success
assert_select '[name=?]', 'custom_field[default_value]', 0
end
def test_setting_full_width_layout_shoul_be_present_only_for_long_text_issue_custom_field
- get :new, :type => 'IssueCustomField', :custom_field => {:field_format => 'text'}
+ get :new, :params => {
+ :type => 'IssueCustomField',
+ :custom_field => {
+ :field_format => 'text'
+ }
+ }
assert_response :success
assert_select '[name=?]', 'custom_field[full_width_layout]'
- get :new, :type => 'IssueCustomField', :custom_field => {:field_format => 'list'}
+ get :new, :params => {
+ :type => 'IssueCustomField',
+ :custom_field => {
+ :field_format => 'list'
+ }
+ }
assert_response :success
assert_select '[name=?]', 'custom_field[full_width_layout]', 0
- get :new, :type => 'TimeEntryCustomField', :custom_field => {:field_format => 'text'}
+ get :new, :params => {
+ :type => 'TimeEntryCustomField',
+ :custom_field => {
+ :field_format => 'text'
+ }
+ }
assert_response :success
assert_select '[name=?]', 'custom_field[full_width_layout]', 0
end
def test_new_js
- xhr :get, :new, :type => 'IssueCustomField', :custom_field => {:field_format => 'list'}, :format => 'js'
+ get :new, :params => {
+ :type => 'IssueCustomField',
+ :custom_field => {
+ :field_format => 'list'
+ },
+ :format => 'js'
+ },
+ :xhr => true
assert_response :success
assert_equal 'text/javascript', response.content_type
@@ -149,7 +202,9 @@ class CustomFieldsControllerTest < Redmine::ControllerTest
end
def test_new_with_invalid_custom_field_class_should_render_select_type
- get :new, :type => 'UnknownCustomField'
+ get :new, :params => {
+ :type => 'UnknownCustomField'
+ }
assert_response :success
assert_select 'input[type=radio][name=type]'
@@ -157,19 +212,23 @@ class CustomFieldsControllerTest < Redmine::ControllerTest
def test_create_list_custom_field
field = new_record(IssueCustomField) do
- post :create, :type => "IssueCustomField",
- :custom_field => {:name => "test_post_new_list",
- :default_value => "",
- :min_length => "0",
- :searchable => "0",
- :regexp => "",
- :is_for_all => "1",
- :possible_values => "0.1\n0.2\n",
- :max_length => "0",
- :is_filter => "0",
- :is_required =>"0",
- :field_format => "list",
- :tracker_ids => ["1", ""]}
+ post :create, :params => {
+ :type => "IssueCustomField",
+ :custom_field => {
+ :name => "test_post_new_list",
+ :default_value => "",
+ :min_length => "0",
+ :searchable => "0",
+ :regexp => "",
+ :is_for_all => "1",
+ :possible_values => "0.1\n0.2\n",
+ :max_length => "0",
+ :is_filter => "0",
+ :is_required =>"0",
+ :field_format => "list",
+ :tracker_ids => ["1", ""]
+ }
+ }
end
assert_redirected_to "/custom_fields/#{field.id}/edit"
assert_equal "test_post_new_list", field.name
@@ -179,9 +238,16 @@ class CustomFieldsControllerTest < Redmine::ControllerTest
def test_create_with_project_ids
assert_difference 'CustomField.count' do
- post :create, :type => "IssueCustomField", :custom_field => {
- :name => "foo", :field_format => "string", :is_for_all => "0", :project_ids => ["1", "3", ""]
- }
+ post :create, :params => {
+ :type => "IssueCustomField",
+ :custom_field => {
+ :name => "foo",
+ :field_format => "string",
+ :is_for_all => "0",
+ :project_ids => ["1", "3", ""]
+
+ }
+ }
assert_response 302
end
field = IssueCustomField.order("id desc").first
@@ -190,7 +256,12 @@ class CustomFieldsControllerTest < Redmine::ControllerTest
def test_create_with_failure
assert_no_difference 'CustomField.count' do
- post :create, :type => "IssueCustomField", :custom_field => {:name => ''}
+ post :create, :params => {
+ :type => "IssueCustomField",
+ :custom_field => {
+ :name => ''
+ }
+ }
end
assert_response :success
assert_select_error /name cannot be blank/i
@@ -198,25 +269,38 @@ class CustomFieldsControllerTest < Redmine::ControllerTest
def test_create_without_type_should_render_select_type
assert_no_difference 'CustomField.count' do
- post :create, :custom_field => {:name => ''}
+ post :create, :params => {
+ :custom_field => {
+ :name => ''
+ }
+ }
end
assert_response :success
assert_select 'input[type=radio][name=type]'
end
def test_edit
- get :edit, :id => 1
+ get :edit, :params => {
+ :id => 1
+ }
assert_response :success
assert_select 'input[name=?][value=?]', 'custom_field[name]', 'Database'
end
def test_edit_invalid_custom_field_should_render_404
- get :edit, :id => 99
+ get :edit, :params => {
+ :id => 99
+ }
assert_response 404
end
def test_update
- put :update, :id => 1, :custom_field => {:name => 'New name'}
+ put :update, :params => {
+ :id => 1,
+ :custom_field => {
+ :name => 'New name'
+ }
+ }
assert_redirected_to '/custom_fields/1/edit'
field = CustomField.find(1)
@@ -224,7 +308,12 @@ class CustomFieldsControllerTest < Redmine::ControllerTest
end
def test_update_with_failure
- put :update, :id => 1, :custom_field => {:name => ''}
+ put :update, :params => {
+ :id => 1,
+ :custom_field => {
+ :name => ''
+ }
+ }
assert_response :success
assert_select_error /name cannot be blank/i
end
@@ -235,7 +324,9 @@ class CustomFieldsControllerTest < Redmine::ControllerTest
assert_difference 'CustomField.count', -1 do
assert_difference 'CustomValue.count', - custom_values_count do
- delete :destroy, :id => 1
+ delete :destroy, :params => {
+ :id => 1
+ }
end
end
diff --git a/test/functional/documents_controller_test.rb b/test/functional/documents_controller_test.rb
index ad1e6b567..21c7c4f72 100644
--- a/test/functional/documents_controller_test.rb
+++ b/test/functional/documents_controller_test.rb
@@ -31,7 +31,9 @@ class DocumentsControllerTest < Redmine::ControllerTest
e = Enumeration.find_by_name('Technical documentation')
e.update_attributes(:is_default => true)
- get :index, :project_id => 'ecookbook'
+ get :index, :params => {
+ :project_id => 'ecookbook'
+ }
assert_response :success
# Default category selected in the new document form
@@ -44,19 +46,28 @@ class DocumentsControllerTest < Redmine::ControllerTest
end
def test_index_grouped_by_date
- get :index, :project_id => 'ecookbook', :sort_by => 'date'
+ get :index, :params => {
+ :project_id => 'ecookbook',
+ :sort_by => 'date'
+ }
assert_response :success
assert_select 'h3', :text => '2007-02-12'
end
def test_index_grouped_by_title
- get :index, :project_id => 'ecookbook', :sort_by => 'title'
+ get :index, :params => {
+ :project_id => 'ecookbook',
+ :sort_by => 'title'
+ }
assert_response :success
assert_select 'h3', :text => 'T'
end
def test_index_grouped_by_author
- get :index, :project_id => 'ecookbook', :sort_by => 'author'
+ get :index, :params => {
+ :project_id => 'ecookbook',
+ :sort_by => 'author'
+ }
assert_response :success
assert_select 'h3', :text => 'John Smith'
end
@@ -70,7 +81,9 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut egestas, mi vehicula
Vestibulum non velit mi. Aliquam scelerisque libero ut nulla fringilla a sollicitudin magna rhoncus. Praesent a nunc lorem, ac porttitor eros. Sed ac diam nec neque interdum adipiscing quis quis justo. Donec arcu nunc, fringilla eu dictum at, venenatis ac sem. Vestibulum quis elit urna, ac mattis sapien. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
LOREM
- get :index, :project_id => 'ecookbook'
+ get :index, :params => {
+ :project_id => 'ecookbook'
+ }
assert_response :success
# should only truncate on new lines to avoid breaking wiki formatting
@@ -79,13 +92,17 @@ LOREM
end
def test_show
- get :show, :id => 1
+ get :show, :params => {
+ :id => 1
+ }
assert_response :success
end
def test_new
@request.session[:user_id] = 2
- get :new, :project_id => 1
+ get :new, :params => {
+ :project_id => 1
+ }
assert_response :success
end
@@ -95,11 +112,18 @@ LOREM
set_tmp_attachments_directory
with_settings :notified_events => %w(document_added) do
- post :create, :project_id => 'ecookbook',
- :document => { :title => 'DocumentsControllerTest#test_post_new',
- :description => 'This is a new document',
- :category_id => 2},
- :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}}
+ post :create, :params => {
+ :project_id => 'ecookbook',
+ :document => {
+ :title => 'DocumentsControllerTest#test_post_new',
+ :description => 'This is a new document',
+ :category_id => 2
+ },
+ :attachments => {
+ '1' => {
+ 'file' => uploaded_test_file('testfile.txt', 'text/plain')}
+ }
+ }
end
assert_redirected_to '/projects/ecookbook/documents'
@@ -114,7 +138,12 @@ LOREM
def test_create_with_failure
@request.session[:user_id] = 2
assert_no_difference 'Document.count' do
- post :create, :project_id => 'ecookbook', :document => { :title => ''}
+ post :create, :params => {
+ :project_id => 'ecookbook',
+ :document => {
+ :title => ''
+ }
+ }
end
assert_response :success
assert_select_error /title cannot be blank/i
@@ -125,11 +154,14 @@ LOREM
category2 = Enumeration.find_by_name('User documentation')
category2.update_attributes(:is_default => true)
category1 = Enumeration.find_by_name('Uncategorized')
- post :create,
- :project_id => 'ecookbook',
- :document => { :title => 'no default',
- :description => 'This is a new document',
- :category_id => category1.id }
+ post :create, :params => {
+ :project_id => 'ecookbook',
+ :document => {
+ :title => 'no default',
+ :description => 'This is a new document',
+ :category_id => category1.id
+ }
+ }
assert_redirected_to '/projects/ecookbook/documents'
doc = Document.find_by_title('no default')
assert_not_nil doc
@@ -139,13 +171,20 @@ LOREM
def test_edit
@request.session[:user_id] = 2
- get :edit, :id => 1
+ get :edit, :params => {
+ :id => 1
+ }
assert_response :success
end
def test_update
@request.session[:user_id] = 2
- put :update, :id => 1, :document => {:title => 'test_update'}
+ put :update, :params => {
+ :id => 1,
+ :document => {
+ :title => 'test_update'
+ }
+ }
assert_redirected_to '/documents/1'
document = Document.find(1)
assert_equal 'test_update', document.title
@@ -153,7 +192,12 @@ LOREM
def test_update_with_failure
@request.session[:user_id] = 2
- put :update, :id => 1, :document => {:title => ''}
+ put :update, :params => {
+ :id => 1,
+ :document => {
+ :title => ''
+ }
+ }
assert_response :success
assert_select_error /title cannot be blank/i
end
@@ -161,7 +205,9 @@ LOREM
def test_destroy
@request.session[:user_id] = 2
assert_difference 'Document.count', -1 do
- delete :destroy, :id => 1
+ delete :destroy, :params => {
+ :id => 1
+ }
end
assert_redirected_to '/projects/ecookbook/documents'
assert_nil Document.find_by_id(1)
@@ -170,8 +216,13 @@ LOREM
def test_add_attachment
@request.session[:user_id] = 2
assert_difference 'Attachment.count' do
- post :add_attachment, :id => 1,
- :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}}
+ post :add_attachment, :params => {
+ :id => 1,
+ :attachments => {
+ '1' => {
+ 'file' => uploaded_test_file('testfile.txt', 'text/plain')}
+ }
+ }
end
attachment = Attachment.order('id DESC').first
assert_equal Document.find(1), attachment.container
diff --git a/test/functional/email_addresses_controller_test.rb b/test/functional/email_addresses_controller_test.rb
index b6dda82da..300edcb04 100644
--- a/test/functional/email_addresses_controller_test.rb
+++ b/test/functional/email_addresses_controller_test.rb
@@ -26,7 +26,9 @@ class EmailAddressesControllerTest < Redmine::ControllerTest
def test_index_with_no_additional_emails
@request.session[:user_id] = 2
- get :index, :user_id => 2
+ get :index, :params => {
+ :user_id => 2
+ }
assert_response :success
end
@@ -34,7 +36,9 @@ class EmailAddressesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
EmailAddress.create!(:user_id => 2, :address => 'another@somenet.foo')
- get :index, :user_id => 2
+ get :index, :params => {
+ :user_id => 2
+ }
assert_response :success
assert_select '.email', :text => 'another@somenet.foo'
end
@@ -43,27 +47,39 @@ class EmailAddressesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
EmailAddress.create!(:user_id => 2, :address => 'another@somenet.foo')
- xhr :get, :index, :user_id => 2
+ get :index, :params => {
+ :user_id => 2
+ },
+ :xhr => true
assert_response :success
assert_include 'another@somenet.foo', response.body
end
def test_index_by_admin_should_be_allowed
@request.session[:user_id] = 1
- get :index, :user_id => 2
+ get :index, :params => {
+ :user_id => 2
+ }
assert_response :success
end
def test_index_by_another_user_should_be_denied
@request.session[:user_id] = 3
- get :index, :user_id => 2
+ get :index, :params => {
+ :user_id => 2
+ }
assert_response 403
end
def test_create
@request.session[:user_id] = 2
assert_difference 'EmailAddress.count' do
- post :create, :user_id => 2, :email_address => {:address => 'another@somenet.foo'}
+ post :create, :params => {
+ :user_id => 2,
+ :email_address => {
+ :address => 'another@somenet.foo'
+ }
+ }
assert_response 302
assert_redirected_to '/users/2/email_addresses'
end
@@ -75,7 +91,13 @@ class EmailAddressesControllerTest < Redmine::ControllerTest
def test_create_as_js
@request.session[:user_id] = 2
assert_difference 'EmailAddress.count' do
- xhr :post, :create, :user_id => 2, :email_address => {:address => 'another@somenet.foo'}
+ post :create, :params => {
+ :user_id => 2,
+ :email_address => {
+ :address => 'another@somenet.foo'
+ }
+ },
+ :xhr => true
assert_response 200
end
end
@@ -83,7 +105,12 @@ class EmailAddressesControllerTest < Redmine::ControllerTest
def test_create_with_failure
@request.session[:user_id] = 2
assert_no_difference 'EmailAddress.count' do
- post :create, :user_id => 2, :email_address => {:address => 'invalid'}
+ post :create, :params => {
+ :user_id => 2,
+ :email_address => {
+ :address => 'invalid'
+ }
+ }
assert_response :success
assert_select_error /email is invalid/i
end
@@ -92,7 +119,12 @@ class EmailAddressesControllerTest < Redmine::ControllerTest
def test_create_should_send_security_notification
@request.session[:user_id] = 2
ActionMailer::Base.deliveries.clear
- post :create, :user_id => 2, :email_address => {:address => 'something@example.fr'}
+ post :create, :params => {
+ :user_id => 2,
+ :email_address => {
+ :address => 'something@example.fr'
+ }
+ }
assert_not_nil (mail = ActionMailer::Base.deliveries.last)
assert_mail_body_match '0.0.0.0', mail
@@ -109,7 +141,11 @@ class EmailAddressesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
email = EmailAddress.create!(:user_id => 2, :address => 'another@somenet.foo')
- put :update, :user_id => 2, :id => email.id, :notify => '0'
+ put :update, :params => {
+ :user_id => 2,
+ :id => email.id,
+ :notify => '0'
+ }
assert_response 302
assert_equal false, email.reload.notify
@@ -119,7 +155,12 @@ class EmailAddressesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
email = EmailAddress.create!(:user_id => 2, :address => 'another@somenet.foo')
- xhr :put, :update, :user_id => 2, :id => email.id, :notify => '0'
+ put :update, :params => {
+ :user_id => 2,
+ :id => email.id,
+ :notify => '0'
+ },
+ :xhr => true
assert_response 200
assert_equal false, email.reload.notify
@@ -130,7 +171,12 @@ class EmailAddressesControllerTest < Redmine::ControllerTest
email = EmailAddress.create!(:user_id => 2, :address => 'another@somenet.foo')
ActionMailer::Base.deliveries.clear
- xhr :put, :update, :user_id => 2, :id => email.id, :notify => '0'
+ put :update, :params => {
+ :user_id => 2,
+ :id => email.id,
+ :notify => '0'
+ },
+ :xhr => true
assert_not_nil (mail = ActionMailer::Base.deliveries.last)
assert_mail_body_match I18n.t(:mail_body_security_notification_notify_disabled, value: 'another@somenet.foo'), mail
@@ -145,7 +191,10 @@ class EmailAddressesControllerTest < Redmine::ControllerTest
email = EmailAddress.create!(:user_id => 2, :address => 'another@somenet.foo')
assert_difference 'EmailAddress.count', -1 do
- delete :destroy, :user_id => 2, :id => email.id
+ delete :destroy, :params => {
+ :user_id => 2,
+ :id => email.id
+ }
assert_response 302
assert_redirected_to '/users/2/email_addresses'
end
@@ -156,7 +205,11 @@ class EmailAddressesControllerTest < Redmine::ControllerTest
email = EmailAddress.create!(:user_id => 2, :address => 'another@somenet.foo')
assert_difference 'EmailAddress.count', -1 do
- xhr :delete, :destroy, :user_id => 2, :id => email.id
+ delete :destroy, :params => {
+ :user_id => 2,
+ :id => email.id
+ },
+ :xhr => true
assert_response 200
end
end
@@ -165,7 +218,10 @@ class EmailAddressesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_no_difference 'EmailAddress.count' do
- delete :destroy, :user_id => 2, :id => User.find(2).email_address.id
+ delete :destroy, :params => {
+ :user_id => 2,
+ :id => User.find(2).email_address.id
+ }
assert_response 404
end
end
@@ -175,7 +231,11 @@ class EmailAddressesControllerTest < Redmine::ControllerTest
email = EmailAddress.create!(:user_id => 2, :address => 'another@somenet.foo')
ActionMailer::Base.deliveries.clear
- xhr :delete, :destroy, :user_id => 2, :id => email.id
+ delete :destroy, :params => {
+ :user_id => 2,
+ :id => email.id
+ },
+ :xhr => true
assert_not_nil (mail = ActionMailer::Base.deliveries.last)
assert_mail_body_match I18n.t(:mail_body_security_notification_remove, field: I18n.t(:field_mail), value: 'another@somenet.foo'), mail
diff --git a/test/functional/enumerations_controller_test.rb b/test/functional/enumerations_controller_test.rb
index b44f3f4d1..1e4dca2f8 100644
--- a/test/functional/enumerations_controller_test.rb
+++ b/test/functional/enumerations_controller_test.rb
@@ -37,7 +37,9 @@ class EnumerationsControllerTest < Redmine::ControllerTest
end
def test_new
- get :new, :type => 'IssuePriority'
+ get :new, :params => {
+ :type => 'IssuePriority'
+ }
assert_response :success
assert_select 'input[name=?][value=?]', 'enumeration[type]', 'IssuePriority'
@@ -45,13 +47,20 @@ class EnumerationsControllerTest < Redmine::ControllerTest
end
def test_new_with_invalid_type_should_respond_with_404
- get :new, :type => 'UnknownType'
+ get :new, :params => {
+ :type => 'UnknownType'
+ }
assert_response 404
end
def test_create
assert_difference 'IssuePriority.count' do
- post :create, :enumeration => {:type => 'IssuePriority', :name => 'Lowest'}
+ post :create, :params => {
+ :enumeration => {
+ :type => 'IssuePriority',
+ :name => 'Lowest'
+ }
+ }
end
assert_redirected_to '/enumerations'
e = IssuePriority.find_by_name('Lowest')
@@ -60,26 +69,41 @@ class EnumerationsControllerTest < Redmine::ControllerTest
def test_create_with_failure
assert_no_difference 'IssuePriority.count' do
- post :create, :enumeration => {:type => 'IssuePriority', :name => ''}
+ post :create, :params => {
+ :enumeration => {
+ :type => 'IssuePriority',
+ :name => ''
+ }
+ }
end
assert_response :success
assert_select_error /name cannot be blank/i
end
def test_edit
- get :edit, :id => 6
+ get :edit, :params => {
+ :id => 6
+ }
assert_response :success
assert_select 'input[name=?][value=?]', 'enumeration[name]', 'High'
end
def test_edit_invalid_should_respond_with_404
- get :edit, :id => 999
+ get :edit, :params => {
+ :id => 999
+ }
assert_response 404
end
def test_update
assert_no_difference 'IssuePriority.count' do
- put :update, :id => 6, :enumeration => {:type => 'IssuePriority', :name => 'New name'}
+ put :update, :params => {
+ :id => 6,
+ :enumeration => {
+ :type => 'IssuePriority',
+ :name => 'New name'
+ }
+ }
end
assert_redirected_to '/enumerations'
e = IssuePriority.find(6)
@@ -88,7 +112,13 @@ class EnumerationsControllerTest < Redmine::ControllerTest
def test_update_with_failure
assert_no_difference 'IssuePriority.count' do
- put :update, :id => 6, :enumeration => {:type => 'IssuePriority', :name => ''}
+ put :update, :params => {
+ :id => 6,
+ :enumeration => {
+ :type => 'IssuePriority',
+ :name => ''
+ }
+ }
end
assert_response :success
assert_select_error /name cannot be blank/i
@@ -96,7 +126,9 @@ class EnumerationsControllerTest < Redmine::ControllerTest
def test_destroy_enumeration_not_in_use
assert_difference 'IssuePriority.count', -1 do
- delete :destroy, :id => 7
+ delete :destroy, :params => {
+ :id => 7
+ }
end
assert_redirected_to :controller => 'enumerations', :action => 'index'
assert_nil Enumeration.find_by_id(7)
@@ -104,7 +136,9 @@ class EnumerationsControllerTest < Redmine::ControllerTest
def test_destroy_enumeration_in_use
assert_no_difference 'IssuePriority.count' do
- delete :destroy, :id => 4
+ delete :destroy, :params => {
+ :id => 4
+ }
end
assert_response :success
@@ -117,7 +151,10 @@ class EnumerationsControllerTest < Redmine::ControllerTest
def test_destroy_enumeration_in_use_with_reassignment
issue = Issue.where(:priority_id => 4).first
assert_difference 'IssuePriority.count', -1 do
- delete :destroy, :id => 4, :reassign_to_id => 6
+ delete :destroy, :params => {
+ :id => 4,
+ :reassign_to_id => 6
+ }
end
assert_redirected_to :controller => 'enumerations', :action => 'index'
assert_nil Enumeration.find_by_id(4)
@@ -127,7 +164,10 @@ class EnumerationsControllerTest < Redmine::ControllerTest
def test_destroy_enumeration_in_use_with_blank_reassignment
assert_no_difference 'IssuePriority.count' do
- delete :destroy, :id => 4, :reassign_to_id => ''
+ delete :destroy, :params => {
+ :id => 4,
+ :reassign_to_id => ''
+ }
end
assert_response :success
end
diff --git a/test/functional/files_controller_test.rb b/test/functional/files_controller_test.rb
index a24187db5..85cd61941 100644
--- a/test/functional/files_controller_test.rb
+++ b/test/functional/files_controller_test.rb
@@ -37,7 +37,9 @@ class FilesControllerTest < Redmine::ControllerTest
end
def test_index
- get :index, :project_id => 1
+ get :index, :params => {
+ :project_id => 1
+ }
assert_response :success
# file attached to the project
@@ -49,7 +51,9 @@ class FilesControllerTest < Redmine::ControllerTest
def test_new
@request.session[:user_id] = 2
- get :new, :project_id => 1
+ get :new, :params => {
+ :project_id => 1
+ }
assert_response :success
assert_select 'select[name=?]', 'version_id'
@@ -58,7 +62,9 @@ class FilesControllerTest < Redmine::ControllerTest
def test_new_without_versions
Version.delete_all
@request.session[:user_id] = 2
- get :new, :project_id => 1
+ get :new, :params => {
+ :project_id => 1
+ }
assert_response :success
assert_select 'select[name=?]', 'version_id', 0
@@ -71,8 +77,14 @@ class FilesControllerTest < Redmine::ControllerTest
with_settings :notified_events => %w(file_added) do
assert_difference 'Attachment.count' do
- post :create, :project_id => 1, :version_id => '',
- :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}}
+ post :create, :params => {
+ :project_id => 1,
+ :version_id => '',
+ :attachments => {
+ '1' => {
+ 'file' => uploaded_test_file('testfile.txt', 'text/plain')}
+ }
+ }
assert_response :redirect
end
end
@@ -92,8 +104,14 @@ class FilesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_difference 'Attachment.count' do
- post :create, :project_id => 1, :version_id => '2',
- :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}}
+ post :create, :params => {
+ :project_id => 1,
+ :version_id => '2',
+ :attachments => {
+ '1' => {
+ 'file' => uploaded_test_file('testfile.txt', 'text/plain')}
+ }
+ }
assert_response :redirect
end
assert_redirected_to '/projects/ecookbook/files'
@@ -107,7 +125,10 @@ class FilesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_no_difference 'Attachment.count' do
- post :create, :project_id => 1, :version_id => ''
+ post :create, :params => {
+ :project_id => 1,
+ :version_id => ''
+ }
assert_response :success
end
assert_select 'div.error', 'File is invalid'
diff --git a/test/functional/gantts_controller_test.rb b/test/functional/gantts_controller_test.rb
index abb9ca10b..bcd31ee22 100644
--- a/test/functional/gantts_controller_test.rb
+++ b/test/functional/gantts_controller_test.rb
@@ -30,7 +30,9 @@ class GanttsControllerTest < Redmine::ControllerTest
def test_gantt_should_work
i2 = Issue.find(2)
i2.update_attribute(:due_date, 1.month.from_now)
- get :show, :project_id => 1
+ get :show, :params => {
+ :project_id => 1
+ }
assert_response :success
# Issue with start and due dates
@@ -43,27 +45,37 @@ class GanttsControllerTest < Redmine::ControllerTest
end
def test_gantt_at_minimal_zoom
- get :show, :project_id => 1, :zoom => 1
+ get :show, :params => {
+ :project_id => 1,
+ :zoom => 1
+ }
assert_response :success
assert_select 'input[type=hidden][name=zoom][value=?]', '1'
end
def test_gantt_at_maximal_zoom
- get :show, :project_id => 1, :zoom => 4
+ get :show, :params => {
+ :project_id => 1,
+ :zoom => 4
+ }
assert_response :success
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
+ get :show, :params => {
+ :project_id => 1
+ }
assert_response :success
end
def test_gantt_should_work_without_issue_and_version_due_dates
Issue.update_all("due_date = NULL")
Version.update_all("effective_date = NULL")
- get :show, :project_id => 1
+ get :show, :params => {
+ :project_id => 1
+ }
assert_response :success
end
@@ -97,14 +109,19 @@ class GanttsControllerTest < Redmine::ControllerTest
end
def test_gantt_should_export_to_pdf
- get :show, :project_id => 1, :format => 'pdf'
+ get :show, :params => {
+ :project_id => 1,
+ :format => 'pdf'
+ }
assert_response :success
assert_equal 'application/pdf', @response.content_type
assert @response.body.starts_with?('%PDF')
end
def test_gantt_should_export_to_pdf_cross_project
- get :show, :format => 'pdf'
+ get :show, :params => {
+ :format => 'pdf'
+ }
assert_response :success
assert_equal 'application/pdf', @response.content_type
assert @response.body.starts_with?('%PDF')
@@ -112,7 +129,10 @@ class GanttsControllerTest < Redmine::ControllerTest
if Object.const_defined?(:Magick)
def test_gantt_should_export_to_png
- get :show, :project_id => 1, :format => 'png'
+ get :show, :params => {
+ :project_id => 1,
+ :format => 'png'
+ }
assert_response :success
assert_equal 'image/png', @response.content_type
end
diff --git a/test/functional/groups_controller_test.rb b/test/functional/groups_controller_test.rb
index 19f95d357..68d624331 100644
--- a/test/functional/groups_controller_test.rb
+++ b/test/functional/groups_controller_test.rb
@@ -39,19 +39,25 @@ class GroupsControllerTest < Redmine::ControllerTest
def test_index_with_name_filter
Group.generate!(:name => "Clients")
- get :index, :name => "cli"
+ get :index, :params => {
+ :name => "cli"
+ }
assert_response :success
assert_select 'table.groups tbody tr', 1
assert_select 'table.groups tbody td.name', :text => 'Clients'
end
def test_show
- get :show, :id => 10
+ get :show, :params => {
+ :id => 10
+ }
assert_response :success
end
def test_show_invalid_should_return_404
- get :show, :id => 99
+ get :show, :params => {
+ :id => 99
+ }
assert_response 404
end
@@ -63,7 +69,11 @@ class GroupsControllerTest < Redmine::ControllerTest
def test_create
assert_difference 'Group.count' do
- post :create, :group => {:name => 'New group'}
+ post :create, :params => {
+ :group => {
+ :name => 'New group'
+ }
+ }
end
assert_redirected_to '/groups'
group = Group.order('id DESC').first
@@ -73,7 +83,12 @@ class GroupsControllerTest < Redmine::ControllerTest
def test_create_and_continue
assert_difference 'Group.count' do
- post :create, :group => {:name => 'New group'}, :continue => 'Create and continue'
+ post :create, :params => {
+ :group => {
+ :name => 'New group'
+ },
+ :continue => 'Create and continue'
+ }
end
assert_redirected_to '/groups/new'
group = Group.order('id DESC').first
@@ -82,14 +97,20 @@ class GroupsControllerTest < Redmine::ControllerTest
def test_create_with_failure
assert_no_difference 'Group.count' do
- post :create, :group => {:name => ''}
+ post :create, :params => {
+ :group => {
+ :name => ''
+ }
+ }
end
assert_response :success
assert_select_error /Name cannot be blank/i
end
def test_edit
- get :edit, :id => 10
+ get :edit, :params => {
+ :id => 10
+ }
assert_response :success
assert_select 'div#tab-content-users'
@@ -100,46 +121,70 @@ class GroupsControllerTest < Redmine::ControllerTest
def test_update
new_name = 'New name'
- put :update, :id => 10, :group => {:name => new_name}
+ put :update, :params => {
+ :id => 10,
+ :group => {
+ :name => new_name
+ }
+ }
assert_redirected_to '/groups'
group = Group.find(10)
assert_equal new_name, group.name
end
def test_update_with_failure
- put :update, :id => 10, :group => {:name => ''}
+ put :update, :params => {
+ :id => 10,
+ :group => {
+ :name => ''
+ }
+ }
assert_response :success
assert_select_error /Name cannot be blank/i
end
def test_destroy
assert_difference 'Group.count', -1 do
- post :destroy, :id => 10
+ post :destroy, :params => {
+ :id => 10
+ }
end
assert_redirected_to '/groups'
end
def test_new_users
- get :new_users, :id => 10
+ get :new_users, :params => {
+ :id => 10
+ }
assert_response :success
assert_select 'input[name=?]', 'user_search'
end
def test_xhr_new_users
- xhr :get, :new_users, :id => 10
+ get :new_users, :params => {
+ :id => 10
+ },
+ :xhr => true
assert_response :success
assert_equal 'text/javascript', response.content_type
end
def test_add_users
assert_difference 'Group.find(10).users.count', 2 do
- post :add_users, :id => 10, :user_ids => ['2', '3']
+ post :add_users, :params => {
+ :id => 10,
+ :user_ids => ['2', '3']
+ }
end
end
def test_xhr_add_users
assert_difference 'Group.find(10).users.count', 2 do
- xhr :post, :add_users, :id => 10, :user_ids => ['2', '3']
+ post :add_users, :params => {
+ :id => 10,
+ :user_ids => ['2', '3']
+ },
+ :xhr => true
assert_response :success
assert_equal 'text/javascript', response.content_type
end
@@ -148,20 +193,32 @@ class GroupsControllerTest < Redmine::ControllerTest
def test_remove_user
assert_difference 'Group.find(10).users.count', -1 do
- delete :remove_user, :id => 10, :user_id => '8'
+ delete :remove_user, :params => {
+ :id => 10,
+ :user_id => '8'
+ }
end
end
def test_xhr_remove_user
assert_difference 'Group.find(10).users.count', -1 do
- xhr :delete, :remove_user, :id => 10, :user_id => '8'
+ delete :remove_user, :params => {
+ :id => 10,
+ :user_id => '8'
+ },
+ :xhr => true
assert_response :success
assert_equal 'text/javascript', response.content_type
end
end
def test_autocomplete_for_user
- xhr :get, :autocomplete_for_user, :id => 10, :q => 'smi', :format => 'js'
+ get :autocomplete_for_user, :params => {
+ :id => 10,
+ :q => 'smi',
+ :format => 'js'
+ },
+ :xhr => true
assert_response :success
assert_include 'John Smith', response.body
end
diff --git a/test/functional/imports_controller_test.rb b/test/functional/imports_controller_test.rb
index 28ce703f5..ef9ab0c89 100644
--- a/test/functional/imports_controller_test.rb
+++ b/test/functional/imports_controller_test.rb
@@ -49,7 +49,9 @@ class ImportsControllerTest < Redmine::ControllerTest
def test_create_should_save_the_file
import = new_record(Import) do
- post :create, :file => uploaded_test_file('import_issues.csv', 'text/csv')
+ post :create, :params => {
+ :file => uploaded_test_file('import_issues.csv', 'text/csv')
+ }
assert_response 302
end
assert_equal 2, import.user_id
@@ -59,7 +61,9 @@ class ImportsControllerTest < Redmine::ControllerTest
def test_get_settings_should_display_settings_form
import = generate_import
- get :settings, :id => import.to_param
+ get :settings, :params => {
+ :id => import.to_param
+ }
assert_response :success
assert_select 'select[name=?]', 'import_settings[separator]'
assert_select 'select[name=?]', 'import_settings[wrapper]'
@@ -70,8 +74,15 @@ class ImportsControllerTest < Redmine::ControllerTest
def test_post_settings_should_update_settings
import = generate_import
- post :settings, :id => import.to_param,
- :import_settings => {:separator => ":", :wrapper => "|", :encoding => "UTF-8", :date_format => '%m/%d/%Y'}
+ post :settings, :params => {
+ :id => import.to_param,
+ :import_settings => {
+ :separator => ":",
+ :wrapper => "|",
+ :encoding => "UTF-8",
+ :date_format => '%m/%d/%Y'
+ }
+ }
assert_redirected_to "/imports/#{import.to_param}/mapping"
import.reload
@@ -84,8 +95,14 @@ class ImportsControllerTest < Redmine::ControllerTest
def test_post_settings_should_update_total_items_count
import = generate_import('import_iso8859-1.csv')
- post :settings, :id => import.to_param,
- :import_settings => {:separator => ";", :wrapper => '"', :encoding => "ISO-8859-1"}
+ post :settings, :params => {
+ :id => import.to_param,
+ :import_settings => {
+ :separator => ";",
+ :wrapper => '"',
+ :encoding => "ISO-8859-1"
+ }
+ }
assert_response 302
import.reload
assert_equal 2, import.total_items
@@ -94,8 +111,14 @@ class ImportsControllerTest < Redmine::ControllerTest
def test_post_settings_with_wrong_encoding_should_display_error
import = generate_import('import_iso8859-1.csv')
- post :settings, :id => import.to_param,
- :import_settings => {:separator => ";", :wrapper => '"', :encoding => "UTF-8"}
+ post :settings, :params => {
+ :id => import.to_param,
+ :import_settings => {
+ :separator => ";",
+ :wrapper => '"',
+ :encoding => "UTF-8"
+ }
+ }
assert_response 200
import.reload
assert_nil import.total_items
@@ -105,8 +128,14 @@ class ImportsControllerTest < Redmine::ControllerTest
def test_post_settings_with_invalid_encoding_should_display_error
import = generate_import('invalid-Shift_JIS.csv')
- post :settings, :id => import.to_param,
- :import_settings => {:separator => ";", :wrapper => '"', :encoding => "Shift_JIS"}
+ post :settings, :params => {
+ :id => import.to_param,
+ :import_settings => {
+ :separator => ";",
+ :wrapper => '"',
+ :encoding => "Shift_JIS"
+ }
+ }
assert_response 200
import.reload
assert_nil import.total_items
@@ -118,7 +147,9 @@ class ImportsControllerTest < Redmine::ControllerTest
import.settings = {'separator' => ";", 'wrapper' => '"', 'encoding' => "ISO-8859-1"}
import.save!
- get :mapping, :id => import.to_param
+ get :mapping, :params => {
+ :id => import.to_param
+ }
assert_response :success
assert_select 'select[name=?]', 'import_settings[mapping][subject]' do
@@ -135,8 +166,15 @@ class ImportsControllerTest < Redmine::ControllerTest
def test_post_mapping_should_update_mapping
import = generate_import('import_iso8859-1.csv')
- post :mapping, :id => import.to_param,
- :import_settings => {:mapping => {:project_id => '1', :tracker_id => '2', :subject => '0'}}
+ post :mapping, :params => {
+ :id => import.to_param,
+ :import_settings => {
+ :mapping => {
+ :project_id => '1',
+ :tracker_id => '2',
+ :subject => '0'}
+ }
+ }
assert_redirected_to "/imports/#{import.to_param}/run"
import.reload
mapping = import.settings['mapping']
@@ -149,7 +187,9 @@ class ImportsControllerTest < Redmine::ControllerTest
def test_get_run
import = generate_import_with_mapping
- get :run, :id => import
+ get :run, :params => {
+ :id => import
+ }
assert_response :success
assert_select '#import-progress'
end
@@ -158,7 +198,9 @@ class ImportsControllerTest < Redmine::ControllerTest
import = generate_import_with_mapping
assert_difference 'Issue.count', 3 do
- post :run, :id => import
+ post :run, :params => {
+ :id => import
+ }
assert_redirected_to "/imports/#{import.to_param}"
end
@@ -175,12 +217,16 @@ class ImportsControllerTest < Redmine::ControllerTest
import = generate_import_with_mapping
assert_difference 'Issue.count', 2 do
- post :run, :id => import
+ post :run, :params => {
+ :id => import
+ }
assert_redirected_to "/imports/#{import.to_param}/run"
end
assert_difference 'Issue.count', 1 do
- post :run, :id => import
+ post :run, :params => {
+ :id => import
+ }
assert_redirected_to "/imports/#{import.to_param}"
end
@@ -193,7 +239,9 @@ class ImportsControllerTest < Redmine::ControllerTest
import.run
assert_equal 0, import.unsaved_items.count
- get :show, :id => import.to_param
+ get :show, :params => {
+ :id => import.to_param
+ }
assert_response :success
assert_select 'ul#saved-items'
@@ -207,7 +255,9 @@ class ImportsControllerTest < Redmine::ControllerTest
import.run
assert_not_equal 0, import.unsaved_items.count
- get :show, :id => import.to_param
+ get :show, :params => {
+ :id => import.to_param
+ }
assert_response :success
assert_select 'table#unsaved-items'
diff --git a/test/functional/issue_categories_controller_test.rb b/test/functional/issue_categories_controller_test.rb
index 908d4d1c5..c18fd9cce 100644
--- a/test/functional/issue_categories_controller_test.rb
+++ b/test/functional/issue_categories_controller_test.rb
@@ -28,14 +28,19 @@ class IssueCategoriesControllerTest < Redmine::ControllerTest
def test_new
@request.session[:user_id] = 2 # manager
- get :new, :project_id => '1'
+ get :new, :params => {
+ :project_id => '1'
+ }
assert_response :success
assert_select 'input[name=?]', 'issue_category[name]'
end
def test_new_from_issue_form
@request.session[:user_id] = 2 # manager
- xhr :get, :new, :project_id => '1'
+ get :new, :params => {
+ :project_id => '1'
+ },
+ :xhr => true
assert_response :success
assert_equal 'text/javascript', response.content_type
@@ -44,7 +49,12 @@ class IssueCategoriesControllerTest < Redmine::ControllerTest
def test_create
@request.session[:user_id] = 2 # manager
assert_difference 'IssueCategory.count' do
- post :create, :project_id => '1', :issue_category => {:name => 'New category'}
+ post :create, :params => {
+ :project_id => '1',
+ :issue_category => {
+ :name => 'New category'
+ }
+ }
end
assert_redirected_to '/projects/ecookbook/settings/categories'
category = IssueCategory.find_by_name('New category')
@@ -54,7 +64,12 @@ class IssueCategoriesControllerTest < Redmine::ControllerTest
def test_create_failure
@request.session[:user_id] = 2
- post :create, :project_id => '1', :issue_category => {:name => ''}
+ post :create, :params => {
+ :project_id => '1',
+ :issue_category => {
+ :name => ''
+ }
+ }
assert_response :success
assert_select_error /Name cannot be blank/i
end
@@ -62,7 +77,13 @@ class IssueCategoriesControllerTest < Redmine::ControllerTest
def test_create_from_issue_form
@request.session[:user_id] = 2 # manager
assert_difference 'IssueCategory.count' do
- xhr :post, :create, :project_id => '1', :issue_category => {:name => 'New category'}
+ post :create, :params => {
+ :project_id => '1',
+ :issue_category => {
+ :name => 'New category'
+ }
+ },
+ :xhr => true
end
category = IssueCategory.order('id DESC').first
assert_equal 'New category', category.name
@@ -74,7 +95,13 @@ class IssueCategoriesControllerTest < Redmine::ControllerTest
def test_create_from_issue_form_with_failure
@request.session[:user_id] = 2 # manager
assert_no_difference 'IssueCategory.count' do
- xhr :post, :create, :project_id => '1', :issue_category => {:name => ''}
+ post :create, :params => {
+ :project_id => '1',
+ :issue_category => {
+ :name => ''
+ }
+ },
+ :xhr => true
end
assert_response :success
@@ -84,38 +111,59 @@ class IssueCategoriesControllerTest < Redmine::ControllerTest
def test_edit
@request.session[:user_id] = 2
- get :edit, :id => 2
+ get :edit, :params => {
+ :id => 2
+ }
assert_response :success
assert_select 'input[name=?][value=?]', 'issue_category[name]', 'Recipes'
end
def test_update
assert_no_difference 'IssueCategory.count' do
- put :update, :id => 2, :issue_category => { :name => 'Testing' }
+ put :update, :params => {
+ :id => 2,
+ :issue_category => {
+ :name => 'Testing'
+ }
+ }
end
assert_redirected_to '/projects/ecookbook/settings/categories'
assert_equal 'Testing', IssueCategory.find(2).name
end
def test_update_failure
- put :update, :id => 2, :issue_category => { :name => '' }
+ put :update, :params => {
+ :id => 2,
+ :issue_category => {
+ :name => ''
+ }
+ }
assert_response :success
assert_select_error /Name cannot be blank/i
end
def test_update_not_found
- put :update, :id => 97, :issue_category => { :name => 'Testing' }
+ put :update, :params => {
+ :id => 97,
+ :issue_category => {
+ :name => 'Testing'
+ }
+ }
assert_response 404
end
def test_destroy_category_not_in_use
- delete :destroy, :id => 2
+ delete :destroy, :params => {
+ :id => 2
+ }
assert_redirected_to '/projects/ecookbook/settings/categories'
assert_nil IssueCategory.find_by_id(2)
end
def test_destroy_category_in_use
- delete :destroy, :id => 1
+ delete :destroy, :params => {
+ :id => 1
+ }
assert_response :success
assert_not_nil IssueCategory.find_by_id(1)
assert_select 'select[name=?]', 'reassign_to_id'
@@ -123,7 +171,11 @@ class IssueCategoriesControllerTest < Redmine::ControllerTest
def test_destroy_category_in_use_with_reassignment
issue = Issue.where(:category_id => 1).first
- delete :destroy, :id => 1, :todo => 'reassign', :reassign_to_id => 2
+ delete :destroy, :params => {
+ :id => 1,
+ :todo => 'reassign',
+ :reassign_to_id => 2
+ }
assert_redirected_to '/projects/ecookbook/settings/categories'
assert_nil IssueCategory.find_by_id(1)
# check that the issue was reassign
@@ -132,7 +184,10 @@ class IssueCategoriesControllerTest < Redmine::ControllerTest
def test_destroy_category_in_use_without_reassignment
issue = Issue.where(:category_id => 1).first
- delete :destroy, :id => 1, :todo => 'nullify'
+ delete :destroy, :params => {
+ :id => 1,
+ :todo => 'nullify'
+ }
assert_redirected_to '/projects/ecookbook/settings/categories'
assert_nil IssueCategory.find_by_id(1)
# check that the issue category was nullified
diff --git a/test/functional/issue_relations_controller_test.rb b/test/functional/issue_relations_controller_test.rb
index f740e2234..0bb87a127 100644
--- a/test/functional/issue_relations_controller_test.rb
+++ b/test/functional/issue_relations_controller_test.rb
@@ -38,8 +38,14 @@ class IssueRelationsControllerTest < Redmine::ControllerTest
def test_create
assert_difference 'IssueRelation.count' do
- post :create, :issue_id => 1,
- :relation => {:issue_to_id => '2', :relation_type => 'relates', :delay => ''}
+ post :create, :params => {
+ :issue_id => 1,
+ :relation => {
+ :issue_to_id => '2',
+ :relation_type => 'relates',
+ :delay => ''
+ }
+ }
end
relation = IssueRelation.order('id DESC').first
assert_equal 1, relation.issue_from_id
@@ -49,15 +55,29 @@ class IssueRelationsControllerTest < Redmine::ControllerTest
def test_create_on_invalid_issue
assert_no_difference 'IssueRelation.count' do
- post :create, :issue_id => 999,
- :relation => {:issue_to_id => '2', :relation_type => 'relates', :delay => ''}
+ post :create, :params => {
+ :issue_id => 999,
+ :relation => {
+ :issue_to_id => '2',
+ :relation_type => 'relates',
+ :delay => ''
+ }
+ }
assert_response 404
end
end
def test_create_xhr
assert_difference 'IssueRelation.count' do
- xhr :post, :create, :issue_id => 3, :relation => {:issue_to_id => '1', :relation_type => 'relates', :delay => ''}
+ post :create, :params => {
+ :issue_id => 3,
+ :relation => {
+ :issue_to_id => '1',
+ :relation_type => 'relates',
+ :delay => ''
+ }
+ },
+ :xhr => true
assert_response :success
assert_equal 'text/javascript', response.content_type
end
@@ -70,8 +90,14 @@ class IssueRelationsControllerTest < Redmine::ControllerTest
def test_create_should_accept_id_with_hash
assert_difference 'IssueRelation.count' do
- post :create, :issue_id => 1,
- :relation => {:issue_to_id => '#2', :relation_type => 'relates', :delay => ''}
+ post :create, :params => {
+ :issue_id => 1,
+ :relation => {
+ :issue_to_id => '#2',
+ :relation_type => 'relates',
+ :delay => ''
+ }
+ }
end
relation = IssueRelation.order('id DESC').first
assert_equal 2, relation.issue_to_id
@@ -79,8 +105,14 @@ class IssueRelationsControllerTest < Redmine::ControllerTest
def test_create_should_strip_id
assert_difference 'IssueRelation.count' do
- post :create, :issue_id => 1,
- :relation => {:issue_to_id => ' 2 ', :relation_type => 'relates', :delay => ''}
+ post :create, :params => {
+ :issue_id => 1,
+ :relation => {
+ :issue_to_id => ' 2 ',
+ :relation_type => 'relates',
+ :delay => ''
+ }
+ }
end
relation = IssueRelation.order('id DESC').first
assert_equal 2, relation.issue_to_id
@@ -89,8 +121,14 @@ class IssueRelationsControllerTest < Redmine::ControllerTest
def test_create_should_not_break_with_non_numerical_id
assert_no_difference 'IssueRelation.count' do
assert_nothing_raised do
- post :create, :issue_id => 1,
- :relation => {:issue_to_id => 'foo', :relation_type => 'relates', :delay => ''}
+ post :create, :params => {
+ :issue_id => 1,
+ :relation => {
+ :issue_to_id => 'foo',
+ :relation_type => 'relates',
+ :delay => ''
+ }
+ }
end
end
end
@@ -100,8 +138,15 @@ class IssueRelationsControllerTest < Redmine::ControllerTest
issue2 = Issue.generate!
assert_difference 'IssueRelation.count' do
- xhr :post, :create, :issue_id => issue2.id,
- :relation => {:issue_to_id => issue1.id, :relation_type => 'follows', :delay => ''}
+ post :create, :params => {
+ :issue_id => issue2.id,
+ :relation => {
+ :issue_to_id => issue1.id,
+ :relation_type => 'follows',
+ :delay => ''
+ }
+ },
+ :xhr => true
end
assert_include 'Followed issue', response.body
end
@@ -111,14 +156,28 @@ class IssueRelationsControllerTest < Redmine::ControllerTest
assert_nil Issue.visible(User.find(3)).find_by_id(4)
assert_no_difference 'IssueRelation.count' do
- post :create, :issue_id => 1,
- :relation => {:issue_to_id => '4', :relation_type => 'relates', :delay => ''}
+ post :create, :params => {
+ :issue_id => 1,
+ :relation => {
+ :issue_to_id => '4',
+ :relation_type => 'relates',
+ :delay => ''
+ }
+ }
end
end
def test_create_xhr_with_failure
assert_no_difference 'IssueRelation.count' do
- xhr :post, :create, :issue_id => 3, :relation => {:issue_to_id => '999', :relation_type => 'relates', :delay => ''}
+ post :create, :params => {
+ :issue_id => 3,
+ :relation => {
+ :issue_to_id => '999',
+ :relation_type => 'relates',
+ :delay => ''
+ }
+ },
+ :xhr => true
assert_response :success
assert_equal 'text/javascript', response.content_type
@@ -128,13 +187,17 @@ class IssueRelationsControllerTest < Redmine::ControllerTest
def test_destroy
assert_difference 'IssueRelation.count', -1 do
- delete :destroy, :id => '2'
+ delete :destroy, :params => {
+ :id => '2'
+ }
end
end
def test_destroy_invalid_relation
assert_no_difference 'IssueRelation.count' do
- delete :destroy, :id => '999'
+ delete :destroy, :params => {
+ :id => '999'
+ }
assert_response 404
end
end
@@ -146,7 +209,10 @@ class IssueRelationsControllerTest < Redmine::ControllerTest
end
assert_difference 'IssueRelation.count', -1 do
- xhr :delete, :destroy, :id => '2'
+ delete :destroy, :params => {
+ :id => '2'
+ },
+ :xhr => true
assert_response :success
assert_equal 'text/javascript', response.content_type
diff --git a/test/functional/issue_statuses_controller_test.rb b/test/functional/issue_statuses_controller_test.rb
index 047576705..f782f8ecf 100644
--- a/test/functional/issue_statuses_controller_test.rb
+++ b/test/functional/issue_statuses_controller_test.rb
@@ -51,7 +51,11 @@ class IssueStatusesControllerTest < Redmine::ControllerTest
def test_create
assert_difference 'IssueStatus.count' do
- post :create, :issue_status => {:name => 'New status'}
+ post :create, :params => {
+ :issue_status => {
+ :name => 'New status'
+ }
+ }
end
assert_redirected_to :action => 'index'
status = IssueStatus.order('id DESC').first
@@ -59,26 +63,42 @@ class IssueStatusesControllerTest < Redmine::ControllerTest
end
def test_create_with_failure
- post :create, :issue_status => {:name => ''}
+ post :create, :params => {
+ :issue_status => {
+ :name => ''
+ }
+ }
assert_response :success
assert_select_error /name cannot be blank/i
end
def test_edit
- get :edit, :id => '3'
+ get :edit, :params => {
+ :id => '3'
+ }
assert_response :success
assert_select 'input[name=?][value=?]', 'issue_status[name]', 'Resolved'
end
def test_update
- put :update, :id => '3', :issue_status => {:name => 'Renamed status'}
+ put :update, :params => {
+ :id => '3',
+ :issue_status => {
+ :name => 'Renamed status'
+ }
+ }
assert_redirected_to :action => 'index'
status = IssueStatus.find(3)
assert_equal 'Renamed status', status.name
end
def test_update_with_failure
- put :update, :id => '3', :issue_status => {:name => ''}
+ put :update, :params => {
+ :id => '3',
+ :issue_status => {
+ :name => ''
+ }
+ }
assert_response :success
assert_select_error /name cannot be blank/i
end
@@ -88,7 +108,9 @@ class IssueStatusesControllerTest < Redmine::ControllerTest
Tracker.where(:default_status_id => 1).delete_all
assert_difference 'IssueStatus.count', -1 do
- delete :destroy, :id => '1'
+ delete :destroy, :params => {
+ :id => '1'
+ }
end
assert_redirected_to :action => 'index'
assert_nil IssueStatus.find_by_id(1)
@@ -99,7 +121,9 @@ class IssueStatusesControllerTest < Redmine::ControllerTest
Tracker.where(:default_status_id => 1).delete_all
assert_no_difference 'IssueStatus.count' do
- delete :destroy, :id => '1'
+ delete :destroy, :params => {
+ :id => '1'
+ }
end
assert_redirected_to :action => 'index'
assert_not_nil IssueStatus.find_by_id(1)
@@ -110,7 +134,9 @@ class IssueStatusesControllerTest < Redmine::ControllerTest
assert Tracker.where(:default_status_id => 1).any?
assert_no_difference 'IssueStatus.count' do
- delete :destroy, :id => '1'
+ delete :destroy, :params => {
+ :id => '1'
+ }
end
assert_redirected_to :action => 'index'
assert_not_nil IssueStatus.find_by_id(1)
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb
index fef87a2c3..c6c58b684 100644
--- a/test/functional/issues_controller_test.rb
+++ b/test/functional/issues_controller_test.rb
@@ -77,7 +77,9 @@ class IssuesControllerTest < Redmine::ControllerTest
end
def test_index_should_list_visible_issues_only
- get :index, :per_page => 100
+ get :index, :params => {
+ :per_page => 100
+ }
assert_response :success
Issue.open.each do |issue|
@@ -87,7 +89,9 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_index_with_project
Setting.display_subprojects_issues = 0
- get :index, :project_id => 1
+ get :index, :params => {
+ :project_id => 1
+ }
assert_response :success
assert_select 'a[href="/issues/1"]', :text => /Cannot print recipes/
@@ -96,7 +100,9 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_index_with_project_and_subprojects
Setting.display_subprojects_issues = 1
- get :index, :project_id => 1
+ get :index, :params => {
+ :project_id => 1
+ }
assert_response :success
assert_select 'a[href="/issues/1"]', :text => /Cannot print recipes/
@@ -107,7 +113,9 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_index_with_project_and_subprojects_should_show_private_subprojects_with_permission
@request.session[:user_id] = 2
Setting.display_subprojects_issues = 1
- get :index, :project_id => 1
+ get :index, :params => {
+ :project_id => 1
+ }
assert_response :success
assert_select 'a[href="/issues/1"]', :text => /Cannot print recipes/
@@ -116,7 +124,10 @@ class IssuesControllerTest < Redmine::ControllerTest
end
def test_index_with_project_and_default_filter
- get :index, :project_id => 1, :set_filter => 1
+ get :index, :params => {
+ :project_id => 1,
+ :set_filter => 1
+ }
assert_response :success
# default filter
@@ -124,10 +135,17 @@ class IssuesControllerTest < Redmine::ControllerTest
end
def test_index_with_project_and_filter
- get :index, :project_id => 1, :set_filter => 1,
- :f => ['tracker_id'],
- :op => {'tracker_id' => '='},
- :v => {'tracker_id' => ['1']}
+ get :index, :params => {
+ :project_id => 1,
+ :set_filter => 1,
+ :f => ['tracker_id'],
+ :op => {
+ 'tracker_id' => '='
+ },
+ :v => {
+ 'tracker_id' => ['1']
+ }
+ }
assert_response :success
assert_query_filters [['tracker_id', '=', '1']]
@@ -189,7 +207,9 @@ class IssuesControllerTest < Redmine::ControllerTest
to_test.each do |field, expression_and_expected|
expression_and_expected.each do |filter_expression, expected|
- get :index, :set_filter => 1, field => filter_expression
+ get :index, :params => {
+ :set_filter => 1, field => filter_expression
+ }
assert_response :success
expected_with_default = default_filter.merge({field => {:operator => expected[:op], :values => expected[:values]}})
@@ -199,7 +219,11 @@ class IssuesControllerTest < Redmine::ControllerTest
end
def test_index_with_project_and_empty_filters
- get :index, :project_id => 1, :set_filter => 1, :fields => ['']
+ get :index, :params => {
+ :project_id => 1,
+ :set_filter => 1,
+ :fields => ['']
+ }
assert_response :success
# no filter
@@ -213,47 +237,77 @@ class IssuesControllerTest < Redmine::ControllerTest
filter_name = "project.cf_#{field.id}"
@request.session[:user_id] = 1
- get :index, :set_filter => 1,
- :f => [filter_name],
- :op => {filter_name => '='},
- :v => {filter_name => ['Foo']},
- :c => ['project']
+ get :index, :params => {
+ :set_filter => 1,
+ :f => [filter_name],
+ :op => {
+ filter_name => '='
+ },
+ :v => {
+ filter_name => ['Foo']
+ },
+ :c => ['project']
+ }
assert_response :success
assert_equal [3, 5], issues_in_list.map(&:project_id).uniq.sort
end
def test_index_with_query
- get :index, :project_id => 1, :query_id => 5
+ get :index, :params => {
+ :project_id => 1,
+ :query_id => 5
+ }
assert_response :success
end
def test_index_with_query_grouped_by_tracker
- get :index, :project_id => 1, :query_id => 6
+ get :index, :params => {
+ :project_id => 1,
+ :query_id => 6
+ }
assert_response :success
assert_select 'tr.group span.count'
end
def test_index_with_query_grouped_and_sorted_by_category
- get :index, :project_id => 1, :set_filter => 1, :group_by => "category", :sort => "category"
+ get :index, :params => {
+ :project_id => 1,
+ :set_filter => 1,
+ :group_by => "category",
+ :sort => "category"
+ }
assert_response :success
assert_select 'tr.group span.count'
end
def test_index_with_query_grouped_and_sorted_by_fixed_version
- get :index, :project_id => 1, :set_filter => 1, :group_by => "fixed_version", :sort => "fixed_version"
+ get :index, :params => {
+ :project_id => 1,
+ :set_filter => 1,
+ :group_by => "fixed_version",
+ :sort => "fixed_version"
+ }
assert_response :success
assert_select 'tr.group span.count'
end
def test_index_with_query_grouped_and_sorted_by_fixed_version_in_reverse_order
- get :index, :project_id => 1, :set_filter => 1, :group_by => "fixed_version", :sort => "fixed_version:desc"
+ get :index, :params => {
+ :project_id => 1,
+ :set_filter => 1,
+ :group_by => "fixed_version",
+ :sort => "fixed_version:desc"
+ }
assert_response :success
assert_select 'tr.group span.count'
end
def test_index_with_query_grouped_by_list_custom_field
- get :index, :project_id => 1, :query_id => 9
+ get :index, :params => {
+ :project_id => 1,
+ :query_id => 9
+ }
assert_response :success
assert_select 'tr.group span.count'
end
@@ -267,7 +321,11 @@ class IssuesControllerTest < Redmine::ControllerTest
CustomValue.create!(:custom_field => cf, :customized => Issue.find(3), :value => valuea.id)
CustomValue.create!(:custom_field => cf, :customized => Issue.find(5), :value => '')
- get :index, :project_id => 1, :set_filter => 1, :group_by => "cf_#{cf.id}"
+ get :index, :params => {
+ :project_id => 1,
+ :set_filter => 1,
+ :group_by => "cf_#{cf.id}"
+ }
assert_response :success
assert_select 'tr.group', 3
@@ -288,7 +346,11 @@ class IssuesControllerTest < Redmine::ControllerTest
CustomValue.create!(:custom_field => cf, :customized => Issue.find(3), :value => '3')
CustomValue.create!(:custom_field => cf, :customized => Issue.find(5), :value => '')
- get :index, :project_id => 1, :set_filter => 1, :group_by => "cf_#{cf.id}"
+ get :index, :params => {
+ :project_id => 1,
+ :set_filter => 1,
+ :group_by => "cf_#{cf.id}"
+ }
assert_response :success
assert_select 'tr.group', 3
@@ -309,7 +371,11 @@ class IssuesControllerTest < Redmine::ControllerTest
CustomValue.create!(:custom_field => cf, :customized => Issue.find(3), :value => '')
with_settings :default_language => 'en' do
- get :index, :project_id => 1, :set_filter => 1, :group_by => "cf_#{cf.id}"
+ get :index, :params => {
+ :project_id => 1,
+ :set_filter => 1,
+ :group_by => "cf_#{cf.id}"
+ }
assert_response :success
end
@@ -325,7 +391,11 @@ class IssuesControllerTest < Redmine::ControllerTest
CustomValue.create!(:custom_field => cf, :customized => Issue.find(2), :value => '0')
with_settings :default_language => 'en' do
- get :index, :project_id => 1, :set_filter => 1, "cf_#{cf.id}" => "*", :group_by => "cf_#{cf.id}"
+ get :index, :params => {
+ :project_id => 1,
+ :set_filter => 1, "cf_#{cf.id}" => "*",
+ :group_by => "cf_#{cf.id}"
+ }
assert_response :success
end
@@ -337,7 +407,11 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_index_with_query_grouped_by_tracker_in_normal_order
3.times {|i| Issue.generate!(:tracker_id => (i + 1))}
- get :index, :set_filter => 1, :group_by => 'tracker', :sort => 'id:desc'
+ get :index, :params => {
+ :set_filter => 1,
+ :group_by => 'tracker',
+ :sort => 'id:desc'
+ }
assert_response :success
assert_equal ["Bug", "Feature request", "Support request"],
@@ -347,7 +421,12 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_index_with_query_grouped_by_tracker_in_reverse_order
3.times {|i| Issue.generate!(:tracker_id => (i + 1))}
- get :index, :set_filter => 1, :group_by => 'tracker', :c => ['tracker', 'subject'], :sort => 'id:desc,tracker:desc'
+ get :index, :params => {
+ :set_filter => 1,
+ :group_by => 'tracker',
+ :c => ['tracker', 'subject'],
+ :sort => 'id:desc,tracker:desc'
+ }
assert_response :success
assert_equal ["Bug", "Feature request", "Support request"].reverse,
@@ -355,7 +434,10 @@ class IssuesControllerTest < Redmine::ControllerTest
end
def test_index_with_query_id_and_project_id_should_set_session_query
- get :index, :project_id => 1, :query_id => 4
+ get :index, :params => {
+ :project_id => 1,
+ :query_id => 4
+ }
assert_response :success
assert_kind_of Hash, session[:issue_query]
assert_equal 4, session[:issue_query][:id]
@@ -363,7 +445,10 @@ class IssuesControllerTest < Redmine::ControllerTest
end
def test_index_with_invalid_query_id_should_respond_404
- get :index, :project_id => 1, :query_id => 999
+ get :index, :params => {
+ :project_id => 1,
+ :query_id => 999
+ }
assert_response 404
end
@@ -372,7 +457,9 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:issue_query] = {:id => q.id, :project_id => 1}
with_settings :display_subprojects_issues => '0' do
- get :index, :project_id => 1
+ get :index, :params => {
+ :project_id => 1
+ }
end
assert_response :success
@@ -384,7 +471,9 @@ class IssuesControllerTest < Redmine::ControllerTest
q = IssueQuery.create!(:name => "private", :user => User.find(2), :visibility => IssueQuery::VISIBILITY_PRIVATE, :project => nil)
@request.session[:user_id] = 3
- get :index, :query_id => q.id
+ get :index, :params => {
+ :query_id => q.id
+ }
assert_response 403
end
@@ -392,7 +481,9 @@ class IssuesControllerTest < Redmine::ControllerTest
q = IssueQuery.create!(:name => "private", :user => User.find(2), :visibility => IssueQuery::VISIBILITY_PRIVATE, :project => nil)
@request.session[:user_id] = 2
- get :index, :query_id => q.id
+ get :index, :params => {
+ :query_id => q.id
+ }
assert_response :success
end
@@ -400,12 +491,16 @@ class IssuesControllerTest < Redmine::ControllerTest
q = IssueQuery.create!(:name => "public", :user => User.find(2), :visibility => IssueQuery::VISIBILITY_PUBLIC, :project => nil)
@request.session[:user_id] = 3
- get :index, :query_id => q.id
+ get :index, :params => {
+ :query_id => q.id
+ }
assert_response :success
end
def test_index_should_omit_page_param_in_export_links
- get :index, :page => 2
+ get :index, :params => {
+ :page => 2
+ }
assert_response :success
assert_select 'a.atom[href="/issues.atom"]'
assert_select 'a.csv[href="/issues.csv"]'
@@ -428,7 +523,13 @@ class IssuesControllerTest < Redmine::ControllerTest
end
def test_index_should_include_query_params_as_hidden_fields_in_csv_export_form
- get :index, :project_id => 1, :set_filter => "1", :tracker_id => "2", :sort => 'status', :c => ["status", "priority"]
+ get :index, :params => {
+ :project_id => 1,
+ :set_filter => "1",
+ :tracker_id => "2",
+ :sort => 'status',
+ :c => ["status", "priority"]
+ }
assert_select '#csv-export-form[action=?]', '/projects/ecookbook/issues.csv'
assert_select '#csv-export-form[method=?]', 'get'
@@ -446,12 +547,18 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_select 'input[name=?][value=?]', 'sort', 'status'
end
- get :index, :project_id => 1, :set_filter => "1", :f => []
+ get :index, :params => {
+ :project_id => 1,
+ :set_filter => "1",
+ :f => ['']
+ }
assert_select '#csv-export-form input[name=?][value=?]', 'f[]', ''
end
def test_index_csv
- get :index, :format => 'csv'
+ get :index, :params => {
+ :format => 'csv'
+ }
assert_response :success
assert_equal 'text/csv; header=present', @response.content_type
@@ -462,7 +569,10 @@ class IssuesControllerTest < Redmine::ControllerTest
end
def test_index_csv_with_project
- get :index, :project_id => 1, :format => 'csv'
+ get :index, :params => {
+ :project_id => 1,
+ :format => 'csv'
+ }
assert_response :success
assert_equal 'text/csv; header=present', @response.content_type
@@ -471,7 +581,11 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_index_csv_without_any_filters
@request.session[:user_id] = 1
Issue.create!(:project_id => 1, :tracker_id => 1, :status_id => 5, :subject => 'Closed issue', :author_id => 1)
- get :index, :set_filter => 1, :f => [], :format => 'csv'
+ get :index, :params => {
+ :set_filter => 1,
+ :f => [''],
+ :format => 'csv'
+ }
assert_response :success
# -1 for headers
assert_equal Issue.count, response.body.chomp.split("\n").size - 1
@@ -481,7 +595,11 @@ class IssuesControllerTest < Redmine::ControllerTest
Issue.generate!(:description => 'test_index_csv_with_description')
with_settings :default_language => 'en' do
- get :index, :format => 'csv', :c => [:tracker, :description]
+ get :index, :params => {
+ :format => 'csv',
+ :c => [:tracker,
+ :description]
+ }
assert_response :success
end
@@ -495,7 +613,11 @@ class IssuesControllerTest < Redmine::ControllerTest
issue = Issue.create!(:project_id => 1, :tracker_id => 1, :subject => 'test_index_csv_with_spent_time_column', :author_id => 2)
TimeEntry.create!(:project => issue.project, :issue => issue, :hours => 7.33, :user => User.find(2), :spent_on => Date.today)
- get :index, :format => 'csv', :set_filter => '1', :c => %w(subject spent_hours)
+ get :index, :params => {
+ :format => 'csv',
+ :set_filter => '1',
+ :c => %w(subject spent_hours)
+ }
assert_response :success
assert_equal 'text/csv; header=present', @response.content_type
lines = @response.body.chomp.split("\n")
@@ -503,7 +625,10 @@ class IssuesControllerTest < Redmine::ControllerTest
end
def test_index_csv_with_all_columns
- get :index, :format => 'csv', :c => ['all_inline']
+ get :index, :params => {
+ :format => 'csv',
+ :c => ['all_inline']
+ }
assert_response :success
assert_equal 'text/csv; header=present', @response.content_type
@@ -518,7 +643,10 @@ class IssuesControllerTest < Redmine::ControllerTest
issue.custom_field_values = {1 => ['MySQL', 'Oracle']}
issue.save!
- get :index, :format => 'csv', :c => ['tracker', "cf_1"]
+ get :index, :params => {
+ :format => 'csv',
+ :c => ['tracker', "cf_1"]
+ }
assert_response :success
lines = @response.body.chomp.split("\n")
assert lines.detect {|line| line.include?('"MySQL, Oracle"')}
@@ -529,14 +657,20 @@ class IssuesControllerTest < Redmine::ControllerTest
issue = Issue.generate!(:project_id => 1, :tracker_id => 1, :custom_field_values => {field.id => '185.6'})
with_settings :default_language => 'fr' do
- get :index, :format => 'csv', :c => ['id', 'tracker', "cf_#{field.id}"]
+ get :index, :params => {
+ :format => 'csv',
+ :c => ['id', 'tracker', "cf_#{field.id}"]
+ }
assert_response :success
issue_line = response.body.chomp.split("\n").map {|line| line.split(';')}.detect {|line| line[0]==issue.id.to_s}
assert_include '185,60', issue_line
end
with_settings :default_language => 'en' do
- get :index, :format => 'csv', :c => ['id', 'tracker', "cf_#{field.id}"]
+ get :index, :params => {
+ :format => 'csv',
+ :c => ['id', 'tracker', "cf_#{field.id}"]
+ }
assert_response :success
issue_line = response.body.chomp.split("\n").map {|line| line.split(',')}.detect {|line| line[0]==issue.id.to_s}
assert_include '185.60', issue_line
@@ -549,7 +683,10 @@ class IssuesControllerTest < Redmine::ControllerTest
child = Issue.generate!(:parent_issue_id => parent.id)
with_settings :default_language => 'en' do
- get :index, :format => 'csv', :c => %w(parent)
+ get :index, :params => {
+ :format => 'csv',
+ :c => %w(parent)
+ }
end
lines = response.body.split("\n")
assert_include "#{child.id},#{parent.id}", lines
@@ -561,10 +698,11 @@ class IssuesControllerTest < Redmine::ControllerTest
str_big5 = "\xa4@\xa4\xeb".force_encoding('Big5')
issue = Issue.generate!(:subject => str_utf8)
- get :index, :project_id => 1,
- :f => ['subject'],
- :op => '=', :values => [str_utf8],
- :format => 'csv'
+ get :index, :params => {
+ :project_id => 1,
+ :subject => str_utf8,
+ :format => 'csv'
+ }
assert_equal 'text/csv; header=present', @response.content_type
lines = @response.body.chomp.split("\n")
header = lines[0]
@@ -580,12 +718,13 @@ class IssuesControllerTest < Redmine::ControllerTest
str_utf8 = "\xe4\xbb\xa5\xe5\x86\x85".force_encoding('UTF-8')
issue = Issue.generate!(:subject => str_utf8)
- get :index, :project_id => 1,
- :f => ['subject'],
- :op => '=', :values => [str_utf8],
- :c => ['status', 'subject'],
- :format => 'csv',
- :set_filter => 1
+ get :index, :params => {
+ :project_id => 1,
+ :subject => str_utf8,
+ :c => ['status', 'subject'],
+ :format => 'csv',
+ :set_filter => 1
+ }
assert_equal 'text/csv; header=present', @response.content_type
lines = @response.body.chomp.split("\n")
header = lines[0]
@@ -603,12 +742,13 @@ class IssuesControllerTest < Redmine::ControllerTest
str1 = "test_index_csv_tw"
issue = Issue.generate!(:subject => str1, :estimated_hours => '1234.5')
- get :index, :project_id => 1,
- :f => ['subject'],
- :op => '=', :values => [str1],
- :c => ['estimated_hours', 'subject'],
- :format => 'csv',
- :set_filter => 1
+ get :index, :params => {
+ :project_id => 1,
+ :subject => str1,
+ :c => ['estimated_hours', 'subject'],
+ :format => 'csv',
+ :set_filter => 1
+ }
assert_equal 'text/csv; header=present', @response.content_type
lines = @response.body.chomp.split("\n")
assert_include "#{issue.id},1234.50,#{str1}", lines
@@ -620,12 +760,13 @@ class IssuesControllerTest < Redmine::ControllerTest
str1 = "test_index_csv_fr"
issue = Issue.generate!(:subject => str1, :estimated_hours => '1234.5')
- get :index, :project_id => 1,
- :f => ['subject'],
- :op => '=', :values => [str1],
- :c => ['estimated_hours', 'subject'],
- :format => 'csv',
- :set_filter => 1
+ get :index, :params => {
+ :project_id => 1,
+ :subject => str1,
+ :c => ['estimated_hours', 'subject'],
+ :format => 'csv',
+ :set_filter => 1
+ }
assert_equal 'text/csv; header=present', @response.content_type
lines = @response.body.chomp.split("\n")
assert_include "#{issue.id};1234,50;#{str1}", lines
@@ -639,15 +780,24 @@ class IssuesControllerTest < Redmine::ControllerTest
get :index
assert_response :success
- get :index, :format => 'pdf'
+ get :index, :params => {
+ :format => 'pdf'
+ }
assert_response :success
assert_equal 'application/pdf', @response.content_type
- get :index, :project_id => 1, :format => 'pdf'
+ get :index, :params => {
+ :project_id => 1,
+ :format => 'pdf'
+ }
assert_response :success
assert_equal 'application/pdf', @response.content_type
- get :index, :project_id => 1, :query_id => 6, :format => 'pdf'
+ get :index, :params => {
+ :project_id => 1,
+ :query_id => 6,
+ :format => 'pdf'
+ }
assert_response :success
assert_equal 'application/pdf', @response.content_type
end
@@ -655,13 +805,20 @@ class IssuesControllerTest < Redmine::ControllerTest
end
def test_index_pdf_with_query_grouped_by_list_custom_field
- get :index, :project_id => 1, :query_id => 9, :format => 'pdf'
+ get :index, :params => {
+ :project_id => 1,
+ :query_id => 9,
+ :format => 'pdf'
+ }
assert_response :success
assert_equal 'application/pdf', @response.content_type
end
def test_index_atom
- get :index, :project_id => 'ecookbook', :format => 'atom'
+ get :index, :params => {
+ :project_id => 'ecookbook',
+ :format => 'atom'
+ }
assert_response :success
assert_equal 'application/atom+xml', response.content_type
@@ -673,13 +830,18 @@ class IssuesControllerTest < Redmine::ControllerTest
end
def test_index_should_include_back_url_input
- get :index, :project_id => 'ecookbook', :foo => 'bar'
+ get :index, :params => {
+ :project_id => 'ecookbook',
+ :foo => 'bar'
+ }
assert_response :success
assert_select 'input[name=back_url][value=?]', '/projects/ecookbook/issues?foo=bar'
end
def test_index_sort
- get :index, :sort => 'tracker,id:desc'
+ get :index, :params => {
+ :sort => 'tracker,id:desc'
+ }
assert_response :success
assert_equal issues_in_list.sort_by {|issue| [issue.tracker.position, -issue.id]}, issues_in_list
@@ -688,13 +850,17 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_index_sort_by_field_not_included_in_columns
with_settings :issue_list_default_columns => %w(subject author) do
- get :index, :sort => 'tracker'
+ get :index, :params => {
+ :sort => 'tracker'
+ }
assert_response :success
end
end
def test_index_sort_by_assigned_to
- get :index, :sort => 'assigned_to'
+ get :index, :params => {
+ :sort => 'assigned_to'
+ }
assert_response :success
assignees = issues_in_list.map(&:assigned_to).compact
@@ -703,7 +869,9 @@ class IssuesControllerTest < Redmine::ControllerTest
end
def test_index_sort_by_assigned_to_desc
- get :index, :sort => 'assigned_to:desc'
+ get :index, :params => {
+ :sort => 'assigned_to:desc'
+ }
assert_response :success
assignees = issues_in_list.map(&:assigned_to).compact
@@ -712,12 +880,18 @@ class IssuesControllerTest < Redmine::ControllerTest
end
def test_index_group_by_assigned_to
- get :index, :group_by => 'assigned_to', :sort => 'priority'
+ get :index, :params => {
+ :group_by => 'assigned_to',
+ :sort => 'priority'
+ }
assert_response :success
end
def test_index_sort_by_author
- get :index, :sort => 'author', :c => ['author']
+ get :index, :params => {
+ :sort => 'author',
+ :c => ['author']
+ }
assert_response :success
authors = issues_in_list.map(&:author)
@@ -725,7 +899,9 @@ class IssuesControllerTest < Redmine::ControllerTest
end
def test_index_sort_by_author_desc
- get :index, :sort => 'author:desc'
+ get :index, :params => {
+ :sort => 'author:desc'
+ }
assert_response :success
authors = issues_in_list.map(&:author)
@@ -733,38 +909,51 @@ class IssuesControllerTest < Redmine::ControllerTest
end
def test_index_group_by_author
- get :index, :group_by => 'author', :sort => 'priority'
+ get :index, :params => {
+ :group_by => 'author',
+ :sort => 'priority'
+ }
assert_response :success
end
def test_index_sort_by_last_updated_by
- get :index, :sort => 'last_updated_by'
+ get :index, :params => {
+ :sort => 'last_updated_by'
+ }
assert_response :success
assert_select 'table.issues.sort-by-last-updated-by.sort-asc'
end
def test_index_sort_by_last_updated_by_desc
- get :index, :sort => 'last_updated_by:desc'
+ get :index, :params => {
+ :sort => 'last_updated_by:desc'
+ }
assert_response :success
assert_select 'table.issues.sort-by-last-updated-by.sort-desc'
end
def test_index_sort_by_spent_hours
- get :index, :sort => 'spent_hours:desc'
+ get :index, :params => {
+ :sort => 'spent_hours:desc'
+ }
assert_response :success
hours = issues_in_list.map(&:spent_hours)
assert_equal hours.sort.reverse, hours
end
def test_index_sort_by_total_spent_hours
- get :index, :sort => 'total_spent_hours:desc'
+ get :index, :params => {
+ :sort => 'total_spent_hours:desc'
+ }
assert_response :success
hours = issues_in_list.map(&:total_spent_hours)
assert_equal hours.sort.reverse, hours
end
def test_index_sort_by_total_estimated_hours
- get :index, :sort => 'total_estimated_hours:desc'
+ get :index, :params => {
+ :sort => 'total_estimated_hours:desc'
+ }
assert_response :success
hours = issues_in_list.map(&:total_estimated_hours)
assert_equal hours.sort.reverse, hours
@@ -777,7 +966,11 @@ class IssuesControllerTest < Redmine::ControllerTest
CustomValue.create!(:custom_field => cf, :customized => Issue.find(3), :value => '3')
CustomValue.create!(:custom_field => cf, :customized => Issue.find(5), :value => '')
- get :index, :project_id => 1, :set_filter => 1, :sort => "cf_#{cf.id},id"
+ get :index, :params => {
+ :project_id => 1,
+ :set_filter => 1,
+ :sort => "cf_#{cf.id},id"
+ }
assert_response :success
assert_equal [2, 3, 1], issues_in_list.select {|issue| issue.custom_field_value(cf).present?}.map(&:id)
@@ -785,7 +978,10 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_index_with_columns
columns = ['tracker', 'subject', 'assigned_to']
- get :index, :set_filter => 1, :c => columns
+ get :index, :params => {
+ :set_filter => 1,
+ :c => columns
+ }
assert_response :success
# query should use specified columns + id and checkbox
@@ -806,7 +1002,9 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_index_without_project_should_implicitly_add_project_column_to_default_columns
with_settings :issue_list_default_columns => ['tracker', 'subject', 'assigned_to'] do
- get :index, :set_filter => 1
+ get :index, :params => {
+ :set_filter => 1
+ }
end
# query should use specified columns
@@ -816,7 +1014,10 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_index_without_project_and_explicit_default_columns_should_not_add_project_column
with_settings :issue_list_default_columns => ['tracker', 'subject', 'assigned_to'] do
columns = ['id', 'tracker', 'subject', 'assigned_to']
- get :index, :set_filter => 1, :c => columns
+ get :index, :params => {
+ :set_filter => 1,
+ :c => columns
+ }
end
# query should use specified columns
@@ -826,7 +1027,10 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_index_with_default_columns_should_respect_default_columns_order
columns = ['assigned_to', 'subject', 'status', 'tracker']
with_settings :issue_list_default_columns => columns do
- get :index, :project_id => 1, :set_filter => 1
+ get :index, :params => {
+ :project_id => 1,
+ :set_filter => 1
+ }
assert_equal ["#", "Assignee", "Subject", "Status", "Tracker"], columns_in_issues_list
end
@@ -834,7 +1038,10 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_index_with_custom_field_column
columns = %w(tracker subject cf_2)
- get :index, :set_filter => 1, :c => columns
+ get :index, :params => {
+ :set_filter => 1,
+ :c => columns
+ }
assert_response :success
# query should use specified columns
@@ -849,7 +1056,10 @@ class IssuesControllerTest < Redmine::ControllerTest
issue.custom_field_values = {1 => ['MySQL', 'Oracle']}
issue.save!
- get :index, :set_filter => 1, :c => %w(tracker subject cf_1)
+ get :index, :params => {
+ :set_filter => 1,
+ :c => %w(tracker subject cf_1)
+ }
assert_response :success
assert_select 'table.issues td.cf_1', :text => 'MySQL, Oracle'
@@ -862,7 +1072,10 @@ class IssuesControllerTest < Redmine::ControllerTest
issue.custom_field_values = {field.id => ['2', '3']}
issue.save!
- get :index, :set_filter => 1, :c => ['tracker', 'subject', "cf_#{field.id}"]
+ get :index, :params => {
+ :set_filter => 1,
+ :c => ['tracker', 'subject', "cf_#{field.id}"]
+ }
assert_response :success
assert_select "table.issues td.cf_#{field.id}" do
@@ -875,14 +1088,20 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_index_with_date_column
with_settings :date_format => '%d/%m/%Y' do
Issue.find(1).update_attribute :start_date, '1987-08-24'
- get :index, :set_filter => 1, :c => %w(start_date)
+ get :index, :params => {
+ :set_filter => 1,
+ :c => %w(start_date)
+ }
assert_select "table.issues td.start_date", :text => '24/08/1987'
end
end
def test_index_with_done_ratio_column
Issue.find(1).update_attribute :done_ratio, 40
- get :index, :set_filter => 1, :c => %w(done_ratio)
+ get :index, :params => {
+ :set_filter => 1,
+ :c => %w(done_ratio)
+ }
assert_select 'table.issues td.done_ratio' do
assert_select 'table.progress' do
assert_select 'td.closed[style=?]', 'width: 40%;'
@@ -892,29 +1111,44 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_index_with_spent_hours_column
Issue.expects(:load_visible_spent_hours).once
- get :index, :set_filter => 1, :c => %w(subject spent_hours)
+ get :index, :params => {
+ :set_filter => 1,
+ :c => %w(subject spent_hours)
+ }
assert_select 'table.issues tr#issue-3 td.spent_hours', :text => '1.00'
end
def test_index_with_total_spent_hours_column
Issue.expects(:load_visible_total_spent_hours).once
- get :index, :set_filter => 1, :c => %w(subject total_spent_hours)
+ get :index, :params => {
+ :set_filter => 1,
+ :c => %w(subject total_spent_hours)
+ }
assert_select 'table.issues tr#issue-3 td.total_spent_hours', :text => '1.00'
end
def test_index_with_total_estimated_hours_column
- get :index, :set_filter => 1, :c => %w(subject total_estimated_hours)
+ get :index, :params => {
+ :set_filter => 1,
+ :c => %w(subject total_estimated_hours)
+ }
assert_select 'table.issues td.total_estimated_hours'
end
def test_index_should_not_show_spent_hours_column_without_permission
Role.anonymous.remove_permission! :view_time_entries
- get :index, :set_filter => 1, :c => %w(subject spent_hours)
+ get :index, :params => {
+ :set_filter => 1,
+ :c => %w(subject spent_hours)
+ }
assert_select 'td.spent_hours', 0
end
def test_index_with_fixed_version_column
- get :index, :set_filter => 1, :c => %w(fixed_version)
+ get :index, :params => {
+ :set_filter => 1,
+ :c => %w(fixed_version)
+ }
assert_select 'table.issues td.fixed_version' do
assert_select 'a[href=?]', '/versions/2', :text => 'eCookbook - 1.0'
end
@@ -927,7 +1161,10 @@ class IssuesControllerTest < Redmine::ControllerTest
IssueRelation.create!(:relation_type => "blocks", :issue_from => Issue.find(1), :issue_to => Issue.find(11))
IssueRelation.create!(:relation_type => "blocks", :issue_from => Issue.find(12), :issue_to => Issue.find(2))
- get :index, :set_filter => 1, :c => %w(subject relations)
+ get :index, :params => {
+ :set_filter => 1,
+ :c => %w(subject relations)
+ }
assert_response :success
assert_select "tr#issue-1 td.relations" do
assert_select "span", 3
@@ -943,7 +1180,11 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_select "span", 0
end
- get :index, :set_filter => 1, :c => %w(relations), :format => 'csv'
+ get :index, :params => {
+ :set_filter => 1,
+ :c => %w(relations),
+ :format => 'csv'
+ }
assert_response :success
assert_equal 'text/csv; header=present', response.content_type
lines = response.body.chomp.split("\n")
@@ -951,24 +1192,38 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_include '2,Blocked by #12', lines
assert_include '3,""', lines
- get :index, :set_filter => 1, :c => %w(subject relations), :format => 'pdf'
+ get :index, :params => {
+ :set_filter => 1,
+ :c => %w(subject relations),
+ :format => 'pdf'
+ }
assert_response :success
assert_equal 'application/pdf', response.content_type
end
def test_index_with_description_column
- get :index, :set_filter => 1, :c => %w(subject description)
+ get :index, :params => {
+ :set_filter => 1,
+ :c => %w(subject description)
+ }
assert_select 'table.issues thead th', 3 # columns: chekbox + id + subject
assert_select 'td.description[colspan="3"]', :text => 'Unable to print recipes'
- get :index, :set_filter => 1, :c => %w(subject description), :format => 'pdf'
+ get :index, :params => {
+ :set_filter => 1,
+ :c => %w(subject description),
+ :format => 'pdf'
+ }
assert_response :success
assert_equal 'application/pdf', response.content_type
end
def test_index_with_last_notes_column
- get :index, :set_filter => 1, :c => %w(subject last_notes)
+ get :index, :params => {
+ :set_filter => 1,
+ :c => %w(subject last_notes)
+ }
assert_response :success
assert_select 'table.issues thead th', 3 # columns: chekbox + id + subject
@@ -976,7 +1231,11 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_select 'td.last_notes[colspan="3"]', :text => 'Some notes with Redmine links: #2, r2.'
assert_select 'td.last_notes[colspan="3"]', :text => 'A comment with inline image: and a reference to #1 and r2.'
- get :index, :set_filter => 1, :c => %w(subject last_notes), :format => 'pdf'
+ get :index, :params => {
+ :set_filter => 1,
+ :c => %w(subject last_notes),
+ :format => 'pdf'
+ }
assert_response :success
assert_equal 'application/pdf', response.content_type
end
@@ -986,19 +1245,28 @@ class IssuesControllerTest < Redmine::ControllerTest
journal = Journal.create!(:journalized => Issue.find(2), :notes => 'Privates notes', :private_notes => true, :user_id => 1)
@request.session[:user_id] = 2
- get :index, :set_filter => 1, :c => %w(subject last_notes)
+ get :index, :params => {
+ :set_filter => 1,
+ :c => %w(subject last_notes)
+ }
assert_response :success
assert_select 'td.last_notes[colspan="3"]', :text => 'Privates notes'
Role.find(1).remove_permission! :view_private_notes
- get :index, :set_filter => 1, :c => %w(subject last_notes)
+ get :index, :params => {
+ :set_filter => 1,
+ :c => %w(subject last_notes)
+ }
assert_response :success
assert_select 'td.last_notes[colspan="3"]', :text => 'Public notes'
end
def test_index_with_description_and_last_notes_columns_should_display_column_name
- get :index, :set_filter => 1, :c => %w(subject last_notes description)
+ get :index, :params => {
+ :set_filter => 1,
+ :c => %w(subject last_notes description)
+ }
assert_response :success
assert_select 'td.last_notes[colspan="3"] span', :text => 'Last notes'
@@ -1010,21 +1278,32 @@ class IssuesControllerTest < Redmine::ControllerTest
parent = Issue.generate!
child = Issue.generate!(:parent_issue_id => parent.id)
- get :index, :c => %w(parent)
+ get :index, :params => {
+ :c => %w(parent)
+ }
assert_select 'td.parent', :text => "#{parent.tracker} ##{parent.id}"
assert_select 'td.parent a[title=?]', parent.subject
end
def test_index_with_last_updated_by_column
- get :index, :c => %w(subject last_updated_by), :issue_id => '1,2,3', :sort => 'id', :set_filter => '1'
+ get :index, :params => {
+ :c => %w(subject last_updated_by),
+ :issue_id => '1,2,3',
+ :sort => 'id',
+ :set_filter => '1'
+ }
assert_select 'td.last_updated_by'
assert_equal ["John Smith", "John Smith", ""], css_select('td.last_updated_by').map(&:text)
end
def test_index_with_attachments_column
- get :index, :c => %w(subject attachments), :set_filter => '1', :sort => 'id'
+ get :index, :params => {
+ :c => %w(subject attachments),
+ :set_filter => '1',
+ :sort => 'id'
+ }
assert_response :success
assert_select 'td.attachments'
@@ -1037,7 +1316,12 @@ class IssuesControllerTest < Redmine::ControllerTest
end
def test_index_with_attachments_column_as_csv
- get :index, :c => %w(subject attachments), :set_filter => '1', :sort => 'id', :format => 'csv'
+ get :index, :params => {
+ :c => %w(subject attachments),
+ :set_filter => '1',
+ :sort => 'id',
+ :format => 'csv'
+ }
assert_response :success
assert_include "\"source.rb\npicture.jpg\"", response.body
@@ -1048,7 +1332,9 @@ class IssuesControllerTest < Redmine::ControllerTest
Issue.generate!(:estimated_hours => 5.5)
Issue.generate!(:estimated_hours => 1.1)
- get :index, :t => %w(estimated_hours)
+ get :index, :params => {
+ :t => %w(estimated_hours)
+ }
assert_response :success
assert_select '.query-totals'
assert_select '.total-for-estimated-hours span.value', :text => '6.60'
@@ -1062,7 +1348,10 @@ class IssuesControllerTest < Redmine::ControllerTest
Issue.generate!(:estimated_hours => 1.1, :category_id => 2)
Issue.generate!(:estimated_hours => 4.6)
- get :index, :t => %w(estimated_hours), :group_by => 'category'
+ get :index, :params => {
+ :t => %w(estimated_hours),
+ :group_by => 'category'
+ }
assert_response :success
assert_select '.query-totals'
assert_select '.query-totals .total-for-estimated-hours span.value', :text => '13.50'
@@ -1082,7 +1371,9 @@ class IssuesControllerTest < Redmine::ControllerTest
CustomValue.create!(:customized => Issue.find(1), :custom_field => field, :value => '2')
CustomValue.create!(:customized => Issue.find(2), :custom_field => field, :value => '7')
- get :index, :t => ["cf_#{field.id}"]
+ get :index, :params => {
+ :t => ["cf_#{field.id}"]
+ }
assert_response :success
assert_select '.query-totals'
assert_select ".total-for-cf-#{field.id} span.value", :text => '9'
@@ -1098,20 +1389,33 @@ class IssuesControllerTest < Redmine::ControllerTest
end
def test_index_send_html_if_query_is_invalid
- get :index, :f => ['start_date'], :op => {:start_date => '='}
+ get :index, :params => {
+ :f => ['start_date'],
+ :op => {
+ :start_date => '='
+ }
+ }
assert_equal 'text/html', @response.content_type
assert_select_error /Start date cannot be blank/i
end
def test_index_send_nothing_if_query_is_invalid
- get :index, :f => ['start_date'], :op => {:start_date => '='}, :format => 'csv'
+ get :index, :params => {
+ :f => ['start_date'],
+ :op => {
+ :start_date => '='
+ },
+ :format => 'csv'
+ }
assert_equal 'text/csv', @response.content_type
assert @response.body.blank?
end
def test_index_should_include_new_issue_link
@request.session[:user_id] = 2
- get :index, :project_id => 1
+ get :index, :params => {
+ :project_id => 1
+ }
assert_select '#content a.new-issue[href="/projects/ecookbook/issues/new"]', :text => 'New issue'
end
@@ -1119,7 +1423,9 @@ class IssuesControllerTest < Redmine::ControllerTest
Project.find(1).trackers.clear
@request.session[:user_id] = 2
- get :index, :project_id => 1
+ get :index, :params => {
+ :project_id => 1
+ }
assert_select '#content a.new-issue', 0
end
@@ -1129,7 +1435,9 @@ class IssuesControllerTest < Redmine::ControllerTest
role.add_permission! :copy_issues
@request.session[:user_id] = 2
- get :index, :project_id => 1
+ get :index, :params => {
+ :project_id => 1
+ }
assert_select '#content a.new-issue', 0
end
@@ -1142,7 +1450,9 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_index_should_not_include_new_issue_tab_when_disabled
with_settings :new_item_menu_tab => '0' do
@request.session[:user_id] = 2
- get :index, :project_id => 1
+ get :index, :params => {
+ :project_id => 1
+ }
assert_select '#main-menu a.new-issue', 0
end
end
@@ -1150,7 +1460,9 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_index_should_include_new_issue_tab_when_enabled
with_settings :new_item_menu_tab => '1' do
@request.session[:user_id] = 2
- get :index, :project_id => 1
+ get :index, :params => {
+ :project_id => 1
+ }
assert_select '#main-menu a.new-issue[href="/projects/ecookbook/issues/new"]', :text => 'New issue'
end
end
@@ -1158,7 +1470,9 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_new_should_have_new_issue_tab_as_current_menu_item
with_settings :new_item_menu_tab => '1' do
@request.session[:user_id] = 2
- get :new, :project_id => 1
+ get :new, :params => {
+ :project_id => 1
+ }
assert_select '#main-menu a.new-issue.selected'
end
end
@@ -1168,7 +1482,9 @@ class IssuesControllerTest < Redmine::ControllerTest
Project.find(1).trackers.clear
@request.session[:user_id] = 2
- get :index, :project_id => 1
+ get :index, :params => {
+ :project_id => 1
+ }
assert_select '#main-menu a.new-issue', 0
end
end
@@ -1180,13 +1496,17 @@ class IssuesControllerTest < Redmine::ControllerTest
role.add_permission! :copy_issues
@request.session[:user_id] = 2
- get :index, :project_id => 1
+ get :index, :params => {
+ :project_id => 1
+ }
assert_select '#main-menu a.new-issue', 0
end
end
def test_show_by_anonymous
- get :show, :id => 1
+ get :show, :params => {
+ :id => 1
+ }
assert_response :success
assert_select 'div.issue div.description', :text => /Unable to print recipes/
@@ -1202,7 +1522,9 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_show_by_manager
@request.session[:user_id] = 2
- get :show, :id => 1
+ get :show, :params => {
+ :id => 1
+ }
assert_select 'a', :text => /Quote/
assert_select 'form#issue-form' do
@@ -1223,7 +1545,9 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_show_should_display_update_form
@request.session[:user_id] = 2
- get :show, :id => 1
+ get :show, :params => {
+ :id => 1
+ }
assert_response :success
assert_select 'form#issue-form' do
@@ -1252,7 +1576,9 @@ class IssuesControllerTest < Redmine::ControllerTest
WorkflowTransition.where(:role_id => 1).delete_all
@request.session[:user_id] = 2
- get :show, :id => 1
+ get :show, :params => {
+ :id => 1
+ }
assert_response :success
assert_select 'form#issue-form' do
@@ -1280,7 +1606,9 @@ class IssuesControllerTest < Redmine::ControllerTest
Role.find(1).update_attribute :permissions, [:view_issues]
@request.session[:user_id] = 2
- get :show, :id => 1
+ get :show, :params => {
+ :id => 1
+ }
assert_response :success
assert_select 'form#issue-form', 0
@@ -1290,7 +1618,9 @@ class IssuesControllerTest < Redmine::ControllerTest
assert !IssuePriority.find(15).active?
@request.session[:user_id] = 2
- get :show, :id => 1
+ get :show, :params => {
+ :id => 1
+ }
assert_response :success
assert_select 'form#issue-form' do
@@ -1303,7 +1633,9 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_update_form_should_allow_attachment_upload
@request.session[:user_id] = 2
- get :show, :id => 1
+ get :show, :params => {
+ :id => 1
+ }
assert_select 'form#issue-form[method=post][enctype="multipart/form-data"]' do
assert_select 'input[type=file][name=?]', 'attachments[dummy][file]'
@@ -1312,55 +1644,71 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_show_should_deny_anonymous_access_without_permission
Role.anonymous.remove_permission!(:view_issues)
- get :show, :id => 1
+ get :show, :params => {
+ :id => 1
+ }
assert_response :redirect
end
def test_show_should_deny_anonymous_access_to_private_issue
Issue.where(:id => 1).update_all(["is_private = ?", true])
- get :show, :id => 1
+ get :show, :params => {
+ :id => 1
+ }
assert_response :redirect
end
def test_show_should_deny_non_member_access_without_permission
Role.non_member.remove_permission!(:view_issues)
@request.session[:user_id] = 9
- get :show, :id => 1
+ get :show, :params => {
+ :id => 1
+ }
assert_response 403
end
def test_show_should_deny_non_member_access_to_private_issue
Issue.where(:id => 1).update_all(["is_private = ?", true])
@request.session[:user_id] = 9
- get :show, :id => 1
+ get :show, :params => {
+ :id => 1
+ }
assert_response 403
end
def test_show_should_deny_member_access_without_permission
Role.find(1).remove_permission!(:view_issues)
@request.session[:user_id] = 2
- get :show, :id => 1
+ get :show, :params => {
+ :id => 1
+ }
assert_response 403
end
def test_show_should_deny_member_access_to_private_issue_without_permission
Issue.where(:id => 1).update_all(["is_private = ?", true])
@request.session[:user_id] = 3
- get :show, :id => 1
+ get :show, :params => {
+ :id => 1
+ }
assert_response 403
end
def test_show_should_allow_author_access_to_private_issue
Issue.where(:id => 1).update_all(["is_private = ?, author_id = 3", true])
@request.session[:user_id] = 3
- get :show, :id => 1
+ get :show, :params => {
+ :id => 1
+ }
assert_response :success
end
def test_show_should_allow_assignee_access_to_private_issue
Issue.where(:id => 1).update_all(["is_private = ?, assigned_to_id = 3", true])
@request.session[:user_id] = 3
- get :show, :id => 1
+ get :show, :params => {
+ :id => 1
+ }
assert_response :success
end
@@ -1368,7 +1716,9 @@ class IssuesControllerTest < Redmine::ControllerTest
Issue.where(:id => 1).update_all(["is_private = ?", true])
User.find(3).roles_for_project(Project.find(1)).first.update_attribute :issues_visibility, 'all'
@request.session[:user_id] = 3
- get :show, :id => 1
+ get :show, :params => {
+ :id => 1
+ }
assert_response :success
end
@@ -1378,7 +1728,9 @@ class IssuesControllerTest < Redmine::ControllerTest
# Relation to a private project issue
IssueRelation.create!(:issue_from => Issue.find(1), :issue_to => Issue.find(4), :relation_type => 'relates')
- get :show, :id => 1
+ get :show, :params => {
+ :id => 1
+ }
assert_response :success
assert_select 'div#relations' do
@@ -1390,7 +1742,9 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_show_should_list_subtasks
Issue.create!(:project_id => 1, :author_id => 1, :tracker_id => 1, :parent_issue_id => 1, :subject => 'Child Issue')
- get :show, :id => 1
+ get :show, :params => {
+ :id => 1
+ }
assert_response :success
assert_select 'div#issue_tree' do
@@ -1401,7 +1755,9 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_show_should_list_parents
issue = Issue.create!(:project_id => 1, :author_id => 1, :tracker_id => 1, :parent_issue_id => 1, :subject => 'Child Issue')
- get :show, :id => issue.id
+ get :show, :params => {
+ :id => issue.id
+ }
assert_response :success
assert_select 'div.subject' do
@@ -1411,7 +1767,9 @@ class IssuesControllerTest < Redmine::ControllerTest
end
def test_show_should_not_display_prev_next_links_without_query_in_session
- get :show, :id => 1
+ get :show, :params => {
+ :id => 1
+ }
assert_response :success
assert_select 'div.next-prev-links', 0
@@ -1421,7 +1779,9 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:issue_query] = {:filters => {'status_id' => {:values => [''], :operator => 'o'}}, :project_id => nil, :sort => [['id', 'asc']]}
with_settings :display_subprojects_issues => '0' do
- get :show, :id => 3
+ get :show, :params => {
+ :id => 3
+ }
end
assert_response :success
@@ -1441,7 +1801,9 @@ class IssuesControllerTest < Redmine::ControllerTest
:sort_criteria => [['id', 'asc']])
@request.session[:issue_query] = {:id => query.id, :project_id => nil}
- get :show, :id => 11
+ get :show, :params => {
+ :id => 11
+ }
assert_response :success
# Previous and next issues for all projects
@@ -1457,7 +1819,9 @@ class IssuesControllerTest < Redmine::ControllerTest
%w(project tracker status priority author assigned_to category fixed_version).each do |assoc_sort|
@request.session[:issue_query][:sort] = [[assoc_sort, 'asc']]
- get :show, :id => 3
+ get :show, :params => {
+ :id => 3
+ }
assert_response :success, "Wrong response status for #{assoc_sort} sort"
assert_select 'div.next-prev-links' do
@@ -1470,7 +1834,9 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:issue_query] = {:filters => {'status_id' => {:values => [''], :operator => 'o'}}, :project_id => 1, :sort => [['id','asc']]}
with_settings :display_subprojects_issues => '0' do
- get :show, :id => 3
+ get :show, :params => {
+ :id => 3
+ }
end
assert_response :success
@@ -1485,7 +1851,9 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:issue_query] = {:filters => {'status_id' => {:values => [''], :operator => 'o'}}, :project_id => 1, :sort => [['id', 'asc']]}
with_settings :display_subprojects_issues => '0' do
- get :show, :id => 1
+ get :show, :params => {
+ :id => 1
+ }
end
assert_response :success
@@ -1498,7 +1866,9 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_show_should_not_display_prev_next_links_for_issue_not_in_query_results
@request.session[:issue_query] = {:filters => {'status_id' => {:values => [''], :operator => 'c'}}, :project_id => 1, :sort => [['id', 'asc']]}
- get :show, :id => 1
+ get :show, :params => {
+ :id => 1
+ }
assert_response :success
assert_select 'a', :text => /Previous/, :count => 0
@@ -1516,7 +1886,9 @@ class IssuesControllerTest < Redmine::ControllerTest
:sort_criteria => [["cf_#{cf.id}", 'asc'], ['id', 'asc']])
@request.session[:issue_query] = {:id => query.id, :project_id => nil}
- get :show, :id => 3
+ get :show, :params => {
+ :id => 3
+ }
assert_response :success
assert_select 'div.next-prev-links' do
@@ -1526,7 +1898,13 @@ class IssuesControllerTest < Redmine::ControllerTest
end
def test_show_should_display_prev_next_links_when_request_has_previous_and_next_issue_ids_params
- get :show, :id => 1, :prev_issue_id => 1, :next_issue_id => 3, :issue_position => 2, :issue_count => 4
+ get :show, :params => {
+ :id => 1,
+ :prev_issue_id => 1,
+ :next_issue_id => 3,
+ :issue_position => 2,
+ :issue_count => 4
+ }
assert_response :success
assert_select 'div.next-prev-links' do
@@ -1539,7 +1917,9 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_show_should_display_category_field_if_categories_are_defined
Issue.update_all :category_id => nil
- get :show, :id => 1
+ get :show, :params => {
+ :id => 1
+ }
assert_response :success
assert_select '.attributes .category'
end
@@ -1547,13 +1927,17 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_show_should_not_display_category_field_if_no_categories_are_defined
Project.find(1).issue_categories.delete_all
- get :show, :id => 1
+ get :show, :params => {
+ :id => 1
+ }
assert_response :success
assert_select 'table.attributes .category', 0
end
def test_show_should_display_link_to_the_assignee
- get :show, :id => 2
+ get :show, :params => {
+ :id => 2
+ }
assert_response :success
assert_select '.assigned-to' do
assert_select 'a[href="/users/3"]'
@@ -1570,7 +1954,9 @@ class IssuesControllerTest < Redmine::ControllerTest
project.disable_module! :repository
@request.session[:user_id] = 2
- get :show, :id => issue.id
+ get :show, :params => {
+ :id => issue.id
+ }
assert_select 'a[href=?]', '/projects/ecookbook/repository/revisions/3'
end
@@ -1579,7 +1965,9 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
Issue.find(1).add_watcher User.find(2)
- get :show, :id => 1
+ get :show, :params => {
+ :id => 1
+ }
assert_select 'div#watchers ul' do
assert_select 'li' do
assert_select 'a[href="/users/2"]'
@@ -1593,7 +1981,9 @@ class IssuesControllerTest < Redmine::ControllerTest
Issue.find(1).add_watcher User.find(2)
with_settings :gravatar_enabled => '1' do
- get :show, :id => 1
+ get :show, :params => {
+ :id => 1
+ }
end
assert_select 'div#watchers ul' do
@@ -1609,7 +1999,9 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
with_settings :thumbnails_enabled => '1' do
- get :show, :id => 14
+ get :show, :params => {
+ :id => 14
+ }
assert_response :success
end
@@ -1624,7 +2016,9 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
with_settings :thumbnails_enabled => '0' do
- get :show, :id => 14
+ get :show, :params => {
+ :id => 14
+ }
assert_response :success
end
@@ -1638,7 +2032,9 @@ class IssuesControllerTest < Redmine::ControllerTest
issue.custom_field_values = {1 => ['MySQL', 'Oracle']}
issue.save!
- get :show, :id => 1
+ get :show, :params => {
+ :id => 1
+ }
assert_response :success
assert_select ".cf_1 .value", :text => 'MySQL, Oracle'
@@ -1651,7 +2047,9 @@ class IssuesControllerTest < Redmine::ControllerTest
issue.custom_field_values = {field.id => 'This is a long text'}
issue.save!
- get :show, :id => 1
+ get :show, :params => {
+ :id => 1
+ }
assert_response :success
# long text custom field should not be render in the attributes div
@@ -1670,7 +2068,9 @@ class IssuesControllerTest < Redmine::ControllerTest
issue.custom_field_values = {field.id => ['2', '3']}
issue.save!
- get :show, :id => 1
+ get :show, :params => {
+ :id => 1
+ }
assert_response :success
assert_select ".cf_#{field.id} .value", :text => 'Dave Lopper, John Smith' do
@@ -1683,12 +2083,16 @@ class IssuesControllerTest < Redmine::ControllerTest
journal = Journal.create!(:journalized => Issue.find(2), :notes => 'Privates notes', :private_notes => true, :user_id => 1)
@request.session[:user_id] = 2
- get :show, :id => 2
+ get :show, :params => {
+ :id => 2
+ }
assert_response :success
assert_select "#change-#{journal.id}", 1
Role.find(1).remove_permission! :view_private_notes
- get :show, :id => 2
+ get :show, :params => {
+ :id => 2
+ }
assert_response :success
assert_select "#change-#{journal.id}", 0
end
@@ -1701,14 +2105,19 @@ class IssuesControllerTest < Redmine::ControllerTest
not_visible = Journal.create!(:journalized => Issue.find(2), :notes => 'Private notes', :private_notes => true, :user_id => 1)
@request.session[:user_id] = 3
- get :show, :id => 2
+ get :show, :params => {
+ :id => 2
+ }
assert_response :success
assert_select "#change-#{visible.id}", 1
assert_select "#change-#{not_visible.id}", 0
end
def test_show_atom
- get :show, :id => 2, :format => 'atom'
+ get :show, :params => {
+ :id => 2,
+ :format => 'atom'
+ }
assert_response :success
assert_equal 'application/atom+xml', response.content_type
# Inline image
@@ -1718,7 +2127,10 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_show_export_to_pdf
issue = Issue.find(3)
assert issue.relations.select{|r| r.other_issue(issue).visible?}.present?
- get :show, :id => 3, :format => 'pdf'
+ get :show, :params => {
+ :id => 3,
+ :format => 'pdf'
+ }
assert_response :success
assert_equal 'application/pdf', @response.content_type
assert @response.body.starts_with?('%PDF')
@@ -1731,7 +2143,10 @@ class IssuesControllerTest < Redmine::ControllerTest
issue = Issue.generate!(:subject => s)
["en", "zh", "zh-TW", "ja", "ko"].each do |lang|
with_settings :default_language => lang do
- get :show, :id => issue.id, :format => 'pdf'
+ get :show, :params => {
+ :id => issue.id,
+ :format => 'pdf'
+ }
assert_response :success
assert_equal 'application/pdf', @response.content_type
assert @response.body.starts_with?('%PDF')
@@ -1742,7 +2157,10 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_show_export_to_pdf_with_ancestors
issue = Issue.generate!(:project_id => 1, :author_id => 2, :tracker_id => 1, :subject => 'child', :parent_issue_id => 1)
- get :show, :id => issue.id, :format => 'pdf'
+ get :show, :params => {
+ :id => issue.id,
+ :format => 'pdf'
+ }
assert_response :success
assert_equal 'application/pdf', @response.content_type
assert @response.body.starts_with?('%PDF')
@@ -1753,14 +2171,20 @@ class IssuesControllerTest < Redmine::ControllerTest
c2 = Issue.generate!(:project_id => 1, :author_id => 2, :tracker_id => 1, :subject => 'child', :parent_issue_id => 1)
c3 = Issue.generate!(:project_id => 1, :author_id => 2, :tracker_id => 1, :subject => 'child', :parent_issue_id => c1.id)
- get :show, :id => 1, :format => 'pdf'
+ get :show, :params => {
+ :id => 1,
+ :format => 'pdf'
+ }
assert_response :success
assert_equal 'application/pdf', @response.content_type
assert @response.body.starts_with?('%PDF')
end
def test_show_export_to_pdf_with_journals
- get :show, :id => 1, :format => 'pdf'
+ get :show, :params => {
+ :id => 1,
+ :format => 'pdf'
+ }
assert_response :success
assert_equal 'application/pdf', @response.content_type
assert @response.body.starts_with?('%PDF')
@@ -1773,7 +2197,10 @@ class IssuesControllerTest < Redmine::ControllerTest
issue1.save!
issue = Issue.find(3)
assert_equal issue.changesets.count, cs.size
- get :show, :id => 3, :format => 'pdf'
+ get :show, :params => {
+ :id => 3,
+ :format => 'pdf'
+ }
assert_response :success
assert_equal 'application/pdf', @response.content_type
assert @response.body.starts_with?('%PDF')
@@ -1781,14 +2208,18 @@ class IssuesControllerTest < Redmine::ControllerTest
end
def test_show_invalid_should_respond_with_404
- get :show, :id => 999
+ get :show, :params => {
+ :id => 999
+ }
assert_response 404
end
def test_show_on_active_project_should_display_edit_links
@request.session[:user_id] = 1
- get :show, :id => 1
+ get :show, :params => {
+ :id => 1
+ }
assert_response :success
assert_select 'a', :text => 'Edit'
assert_select 'a', :text => 'Delete'
@@ -1798,7 +2229,9 @@ class IssuesControllerTest < Redmine::ControllerTest
Issue.find(1).project.close
@request.session[:user_id] = 1
- get :show, :id => 1
+ get :show, :params => {
+ :id => 1
+ }
assert_response :success
assert_select 'a', :text => 'Edit', :count => 0
assert_select 'a', :text => 'Delete', :count => 0
@@ -1806,7 +2239,10 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_get_new
@request.session[:user_id] = 2
- get :new, :project_id => 1, :tracker_id => 1
+ get :new, :params => {
+ :project_id => 1,
+ :tracker_id => 1
+ }
assert_response :success
assert_select 'form#issue-form[action=?]', '/projects/ecookbook/issues'
@@ -1841,7 +2277,10 @@ class IssuesControllerTest < Redmine::ControllerTest
WorkflowTransition.where(:role_id => 1).delete_all
@request.session[:user_id] = 2
- get :new, :project_id => 1, :tracker_id => 1
+ get :new, :params => {
+ :project_id => 1,
+ :tracker_id => 1
+ }
assert_response :success
assert_select 'form#issue-form' do
@@ -1878,7 +2317,9 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_new_should_select_default_status
@request.session[:user_id] = 2
- get :new, :project_id => 1
+ get :new, :params => {
+ :project_id => 1
+ }
assert_response :success
assert_select 'select[name=?]', 'issue[status_id]' do
assert_select 'option[value="1"][selected=selected]'
@@ -1892,7 +2333,9 @@ class IssuesControllerTest < Redmine::ControllerTest
WorkflowTransition.create!(:tracker_id => 1, :role_id => 1, :old_status_id => 0, :new_status_id => 3)
@request.session[:user_id] = 2
- get :new, :project_id => 1
+ get :new, :params => {
+ :project_id => 1
+ }
assert_response :success
assert_select 'select[name=?]', 'issue[status_id]' do
assert_select 'option[value="1"]'
@@ -1908,7 +2351,9 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_equal 1, Tracker.find(1).default_status_id
@request.session[:user_id] = 2
- get :new, :project_id => 1
+ get :new, :params => {
+ :project_id => 1
+ }
assert_response :success
assert_select 'select[name=?]', 'issue[status_id]' do
assert_select 'option[value="2"]'
@@ -1923,7 +2368,9 @@ class IssuesControllerTest < Redmine::ControllerTest
role.save!
@request.session[:user_id] = 2
- get :new, :project_id => 1
+ get :new, :params => {
+ :project_id => 1
+ }
assert_response :success
assert_select 'select[name=?]', 'issue[tracker_id]' do
assert_select 'option', 2
@@ -1935,7 +2382,9 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_new_should_default_to_first_tracker
@request.session[:user_id] = 2
- get :new, :project_id => 1
+ get :new, :params => {
+ :project_id => 1
+ }
assert_response :success
assert_select 'select[name=?]', 'issue[tracker_id]' do
assert_select 'option', 3
@@ -1949,7 +2398,12 @@ class IssuesControllerTest < Redmine::ControllerTest
tracker.save!
@request.session[:user_id] = 2
- get :new, :project_id => 1, :issue => {:parent_issue_id => 1}
+ get :new, :params => {
+ :project_id => 1,
+ :issue => {
+ :parent_issue_id => 1
+ }
+ }
assert_response :success
assert_select 'select[name=?]', 'issue[tracker_id]' do
assert_select 'option', 2
@@ -1964,7 +2418,9 @@ class IssuesControllerTest < Redmine::ControllerTest
role.save!
@request.session[:user_id] = 2
- get :new, :project_id => 1
+ get :new, :params => {
+ :project_id => 1
+ }
assert_response 403
end
@@ -1991,7 +2447,9 @@ class IssuesControllerTest < Redmine::ControllerTest
Project.find(1).update_attribute :default_version_id, version.id
@request.session[:user_id] = 2
- get :new, :project_id => 1
+ get :new, :params => {
+ :project_id => 1
+ }
assert_response :success
assert_select 'select[name=?]', 'issue[fixed_version_id]' do
assert_select 'option[value=?][selected=selected]', version.id.to_s
@@ -2000,7 +2458,10 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_get_new_with_list_custom_field
@request.session[:user_id] = 2
- get :new, :project_id => 1, :tracker_id => 1
+ get :new, :params => {
+ :project_id => 1,
+ :tracker_id => 1
+ }
assert_response :success
assert_select 'select.list_cf[name=?]', 'issue[custom_field_values][1]' do
@@ -2014,7 +2475,10 @@ class IssuesControllerTest < Redmine::ControllerTest
field.update_attribute :multiple, true
@request.session[:user_id] = 2
- get :new, :project_id => 1, :tracker_id => 1
+ get :new, :params => {
+ :project_id => 1,
+ :tracker_id => 1
+ }
assert_response :success
assert_select 'select[name=?][multiple=multiple]', 'issue[custom_field_values][1][]' do
@@ -2029,7 +2493,10 @@ class IssuesControllerTest < Redmine::ControllerTest
:tracker_ids => [1], :is_for_all => true)
@request.session[:user_id] = 2
- get :new, :project_id => 1, :tracker_id => 1
+ get :new, :params => {
+ :project_id => 1,
+ :tracker_id => 1
+ }
assert_response :success
assert_select 'select[name=?][multiple=multiple]', "issue[custom_field_values][#{field.id}][]" do
@@ -2043,7 +2510,10 @@ class IssuesControllerTest < Redmine::ControllerTest
field = IssueCustomField.create!(:name => 'Date', :field_format => 'date', :tracker_ids => [1], :is_for_all => true)
@request.session[:user_id] = 2
- get :new, :project_id => 1, :tracker_id => 1
+ get :new, :params => {
+ :project_id => 1,
+ :tracker_id => 1
+ }
assert_response :success
assert_select 'input[name=?]', "issue[custom_field_values][#{field.id}]"
@@ -2053,7 +2523,10 @@ class IssuesControllerTest < Redmine::ControllerTest
field = IssueCustomField.create!(:name => 'Text', :field_format => 'text', :tracker_ids => [1], :is_for_all => true)
@request.session[:user_id] = 2
- get :new, :project_id => 1, :tracker_id => 1
+ get :new, :params => {
+ :project_id => 1,
+ :tracker_id => 1
+ }
assert_response :success
assert_select 'textarea[name=?]', "issue[custom_field_values][#{field.id}]"
@@ -2062,7 +2535,10 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_get_new_without_default_start_date_is_creation_date
with_settings :default_issue_start_date_to_creation_date => 0 do
@request.session[:user_id] = 2
- get :new, :project_id => 1, :tracker_id => 1
+ get :new, :params => {
+ :project_id => 1,
+ :tracker_id => 1
+ }
assert_response :success
assert_select 'input[name=?]', 'issue[start_date]'
assert_select 'input[name=?][value]', 'issue[start_date]', 0
@@ -2072,7 +2548,10 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_get_new_with_default_start_date_is_creation_date
with_settings :default_issue_start_date_to_creation_date => 1 do
@request.session[:user_id] = 2
- get :new, :project_id => 1, :tracker_id => 1
+ get :new, :params => {
+ :project_id => 1,
+ :tracker_id => 1
+ }
assert_response :success
assert_select 'input[name=?][value=?]', 'issue[start_date]',
Date.today.to_s
@@ -2081,7 +2560,10 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_get_new_form_should_allow_attachment_upload
@request.session[:user_id] = 2
- get :new, :project_id => 1, :tracker_id => 1
+ get :new, :params => {
+ :project_id => 1,
+ :tracker_id => 1
+ }
assert_response :success
assert_select 'form[id=issue-form][method=post][enctype="multipart/form-data"]' do
@@ -2091,8 +2573,15 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_get_new_should_prefill_the_form_from_params
@request.session[:user_id] = 2
- get :new, :project_id => 1,
- :issue => {:tracker_id => 3, :description => 'Prefilled', :custom_field_values => {'2' => 'Custom field value'}}
+ get :new, :params => {
+ :project_id => 1,
+ :issue => {
+ :tracker_id => 3,
+ :description => 'Prefilled',
+ :custom_field_values => {
+ '2' => 'Custom field value'}
+ }
+ }
assert_select 'select[name=?]', 'issue[tracker_id]' do
assert_select 'option[value="3"][selected=selected]'
@@ -2109,7 +2598,9 @@ class IssuesControllerTest < Redmine::ControllerTest
WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1, :role_id => 1, :field_name => cf2.id.to_s, :rule => 'required')
@request.session[:user_id] = 2
- get :new, :project_id => 1
+ get :new, :params => {
+ :project_id => 1
+ }
assert_response :success
assert_select 'label[for=issue_start_date]' do
@@ -2134,7 +2625,9 @@ class IssuesControllerTest < Redmine::ControllerTest
WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1, :role_id => 1, :field_name => cf2.id.to_s, :rule => 'readonly')
@request.session[:user_id] = 2
- get :new, :project_id => 1
+ get :new, :params => {
+ :project_id => 1
+ }
assert_response :success
assert_select 'input[name=?]', 'issue[start_date]'
@@ -2150,7 +2643,12 @@ class IssuesControllerTest < Redmine::ControllerTest
end
@request.session[:user_id] = 2
- get :new, :project_id => 1, :issue => {:status_id => 2}
+ get :new, :params => {
+ :project_id => 1,
+ :issue => {
+ :status_id => 2
+ }
+ }
assert_select 'select[name=?]', 'issue[tracker_id]', 0
assert_select 'select[name=?]', 'issue[status_id]' do
assert_select 'option[value=?][selected=selected]', '2'
@@ -2159,7 +2657,9 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_get_new_without_tracker_id
@request.session[:user_id] = 2
- get :new, :project_id => 1
+ get :new, :params => {
+ :project_id => 1
+ }
assert_response :success
assert_select 'select[name=?]', 'issue[tracker_id]' do
@@ -2171,7 +2671,9 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
IssueStatus.delete_all
- get :new, :project_id => 1
+ get :new, :params => {
+ :project_id => 1
+ }
assert_response 500
assert_select_error /No default issue/
end
@@ -2180,14 +2682,18 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
Tracker.delete_all
- get :new, :project_id => 1
+ get :new, :params => {
+ :project_id => 1
+ }
assert_response 500
assert_select_error /No tracker/
end
def test_new_with_invalid_project_id
@request.session[:user_id] = 1
- get :new, :project_id => 'invalid'
+ get :new, :params => {
+ :project_id => 'invalid'
+ }
assert_response 404
end
@@ -2196,25 +2702,36 @@ class IssuesControllerTest < Redmine::ControllerTest
t = Tracker.find(3)
assert !t.disabled_core_fields.include?('parent_issue_id')
- get :new, :project_id => 1, issue: { parent_issue_id: 1 }
+ get :new, :params => {
+ :project_id => 1, issue: { parent_issue_id: 1
+ }
+ }
assert_response :success
assert_select 'option', text: /#{t.name}/, count: 1
t.core_fields = Tracker::CORE_FIELDS - ['parent_issue_id']
t.save!
assert t.disabled_core_fields.include?('parent_issue_id')
- get :new, :project_id => 1, issue: { parent_issue_id: 1 }
+ get :new, :params => {
+ :project_id => 1, issue: { parent_issue_id: 1
+ }
+ }
assert_response :success
assert_select 'option', text: /#{t.name}/, count: 0
end
def test_update_form_for_new_issue
@request.session[:user_id] = 2
- xhr :post, :new, :project_id => 1,
- :issue => {:tracker_id => 2,
- :subject => 'This is the test_new issue',
- :description => 'This is the description',
- :priority_id => 5}
+ post :new, :params => {
+ :project_id => 1,
+ :issue => {
+ :tracker_id => 2,
+ :subject => 'This is the test_new issue',
+ :description => 'This is the description',
+ :priority_id => 5
+ }
+ },
+ :xhr => true
assert_response :success
assert_equal 'text/javascript', response.content_type
assert_include 'This is the test_new issue', response.body
@@ -2227,10 +2744,14 @@ class IssuesControllerTest < Redmine::ControllerTest
WorkflowTransition.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 0, :new_status_id => 5)
WorkflowTransition.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 5, :new_status_id => 4)
- post :new, :project_id => 1,
- :issue => {:tracker_id => 1,
- :status_id => 5,
- :subject => 'This is an issue'}
+ post :new, :params => {
+ :project_id => 1,
+ :issue => {
+ :tracker_id => 1,
+ :status_id => 5,
+ :subject => 'This is an issue'
+ }
+ }
assert_select 'select[name=?]', 'issue[status_id]' do
assert_select 'option[value=?][selected=selected]', '5'
@@ -2245,10 +2766,14 @@ class IssuesControllerTest < Redmine::ControllerTest
tracker.update! :default_status_id => 2
tracker.generate_transitions! 2 => 1, :clear => true
- post :new, :project_id => 1,
- :issue => {:tracker_id => 2,
- :status_id => 1},
- :was_default_status => 1
+ post :new, :params => {
+ :project_id => 1,
+ :issue => {
+ :tracker_id => 2,
+ :status_id => 1
+ },
+ :was_default_status => 1
+ }
assert_response :success
assert_select 'select[name=?]', 'issue[status_id]' do
@@ -2261,9 +2786,13 @@ class IssuesControllerTest < Redmine::ControllerTest
Project.find(1).update_attribute :default_version_id, version.id
@request.session[:user_id] = 2
- post :new, :issue => {:project_id => 1,
- :fixed_version_id => ''},
- :form_update_triggered_by => 'issue_project_id'
+ post :new, :params => {
+ :issue => {
+ :project_id => 1,
+ :fixed_version_id => ''
+ },
+ :form_update_triggered_by => 'issue_project_id'
+ }
assert_response :success
assert_select 'select[name=?]', 'issue[project_id]' do
@@ -2278,15 +2807,20 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_difference 'Issue.count' do
assert_no_difference 'Journal.count' do
- post :create, :project_id => 1,
- :issue => {:tracker_id => 3,
- :status_id => 2,
- :subject => 'This is the test_new issue',
- :description => 'This is the description',
- :priority_id => 5,
- :start_date => '2010-11-07',
- :estimated_hours => '',
- :custom_field_values => {'2' => 'Value for field 2'}}
+ post :create, :params => {
+ :project_id => 1,
+ :issue => {
+ :tracker_id => 3,
+ :status_id => 2,
+ :subject => 'This is the test_new issue',
+ :description => 'This is the description',
+ :priority_id => 5,
+ :start_date => '2010-11-07',
+ :estimated_hours => '',
+ :custom_field_values => {
+ '2' => 'Value for field 2'}
+ }
+ }
end
end
assert_redirected_to :controller => 'issues', :action => 'show', :id => Issue.last.id
@@ -2311,11 +2845,15 @@ class IssuesControllerTest < Redmine::ControllerTest
with_settings :issue_group_assignment => '1' do
@request.session[:user_id] = 2
assert_difference 'Issue.count' do
- post :create, :project_id => project.id,
- :issue => {:tracker_id => 3,
- :status_id => 1,
- :subject => 'This is the test_new_with_group_assignment issue',
- :assigned_to_id => group.id}
+ post :create, :params => {
+ :project_id => project.id,
+ :issue => {
+ :tracker_id => 3,
+ :status_id => 1,
+ :subject => 'This is the test_new_with_group_assignment issue',
+ :assigned_to_id => group.id
+ }
+ }
end
end
assert_redirected_to :controller => 'issues', :action => 'show', :id => Issue.last.id
@@ -2329,14 +2867,19 @@ class IssuesControllerTest < Redmine::ControllerTest
with_settings :default_issue_start_date_to_creation_date => 0 do
@request.session[:user_id] = 2
assert_difference 'Issue.count' do
- post :create, :project_id => 1,
- :issue => {:tracker_id => 3,
- :status_id => 2,
- :subject => 'This is the test_new issue',
- :description => 'This is the description',
- :priority_id => 5,
- :estimated_hours => '',
- :custom_field_values => {'2' => 'Value for field 2'}}
+ post :create, :params => {
+ :project_id => 1,
+ :issue => {
+ :tracker_id => 3,
+ :status_id => 2,
+ :subject => 'This is the test_new issue',
+ :description => 'This is the description',
+ :priority_id => 5,
+ :estimated_hours => '',
+ :custom_field_values => {
+ '2' => 'Value for field 2'}
+ }
+ }
end
assert_redirected_to :controller => 'issues', :action => 'show',
:id => Issue.last.id
@@ -2350,14 +2893,19 @@ class IssuesControllerTest < Redmine::ControllerTest
with_settings :default_issue_start_date_to_creation_date => 1 do
@request.session[:user_id] = 2
assert_difference 'Issue.count' do
- post :create, :project_id => 1,
- :issue => {:tracker_id => 3,
- :status_id => 2,
- :subject => 'This is the test_new issue',
- :description => 'This is the description',
- :priority_id => 5,
- :estimated_hours => '',
- :custom_field_values => {'2' => 'Value for field 2'}}
+ post :create, :params => {
+ :project_id => 1,
+ :issue => {
+ :tracker_id => 3,
+ :status_id => 2,
+ :subject => 'This is the test_new issue',
+ :description => 'This is the description',
+ :priority_id => 5,
+ :estimated_hours => '',
+ :custom_field_values => {
+ '2' => 'Value for field 2'}
+ }
+ }
end
assert_redirected_to :controller => 'issues', :action => 'show',
:id => Issue.last.id
@@ -2370,9 +2918,15 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_post_create_and_continue
@request.session[:user_id] = 2
assert_difference 'Issue.count' do
- post :create, :project_id => 1,
- :issue => {:tracker_id => 3, :subject => 'This is first issue', :priority_id => 5},
- :continue => ''
+ post :create, :params => {
+ :project_id => 1,
+ :issue => {
+ :tracker_id => 3,
+ :subject => 'This is first issue',
+ :priority_id => 5
+ },
+ :continue => ''
+ }
end
issue = Issue.order('id DESC').first
@@ -2385,11 +2939,15 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_post_create_without_custom_fields_param
@request.session[:user_id] = 2
assert_difference 'Issue.count' do
- post :create, :project_id => 1,
- :issue => {:tracker_id => 1,
- :subject => 'This is the test_new issue',
- :description => 'This is the description',
- :priority_id => 5}
+ post :create, :params => {
+ :project_id => 1,
+ :issue => {
+ :tracker_id => 1,
+ :subject => 'This is the test_new issue',
+ :description => 'This is the description',
+ :priority_id => 5
+ }
+ }
end
assert_redirected_to :controller => 'issues', :action => 'show', :id => Issue.last.id
end
@@ -2400,12 +2958,17 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_difference 'Issue.count' do
- post :create, :project_id => 1,
- :issue => {:tracker_id => 1,
- :subject => 'This is the test_new issue',
- :description => 'This is the description',
- :priority_id => 5,
- :custom_field_values => {'1' => ['', 'MySQL', 'Oracle']}}
+ post :create, :params => {
+ :project_id => 1,
+ :issue => {
+ :tracker_id => 1,
+ :subject => 'This is the test_new issue',
+ :description => 'This is the description',
+ :priority_id => 5,
+ :custom_field_values => {
+ '1' => ['', 'MySQL', 'Oracle']}
+ }
+ }
end
assert_response 302
issue = Issue.order('id DESC').first
@@ -2418,12 +2981,17 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_difference 'Issue.count' do
- post :create, :project_id => 1,
- :issue => {:tracker_id => 1,
- :subject => 'This is the test_new issue',
- :description => 'This is the description',
- :priority_id => 5,
- :custom_field_values => {'1' => ['']}}
+ post :create, :params => {
+ :project_id => 1,
+ :issue => {
+ :tracker_id => 1,
+ :subject => 'This is the test_new issue',
+ :description => 'This is the description',
+ :priority_id => 5,
+ :custom_field_values => {
+ '1' => ['']}
+ }
+ }
end
assert_response 302
issue = Issue.order('id DESC').first
@@ -2436,12 +3004,17 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_difference 'Issue.count' do
- post :create, :project_id => 1,
- :issue => {:tracker_id => 1,
- :subject => 'This is the test_new issue',
- :description => 'This is the description',
- :priority_id => 5,
- :custom_field_values => {field.id.to_s => ['', '2', '3']}}
+ post :create, :params => {
+ :project_id => 1,
+ :issue => {
+ :tracker_id => 1,
+ :subject => 'This is the test_new issue',
+ :description => 'This is the description',
+ :priority_id => 5,
+ :custom_field_values => {
+ field.id.to_s => ['', '2', '3']}
+ }
+ }
end
assert_response 302
issue = Issue.order('id DESC').first
@@ -2454,11 +3027,15 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_no_difference 'Issue.count' do
- post :create, :project_id => 1,
- :issue => {:tracker_id => 1,
- :subject => 'This is the test_new issue',
- :description => 'This is the description',
- :priority_id => 5}
+ post :create, :params => {
+ :project_id => 1,
+ :issue => {
+ :tracker_id => 1,
+ :subject => 'This is the test_new issue',
+ :description => 'This is the description',
+ :priority_id => 5
+ }
+ }
end
assert_response :success
assert_select_error /Database cannot be blank/
@@ -2473,14 +3050,20 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_no_difference 'Issue.count' do
- post :create, :project_id => 1, :issue => {
- :tracker_id => 2,
- :status_id => 1,
- :subject => 'Test',
- :start_date => '',
- :due_date => '',
- :custom_field_values => {cf1.id.to_s => '', cf2.id.to_s => ''}
- }
+ post :create, :params => {
+ :project_id => 1,
+ :issue => {
+ :tracker_id => 2,
+ :status_id => 1,
+ :subject => 'Test',
+ :start_date => '',
+ :due_date => '',
+ :custom_field_values => {
+ cf1.id.to_s => '', cf2.id.to_s => ''
+ }
+
+ }
+ }
assert_response :success
end
@@ -2497,14 +3080,20 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_no_difference 'Issue.count' do
- post :create, :project_id => 1, :issue => {
- :tracker_id => 2,
- :status_id => 1,
- :subject => 'Test',
- :start_date => '',
- :due_date => '',
- :custom_field_values => {cf1.id.to_s => '', cf2.id.to_s => ['']}
- }
+ post :create, :params => {
+ :project_id => 1,
+ :issue => {
+ :tracker_id => 2,
+ :status_id => 1,
+ :subject => 'Test',
+ :start_date => '',
+ :due_date => '',
+ :custom_field_values => {
+ cf1.id.to_s => '', cf2.id.to_s => ['']
+ }
+
+ }
+ }
assert_response :success
end
@@ -2521,14 +3110,20 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_difference 'Issue.count' do
- post :create, :project_id => 1, :issue => {
- :tracker_id => 2,
- :status_id => 1,
- :subject => 'Test',
- :start_date => '2012-07-14',
- :due_date => '2012-07-16',
- :custom_field_values => {cf1.id.to_s => 'value1', cf2.id.to_s => 'value2'}
- }
+ post :create, :params => {
+ :project_id => 1,
+ :issue => {
+ :tracker_id => 2,
+ :status_id => 1,
+ :subject => 'Test',
+ :start_date => '2012-07-14',
+ :due_date => '2012-07-16',
+ :custom_field_values => {
+ cf1.id.to_s => 'value1', cf2.id.to_s => 'value2'
+ }
+
+ }
+ }
assert_response 302
end
@@ -2546,11 +3141,15 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
issue = new_record(Issue) do
- post :create, :project_id => 1, :issue => {
- :tracker_id => 1,
- :status_id => 1,
- :subject => 'Test'
- }
+ post :create, :params => {
+ :project_id => 1,
+ :issue => {
+ :tracker_id => 1,
+ :status_id => 1,
+ :subject => 'Test'
+
+ }
+ }
assert_response 302
end
assert_equal 3, issue.tracker_id
@@ -2562,12 +3161,16 @@ class IssuesControllerTest < Redmine::ControllerTest
with_settings :notified_events => %w(issue_added) do
assert_difference 'Watcher.count', 2 do
- post :create, :project_id => 1,
- :issue => {:tracker_id => 1,
- :subject => 'This is a new issue with watchers',
- :description => 'This is the description',
- :priority_id => 5,
- :watcher_user_ids => ['2', '3']}
+ post :create, :params => {
+ :project_id => 1,
+ :issue => {
+ :tracker_id => 1,
+ :subject => 'This is a new issue with watchers',
+ :description => 'This is the description',
+ :priority_id => 5,
+ :watcher_user_ids => ['2', '3']
+ }
+ }
end
end
issue = Issue.find_by_subject('This is a new issue with watchers')
@@ -2587,10 +3190,14 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_difference 'Issue.count' do
- post :create, :project_id => 1,
- :issue => {:tracker_id => 1,
- :subject => 'This is a child issue',
- :parent_issue_id => '2'}
+ post :create, :params => {
+ :project_id => 1,
+ :issue => {
+ :tracker_id => 1,
+ :subject => 'This is a child issue',
+ :parent_issue_id => '2'
+ }
+ }
assert_response 302
end
issue = Issue.order('id DESC').first
@@ -2601,10 +3208,14 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_difference 'Issue.count' do
- post :create, :project_id => 1,
- :issue => {:tracker_id => 1,
- :subject => 'This is a child issue',
- :parent_issue_id => '#2'}
+ post :create, :params => {
+ :project_id => 1,
+ :issue => {
+ :tracker_id => 1,
+ :subject => 'This is a child issue',
+ :parent_issue_id => '#2'
+ }
+ }
assert_response 302
end
issue = Issue.order('id DESC').first
@@ -2615,10 +3226,14 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_no_difference 'Issue.count' do
- post :create, :project_id => 1,
- :issue => {:tracker_id => 1,
- :subject => 'This is a child issue',
- :parent_issue_id => '4'}
+ post :create, :params => {
+ :project_id => 1,
+ :issue => {
+ :tracker_id => 1,
+ :subject => 'This is a child issue',
+ :parent_issue_id => '4'
+ }
+ }
assert_response :success
assert_select 'input[name=?][value=?]', 'issue[parent_issue_id]', '4'
@@ -2630,10 +3245,14 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_no_difference 'Issue.count' do
- post :create, :project_id => 1,
- :issue => {:tracker_id => 1,
- :subject => 'This is a child issue',
- :parent_issue_id => '01ABC'}
+ post :create, :params => {
+ :project_id => 1,
+ :issue => {
+ :tracker_id => 1,
+ :subject => 'This is a child issue',
+ :parent_issue_id => '01ABC'
+ }
+ }
assert_response :success
assert_select 'input[name=?][value=?]', 'issue[parent_issue_id]', '01ABC'
@@ -2645,10 +3264,14 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_difference 'Issue.count' do
- post :create, :project_id => 1,
- :issue => {:tracker_id => 1,
- :subject => 'This is a private issue',
- :is_private => '1'}
+ post :create, :params => {
+ :project_id => 1,
+ :issue => {
+ :tracker_id => 1,
+ :subject => 'This is a private issue',
+ :is_private => '1'
+ }
+ }
end
issue = Issue.order('id DESC').first
assert issue.is_private?
@@ -2662,10 +3285,14 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_difference 'Issue.count' do
- post :create, :project_id => 1,
- :issue => {:tracker_id => 1,
- :subject => 'This is a private issue',
- :is_private => '1'}
+ post :create, :params => {
+ :project_id => 1,
+ :issue => {
+ :tracker_id => 1,
+ :subject => 'This is a private issue',
+ :is_private => '1'
+ }
+ }
end
issue = Issue.order('id DESC').first
assert issue.is_private?
@@ -2675,10 +3302,13 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_difference 'Issue.count' do
- post :create,
- :issue => {:project_id => 3,
- :tracker_id => 2,
- :subject => 'Foo'}
+ post :create, :params => {
+ :issue => {
+ :project_id => 3,
+ :tracker_id => 2,
+ :subject => 'Foo'
+ }
+ }
assert_response 302
end
issue = Issue.order('id DESC').first
@@ -2690,11 +3320,14 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_difference 'Issue.count' do
- post :create,
- :issue => {:project_id => 3,
- :tracker_id => 2,
- :subject => 'Foo'},
- :continue => '1'
+ post :create, :params => {
+ :issue => {
+ :project_id => 3,
+ :tracker_id => 2,
+ :subject => 'Foo'
+ },
+ :continue => '1'
+ }
assert_redirected_to '/issues/new?issue%5Bproject_id%5D=3&issue%5Btracker_id%5D=2'
end
end
@@ -2705,10 +3338,13 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_no_difference 'Issue.count' do
- post :create,
- :issue => {:project_id => 3,
- :tracker_id => 2,
- :subject => 'Foo'}
+ post :create, :params => {
+ :issue => {
+ :project_id => 3,
+ :tracker_id => 2,
+ :subject => 'Foo'
+ }
+ }
assert_response 422
end
end
@@ -2716,10 +3352,13 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_create_without_project_id_with_failure_should_not_set_project
@request.session[:user_id] = 2
- post :create,
- :issue => {:project_id => 3,
- :tracker_id => 2,
- :subject => ''}
+ post :create, :params => {
+ :issue => {
+ :project_id => 3,
+ :tracker_id => 2,
+ :subject => ''
+ }
+ }
assert_response :success
# no project menu
assert_select '#main-menu a.overview', 0
@@ -2730,13 +3369,18 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
with_settings :notified_events => %w(issue_added) do
assert_difference 'Issue.count' do
- post :create, :project_id => 1,
- :issue => {:tracker_id => 3,
- :subject => 'This is the test_new issue',
- :description => 'This is the description',
- :priority_id => 5,
- :estimated_hours => '',
- :custom_field_values => {'2' => 'Value for field 2'}}
+ post :create, :params => {
+ :project_id => 1,
+ :issue => {
+ :tracker_id => 3,
+ :subject => 'This is the test_new issue',
+ :description => 'This is the description',
+ :priority_id => 5,
+ :estimated_hours => '',
+ :custom_field_values => {
+ '2' => 'Value for field 2'}
+ }
+ }
end
assert_redirected_to :controller => 'issues', :action => 'show', :id => Issue.last.id
@@ -2746,13 +3390,16 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_post_create_should_preserve_fields_values_on_validation_failure
@request.session[:user_id] = 2
- post :create, :project_id => 1,
- :issue => {:tracker_id => 1,
- # empty subject
- :subject => '',
- :description => 'This is a description',
- :priority_id => 6,
- :custom_field_values => {'1' => 'Oracle', '2' => 'Value for field 2'}}
+ post :create, :params => {
+ :project_id => 1,
+ :issue => {
+ :tracker_id => 1,
+ :subject => '', # empty subject
+ :description => 'This is a description',
+ :priority_id => 6,
+ :custom_field_values => {'1' => 'Oracle', '2' => 'Value for field 2'}
+ }
+ }
assert_response :success
assert_select 'textarea[name=?]', 'issue[description]', :text => 'This is a description'
@@ -2770,9 +3417,13 @@ class IssuesControllerTest < Redmine::ControllerTest
assert !User.find(8).member_of?(Project.find(1))
@request.session[:user_id] = 2
- post :create, :project_id => 1,
- :issue => {:tracker_id => 1,
- :watcher_user_ids => ['3', '8']}
+ post :create, :params => {
+ :project_id => 1,
+ :issue => {
+ :tracker_id => 1,
+ :watcher_user_ids => ['3', '8']
+ }
+ }
assert_response :success
assert_select 'input[name=?][value="2"]:not(checked)', 'issue[watcher_user_ids][]'
@@ -2783,7 +3434,12 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_post_create_should_ignore_non_safe_attributes
@request.session[:user_id] = 2
assert_nothing_raised do
- post :create, :project_id => 1, :issue => { :tracker => "A param can not be a Tracker" }
+ post :create, :params => {
+ :project_id => 1,
+ :issue => {
+ :tracker => "A param can not be a Tracker"
+ }
+ }
end
end
@@ -2794,9 +3450,17 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_difference 'Issue.count' do
assert_difference 'Attachment.count' do
assert_no_difference 'Journal.count' do
- post :create, :project_id => 1,
- :issue => { :tracker_id => '1', :subject => 'With attachment' },
- :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'test file'}}
+ post :create, :params => {
+ :project_id => 1,
+ :issue => {
+ :tracker_id => '1',
+ :subject => 'With attachment'
+ },
+ :attachments => {
+ '1' => {
+ 'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'test file'}
+ }
+ }
end
end
end
@@ -2821,9 +3485,17 @@ class IssuesControllerTest < Redmine::ControllerTest
with_settings :notified_events => %w(issue_added) do
assert_difference 'Issue.count' do
- post :create, :project_id => 1,
- :issue => { :tracker_id => '1', :subject => 'With attachment' },
- :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'test file'}}
+ post :create, :params => {
+ :project_id => 1,
+ :issue => {
+ :tracker_id => '1',
+ :subject => 'With attachment'
+ },
+ :attachments => {
+ '1' => {
+ 'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'test file'}
+ }
+ }
end
end
@@ -2839,9 +3511,17 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_no_difference 'Issue.count' do
assert_difference 'Attachment.count' do
- post :create, :project_id => 1,
- :issue => { :tracker_id => '1', :subject => '' },
- :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'test file'}}
+ post :create, :params => {
+ :project_id => 1,
+ :issue => {
+ :tracker_id => '1',
+ :subject => ''
+ },
+ :attachments => {
+ '1' => {
+ 'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'test file'}
+ }
+ }
assert_response :success
end
end
@@ -2862,9 +3542,17 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_no_difference 'Issue.count' do
assert_no_difference 'Attachment.count' do
- post :create, :project_id => 1,
- :issue => { :tracker_id => '1', :subject => '' },
- :attachments => {'p0' => {'token' => attachment.token}}
+ post :create, :params => {
+ :project_id => 1,
+ :issue => {
+ :tracker_id => '1',
+ :subject => ''
+ },
+ :attachments => {
+ 'p0' => {
+ 'token' => attachment.token}
+ }
+ }
assert_response :success
end
end
@@ -2880,9 +3568,17 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_difference 'Issue.count' do
assert_no_difference 'Attachment.count' do
- post :create, :project_id => 1,
- :issue => { :tracker_id => '1', :subject => 'Saved attachments' },
- :attachments => {'p0' => {'token' => attachment.token}}
+ post :create, :params => {
+ :project_id => 1,
+ :issue => {
+ :tracker_id => '1',
+ :subject => 'Saved attachments'
+ },
+ :attachments => {
+ 'p0' => {
+ 'token' => attachment.token}
+ }
+ }
assert_response 302
end
end
@@ -2902,7 +3598,9 @@ class IssuesControllerTest < Redmine::ControllerTest
test "without workflow privilege #new should propose default status only" do
setup_without_workflow_privilege
- get :new, :project_id => 1
+ get :new, :params => {
+ :project_id => 1
+ }
assert_response :success
assert_select 'select[name=?]', 'issue[status_id]' do
@@ -2914,10 +3612,14 @@ class IssuesControllerTest < Redmine::ControllerTest
test "without workflow privilege #create should accept default status" do
setup_without_workflow_privilege
assert_difference 'Issue.count' do
- post :create, :project_id => 1,
- :issue => {:tracker_id => 1,
- :subject => 'This is an issue',
- :status_id => 1}
+ post :create, :params => {
+ :project_id => 1,
+ :issue => {
+ :tracker_id => 1,
+ :subject => 'This is an issue',
+ :status_id => 1
+ }
+ }
end
issue = Issue.order('id').last
assert_not_nil issue.default_status
@@ -2927,10 +3629,14 @@ class IssuesControllerTest < Redmine::ControllerTest
test "without workflow privilege #create should ignore unauthorized status" do
setup_without_workflow_privilege
assert_difference 'Issue.count' do
- post :create, :project_id => 1,
- :issue => {:tracker_id => 1,
- :subject => 'This is an issue',
- :status_id => 3}
+ post :create, :params => {
+ :project_id => 1,
+ :issue => {
+ :tracker_id => 1,
+ :subject => 'This is an issue',
+ :status_id => 3
+ }
+ }
end
issue = Issue.order('id').last
assert_not_nil issue.default_status
@@ -2940,7 +3646,13 @@ class IssuesControllerTest < Redmine::ControllerTest
test "without workflow privilege #update should ignore status change" do
setup_without_workflow_privilege
assert_difference 'Journal.count' do
- put :update, :id => 1, :issue => {:status_id => 3, :notes => 'just trying'}
+ put :update, :params => {
+ :id => 1,
+ :issue => {
+ :status_id => 3,
+ :notes => 'just trying'
+ }
+ }
end
assert_equal 1, Issue.find(1).status_id
end
@@ -2948,9 +3660,14 @@ class IssuesControllerTest < Redmine::ControllerTest
test "without workflow privilege #update ignore attributes changes" do
setup_without_workflow_privilege
assert_difference 'Journal.count' do
- put :update, :id => 1,
- :issue => {:subject => 'changed', :assigned_to_id => 2,
- :notes => 'just trying'}
+ put :update, :params => {
+ :id => 1,
+ :issue => {
+ :subject => 'changed',
+ :assigned_to_id => 2,
+ :notes => 'just trying'
+ }
+ }
end
issue = Issue.find(1)
assert_equal "Cannot print recipes", issue.subject
@@ -2976,7 +3693,13 @@ class IssuesControllerTest < Redmine::ControllerTest
test "with workflow privilege and :edit_issues permission should accept authorized status" do
setup_with_workflow_privilege_and_edit_issues_permission
assert_difference 'Journal.count' do
- put :update, :id => 1, :issue => {:status_id => 3, :notes => 'just trying'}
+ put :update, :params => {
+ :id => 1,
+ :issue => {
+ :status_id => 3,
+ :notes => 'just trying'
+ }
+ }
end
assert_equal 3, Issue.find(1).status_id
end
@@ -2984,7 +3707,13 @@ class IssuesControllerTest < Redmine::ControllerTest
test "with workflow privilege and :edit_issues permission should ignore unauthorized status" do
setup_with_workflow_privilege_and_edit_issues_permission
assert_difference 'Journal.count' do
- put :update, :id => 1, :issue => {:status_id => 2, :notes => 'just trying'}
+ put :update, :params => {
+ :id => 1,
+ :issue => {
+ :status_id => 2,
+ :notes => 'just trying'
+ }
+ }
end
assert_equal 1, Issue.find(1).status_id
end
@@ -2992,9 +3721,14 @@ class IssuesControllerTest < Redmine::ControllerTest
test "with workflow privilege and :edit_issues permission should accept authorized attributes changes" do
setup_with_workflow_privilege_and_edit_issues_permission
assert_difference 'Journal.count' do
- put :update, :id => 1,
- :issue => {:subject => 'changed', :assigned_to_id => 2,
- :notes => 'just trying'}
+ put :update, :params => {
+ :id => 1,
+ :issue => {
+ :subject => 'changed',
+ :assigned_to_id => 2,
+ :notes => 'just trying'
+ }
+ }
end
issue = Issue.find(1)
assert_equal "changed", issue.subject
@@ -3005,7 +3739,10 @@ class IssuesControllerTest < Redmine::ControllerTest
orig = Issue.find(1)
@request.session[:user_id] = 2
- get :new, :project_id => 1, :copy_from => orig.id
+ get :new, :params => {
+ :project_id => 1,
+ :copy_from => orig.id
+ }
assert_response :success
assert_select 'form[id=issue-form][action="/projects/ecookbook/issues"]' do
@@ -3022,7 +3759,10 @@ class IssuesControllerTest < Redmine::ControllerTest
user = setup_user_with_copy_but_not_add_permission
@request.session[:user_id] = user.id
- get :new, :project_id => 1, :copy_from => 1
+ get :new, :params => {
+ :project_id => 1,
+ :copy_from => 1
+ }
assert_response :success
assert_select 'select[name=?]', 'issue[project_id]' do
@@ -3035,7 +3775,10 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
issue = Issue.find(3)
assert issue.attachments.count > 0
- get :new, :project_id => 1, :copy_from => 3
+ get :new, :params => {
+ :project_id => 1,
+ :copy_from => 3
+ }
assert_select 'input[name=copy_attachments][type=checkbox][checked=checked][value="1"]'
end
@@ -3044,7 +3787,10 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
issue = Issue.find(3)
issue.attachments.delete_all
- get :new, :project_id => 1, :copy_from => 3
+ get :new, :params => {
+ :project_id => 1,
+ :copy_from => 3
+ }
assert_select 'input[name=copy_attachments]', 0
end
@@ -3052,7 +3798,10 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_new_as_copy_should_preserve_parent_id
@request.session[:user_id] = 2
issue = Issue.generate!(:parent_issue_id => 2)
- get :new, :project_id => 1, :copy_from => issue.id
+ get :new, :params => {
+ :project_id => 1,
+ :copy_from => issue.id
+ }
assert_select 'input[name=?][value="2"]', 'issue[parent_issue_id]'
end
@@ -3060,7 +3809,10 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_new_as_copy_with_subtasks_should_show_copy_subtasks_checkbox
@request.session[:user_id] = 2
issue = Issue.generate_with_descendants!
- get :new, :project_id => 1, :copy_from => issue.id
+ get :new, :params => {
+ :project_id => 1,
+ :copy_from => issue.id
+ }
assert_select 'input[type=checkbox][name=copy_subtasks][checked=checked][value="1"]'
end
@@ -3069,7 +3821,10 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
user = User.generate!
Watcher.create!(:watchable => Issue.find(1), :user => user)
- get :new, :project_id => 1, :copy_from => 1
+ get :new, :params => {
+ :project_id => 1,
+ :copy_from => 1
+ }
assert_select 'input[type=checkbox][name=?][checked=checked]', 'issue[watcher_user_ids][]', 1
assert_select 'input[type=checkbox][name=?][checked=checked][value=?]', 'issue[watcher_user_ids][]', user.id.to_s
@@ -3077,15 +3832,26 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_new_as_copy_with_invalid_issue_should_respond_with_404
@request.session[:user_id] = 2
- get :new, :project_id => 1, :copy_from => 99999
+ get :new, :params => {
+ :project_id => 1,
+ :copy_from => 99999
+ }
assert_response 404
end
def test_create_as_copy_on_different_project
@request.session[:user_id] = 2
assert_difference 'Issue.count' do
- post :create, :project_id => 1, :copy_from => 1,
- :issue => {:project_id => '2', :tracker_id => '3', :status_id => '1', :subject => 'Copy'}
+ post :create, :params => {
+ :project_id => 1,
+ :copy_from => 1,
+ :issue => {
+ :project_id => '2',
+ :tracker_id => '3',
+ :status_id => '1',
+ :subject => 'Copy'
+ }
+ }
end
issue = Issue.order('id DESC').first
assert_redirected_to "/issues/#{issue.id}"
@@ -3101,9 +3867,16 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_difference 'Issue.count' do
- post :create, :project_id => 1, :copy_from => copied.id,
- :issue => {:project_id => '1', :tracker_id => '1', :status_id => '1'},
- :was_default_status => '1'
+ post :create, :params => {
+ :project_id => 1,
+ :copy_from => copied.id,
+ :issue => {
+ :project_id => '1',
+ :tracker_id => '1',
+ :status_id => '1'
+ },
+ :was_default_status => '1'
+ }
end
issue = Issue.order('id DESC').first
assert_equal 1, issue.status_id
@@ -3119,8 +3892,13 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 3
assert_no_difference 'Issue.count' do
- post :create, :project_id => 1, :copy_from => issue.id,
- :issue => {:project_id => '1'}
+ post :create, :params => {
+ :project_id => 1,
+ :copy_from => issue.id,
+ :issue => {
+ :project_id => '1'
+ }
+ }
end
assert_select_error 'Tracker is invalid'
end
@@ -3132,10 +3910,17 @@ class IssuesControllerTest < Redmine::ControllerTest
assert count > 0
assert_difference 'Issue.count' do
assert_difference 'Attachment.count', count do
- post :create, :project_id => 1, :copy_from => 3,
- :issue => {:project_id => '1', :tracker_id => '3',
- :status_id => '1', :subject => 'Copy with attachments'},
- :copy_attachments => '1'
+ post :create, :params => {
+ :project_id => 1,
+ :copy_from => 3,
+ :issue => {
+ :project_id => '1',
+ :tracker_id => '3',
+ :status_id => '1',
+ :subject => 'Copy with attachments'
+ },
+ :copy_attachments => '1'
+ }
end
end
copy = Issue.order('id DESC').first
@@ -3150,9 +3935,16 @@ class IssuesControllerTest < Redmine::ControllerTest
assert count > 0
assert_difference 'Issue.count' do
assert_no_difference 'Attachment.count' do
- post :create, :project_id => 1, :copy_from => 3,
- :issue => {:project_id => '1', :tracker_id => '3',
- :status_id => '1', :subject => 'Copy with attachments'}
+ post :create, :params => {
+ :project_id => 1,
+ :copy_from => 3,
+ :issue => {
+ :project_id => '1',
+ :tracker_id => '3',
+ :status_id => '1',
+ :subject => 'Copy with attachments'
+ }
+ }
end
end
copy = Issue.order('id DESC').first
@@ -3166,13 +3958,23 @@ class IssuesControllerTest < Redmine::ControllerTest
assert count > 0
assert_difference 'Issue.count' do
assert_difference 'Attachment.count', count + 1 do
- post :create, :project_id => 1, :copy_from => 3,
- :issue => {:project_id => '1', :tracker_id => '3',
- :status_id => '1', :subject => 'Copy with attachments'},
- :copy_attachments => '1',
- :attachments => {'1' =>
- {'file' => uploaded_test_file('testfile.txt', 'text/plain'),
- 'description' => 'test file'}}
+ post :create, :params => {
+ :project_id => 1,
+ :copy_from => 3,
+ :issue => {
+ :project_id => '1',
+ :tracker_id => '3',
+ :status_id => '1',
+ :subject => 'Copy with attachments'
+ },
+ :copy_attachments => '1',
+ :attachments => {
+ '1' => {
+ 'file' => uploaded_test_file('testfile.txt', 'text/plain'),
+ 'description' => 'test file'
+ }
+ }
+ }
end
end
copy = Issue.order('id DESC').first
@@ -3183,9 +3985,17 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_difference 'Issue.count' do
assert_difference 'IssueRelation.count' do
- post :create, :project_id => 1, :copy_from => 1, :link_copy => '1',
- :issue => {:project_id => '1', :tracker_id => '3',
- :status_id => '1', :subject => 'Copy'}
+ post :create, :params => {
+ :project_id => 1,
+ :copy_from => 1,
+ :link_copy => '1',
+ :issue => {
+ :project_id => '1',
+ :tracker_id => '3',
+ :status_id => '1',
+ :subject => 'Copy'
+ }
+ }
end
end
copy = Issue.order('id DESC').first
@@ -3196,8 +4006,13 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_difference 'Issue.count' do
assert_no_difference 'IssueRelation.count' do
- post :create, :project_id => 1, :copy_from => 1,
- :issue => {:subject => 'Copy'}
+ post :create, :params => {
+ :project_id => 1,
+ :copy_from => 1,
+ :issue => {
+ :subject => 'Copy'
+ }
+ }
end
end
end
@@ -3207,8 +4022,13 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_difference 'Issue.count' do
assert_difference 'IssueRelation.count' do
- post :create, :project_id => 1, :copy_from => 1,
- :issue => {:subject => 'Copy'}
+ post :create, :params => {
+ :project_id => 1,
+ :copy_from => 1,
+ :issue => {
+ :subject => 'Copy'
+ }
+ }
end
end
end
@@ -3219,8 +4039,14 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_difference 'Issue.count' do
assert_no_difference 'IssueRelation.count' do
- post :create, :project_id => 1, :copy_from => 1, :link_copy => '1',
- :issue => {:subject => 'Copy'}
+ post :create, :params => {
+ :project_id => 1,
+ :copy_from => 1,
+ :link_copy => '1',
+ :issue => {
+ :subject => 'Copy'
+ }
+ }
end
end
end
@@ -3231,10 +4057,17 @@ class IssuesControllerTest < Redmine::ControllerTest
issue = Issue.generate_with_descendants!
count = issue.descendants.count
assert_difference 'Issue.count', count + 1 do
- post :create, :project_id => 1, :copy_from => issue.id,
- :issue => {:project_id => '1', :tracker_id => '3',
- :status_id => '1', :subject => 'Copy with subtasks'},
- :copy_subtasks => '1'
+ post :create, :params => {
+ :project_id => 1,
+ :copy_from => issue.id,
+ :issue => {
+ :project_id => '1',
+ :tracker_id => '3',
+ :status_id => '1',
+ :subject => 'Copy with subtasks'
+ },
+ :copy_subtasks => '1'
+ }
end
copy = Issue.where(:parent_id => nil).order('id DESC').first
assert_equal count, copy.descendants.count
@@ -3247,10 +4080,19 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 1
assert_difference 'Issue.count', 2 do
- post :create, :project_id => 'ecookbook', :copy_from => issue.id,
- :issue => {:project_id => '2', :tracker_id => 1, :status_id => '1',
- :subject => 'Copy with subtasks', :custom_field_values => {'2' => 'Foo'}},
- :copy_subtasks => '1'
+ post :create, :params => {
+ :project_id => 'ecookbook',
+ :copy_from => issue.id,
+ :issue => {
+ :project_id => '2',
+ :tracker_id => 1,
+ :status_id => '1',
+ :subject => 'Copy with subtasks',
+ :custom_field_values => {
+ '2' => 'Foo'}
+ },
+ :copy_subtasks => '1'
+ }
end
child_copy, issue_copy = Issue.order(:id => :desc).limit(2).to_a
@@ -3263,9 +4105,16 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
issue = Issue.generate_with_descendants!
assert_difference 'Issue.count', 1 do
- post :create, :project_id => 1, :copy_from => 3,
- :issue => {:project_id => '1', :tracker_id => '3',
- :status_id => '1', :subject => 'Copy with subtasks'}
+ post :create, :params => {
+ :project_id => 1,
+ :copy_from => 3,
+ :issue => {
+ :project_id => '1',
+ :tracker_id => '3',
+ :status_id => '1',
+ :subject => 'Copy with subtasks'
+ }
+ }
end
copy = Issue.where(:parent_id => nil).order('id DESC').first
assert_equal 0, copy.descendants.count
@@ -3273,8 +4122,16 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_create_as_copy_with_failure
@request.session[:user_id] = 2
- post :create, :project_id => 1, :copy_from => 1,
- :issue => {:project_id => '2', :tracker_id => '3', :status_id => '1', :subject => ''}
+ post :create, :params => {
+ :project_id => 1,
+ :copy_from => 1,
+ :issue => {
+ :project_id => '2',
+ :tracker_id => '3',
+ :status_id => '1',
+ :subject => ''
+ }
+ }
assert_response :success
@@ -3292,8 +4149,16 @@ class IssuesControllerTest < Redmine::ControllerTest
assert !User.find(2).member_of?(Project.find(4))
assert_difference 'Issue.count' do
- post :create, :project_id => 1, :copy_from => 1,
- :issue => {:project_id => '4', :tracker_id => '3', :status_id => '1', :subject => 'Copy'}
+ post :create, :params => {
+ :project_id => 1,
+ :copy_from => 1,
+ :issue => {
+ :project_id => '4',
+ :tracker_id => '3',
+ :status_id => '1',
+ :subject => 'Copy'
+ }
+ }
end
issue = Issue.order('id DESC').first
assert_equal 1, issue.project_id
@@ -3301,7 +4166,9 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_get_edit
@request.session[:user_id] = 2
- get :edit, :id => 1
+ get :edit, :params => {
+ :id => 1
+ }
assert_response :success
assert_select 'select[name=?]', 'issue[project_id]'
@@ -3316,7 +4183,9 @@ class IssuesControllerTest < Redmine::ControllerTest
WorkflowPermission.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :field_name => 'project_id', :rule => 'readonly')
@request.session[:user_id] = 2
- get :edit, :id => 1
+ get :edit, :params => {
+ :id => 1
+ }
assert_response :success
assert_select 'select[name=?]', 'issue[project_id]', 0
end
@@ -3326,7 +4195,12 @@ class IssuesControllerTest < Redmine::ControllerTest
issue = Issue.generate!(:project_id => 2)
@request.session[:user_id] = 2
- get :edit, :id => issue.id, :issue => {:project_id => 1}
+ get :edit, :params => {
+ :id => issue.id,
+ :issue => {
+ :project_id => 1
+ }
+ }
assert_response :success
assert_select 'select[name=?]', 'issue[project_id]'
end
@@ -3335,7 +4209,9 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
Role.find_by_name('Manager').update_attribute :permissions, [:view_issues, :edit_issues, :log_time]
- get :edit, :id => 1
+ get :edit, :params => {
+ :id => 1
+ }
assert_select 'input[name=?]', 'time_entry[hours]'
end
@@ -3343,14 +4219,26 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
Role.find_by_name('Manager').remove_permission! :log_time
- get :edit, :id => 1
+ get :edit, :params => {
+ :id => 1
+ }
assert_select 'input[name=?]', 'time_entry[hours]', 0
end
def test_get_edit_with_params
@request.session[:user_id] = 2
- get :edit, :id => 1, :issue => { :status_id => 5, :priority_id => 7 },
- :time_entry => { :hours => '2.5', :comments => 'test_get_edit_with_params', :activity_id => 10 }
+ get :edit, :params => {
+ :id => 1,
+ :issue => {
+ :status_id => 5,
+ :priority_id => 7
+ },
+ :time_entry => {
+ :hours => '2.5',
+ :comments => 'test_get_edit_with_params',
+ :activity_id => 10
+ }
+ }
assert_response :success
assert_select 'select[name=?]', 'issue[status_id]' do
@@ -3376,7 +4264,9 @@ class IssuesControllerTest < Redmine::ControllerTest
issue.save!
@request.session[:user_id] = 2
- get :edit, :id => 1
+ get :edit, :params => {
+ :id => 1
+ }
assert_response :success
assert_select 'select[name=?][multiple=multiple]', 'issue[custom_field_values][1][]' do
@@ -3389,11 +4279,16 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_update_form_for_existing_issue
@request.session[:user_id] = 2
- xhr :patch, :edit, :id => 1,
- :issue => {:tracker_id => 2,
- :subject => 'This is the test_new issue',
- :description => 'This is the description',
- :priority_id => 5}
+ patch :edit, :params => {
+ :id => 1,
+ :issue => {
+ :tracker_id => 2,
+ :subject => 'This is the test_new issue',
+ :description => 'This is the description',
+ :priority_id => 5
+ }
+ },
+ :xhr => true
assert_response :success
assert_equal 'text/javascript', response.content_type
@@ -3402,7 +4297,12 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_update_form_for_existing_issue_should_keep_issue_author
@request.session[:user_id] = 3
- patch :edit, :id => 1, :issue => {:subject => 'Changed'}
+ patch :edit, :params => {
+ :id => 1,
+ :issue => {
+ :subject => 'Changed'
+ }
+ }
assert_response :success
assert_equal User.find(2), Issue.find(1).author
@@ -3415,10 +4315,14 @@ class IssuesControllerTest < Redmine::ControllerTest
WorkflowTransition.create!(:role_id => 1, :tracker_id => 2, :old_status_id => 2, :new_status_id => 5)
WorkflowTransition.create!(:role_id => 1, :tracker_id => 2, :old_status_id => 5, :new_status_id => 4)
- patch :edit, :id => 2,
- :issue => {:tracker_id => 2,
- :status_id => 5,
- :subject => 'This is an issue'}
+ patch :edit, :params => {
+ :id => 2,
+ :issue => {
+ :tracker_id => 2,
+ :status_id => 5,
+ :subject => 'This is an issue'
+ }
+ }
assert_select 'select[name=?]', 'issue[status_id]' do
assert_select 'option[value="1"]'
@@ -3430,12 +4334,16 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_update_form_for_existing_issue_with_project_change
@request.session[:user_id] = 2
- patch :edit, :id => 1,
- :issue => {:project_id => 2,
- :tracker_id => 2,
- :subject => 'This is the test_new issue',
- :description => 'This is the description',
- :priority_id => 5}
+ patch :edit, :params => {
+ :id => 1,
+ :issue => {
+ :project_id => 2,
+ :tracker_id => 2,
+ :subject => 'This is the test_new issue',
+ :description => 'This is the description',
+ :priority_id => 5
+ }
+ }
assert_response :success
assert_select 'select[name=?]', 'issue[project_id]' do
assert_select 'option[value="2"][selected=selected]'
@@ -3454,8 +4362,13 @@ class IssuesControllerTest < Redmine::ControllerTest
issue = Issue.generate!(:project => source, :category => source_category)
@request.session[:user_id] = 1
- patch :edit, :id => issue.id,
- :issue => {:project_id => target.id, :category_id => source_category.id}
+ patch :edit, :params => {
+ :id => issue.id,
+ :issue => {
+ :project_id => target.id,
+ :category_id => source_category.id
+ }
+ }
assert_response :success
assert_select 'select[name=?]', 'issue[category_id]' do
@@ -3468,7 +4381,9 @@ class IssuesControllerTest < Redmine::ControllerTest
WorkflowTransition.delete_all
WorkflowTransition.create!(:role_id => 1, :tracker_id => 2, :old_status_id => 2, :new_status_id => 3)
- patch :edit, :id => 2
+ patch :edit, :params => {
+ :id => 2
+ }
assert_response :success
assert_select 'select[name=?]', 'issue[status_id]' do
assert_select 'option[value="2"]'
@@ -3485,7 +4400,12 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_difference('Journal.count') do
assert_difference('JournalDetail.count') do
- put :update, :id => 1, :issue => {:subject => 'New subject'}
+ put :update, :params => {
+ :id => 1,
+ :issue => {
+ :subject => 'New subject'
+ }
+ }
end
end
assert_redirected_to :action => 'show', :id => '1'
@@ -3502,11 +4422,15 @@ class IssuesControllerTest < Redmine::ControllerTest
with_settings :notified_events => %w(issue_updated) do
assert_difference('Journal.count') do
assert_difference('JournalDetail.count', 3) do
- put :update, :id => 1, :issue => {:project_id => '2',
- :tracker_id => '1', # no change
- :priority_id => '6',
- :category_id => '3'
- }
+ put :update, :params => {
+ :id => 1,
+ :issue => {
+ :project_id => '2',
+ :tracker_id => '1', # no change
+ :priority_id => '6',
+ :category_id => '3'
+ }
+ }
end
end
end
@@ -3529,7 +4453,12 @@ class IssuesControllerTest < Redmine::ControllerTest
issue = Issue.generate!
@request.session[:user_id] = 1
- put :update, :id => issue.id, :issue => {:project_id => target.id}
+ put :update, :params => {
+ :id => issue.id,
+ :issue => {
+ :project_id => target.id
+ }
+ }
assert_response 302
end
@@ -3540,10 +4469,15 @@ class IssuesControllerTest < Redmine::ControllerTest
with_settings :notified_events => %w(issue_updated) do
assert_difference('Journal.count') do
assert_difference('JournalDetail.count', 3) do
- put :update, :id => 1, :issue => {:project_id => '1',
- :tracker_id => '2',
- :priority_id => '6'
- }
+ put :update, :params => {
+ :id => 1,
+ :issue => {
+ :project_id => '1',
+ :tracker_id => '2',
+ :priority_id => '6'
+
+ }
+ }
end
end
end
@@ -3568,11 +4502,15 @@ class IssuesControllerTest < Redmine::ControllerTest
with_settings :notified_events => %w(issue_updated) do
assert_difference('Journal.count') do
assert_difference('JournalDetail.count', 3) do
- put :update, :id => 1, :issue => {:subject => 'Custom field change',
- :priority_id => '6',
- :category_id => '1', # no change
- :custom_field_values => { '2' => 'New custom value' }
- }
+ put :update, :params => {
+ :id => 1,
+ :issue => {
+ :subject => 'Custom field change',
+ :priority_id => '6',
+ :category_id => '1', # no change
+ :custom_field_values => { '2' => 'New custom value' }
+ }
+ }
end
end
end
@@ -3595,10 +4533,15 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_difference('Journal.count') do
assert_difference('JournalDetail.count', 3) do
- put :update, :id => 1,
- :issue => {
- :subject => 'Custom field change',
- :custom_field_values => { '1' => ['', 'Oracle', 'PostgreSQL'] }
+ put :update, :params => {
+ :id => 1,
+ :issue => {
+ :subject => 'Custom field change',
+ :custom_field_values => {
+ '1' => ['', 'Oracle', 'PostgreSQL']
+ }
+
+ }
}
end
end
@@ -3613,10 +4556,19 @@ class IssuesControllerTest < Redmine::ControllerTest
with_settings :notified_events => %w(issue_updated) do
assert_difference('TimeEntry.count', 0) do
- put :update,
- :id => 1,
- :issue => { :status_id => 2, :assigned_to_id => 3, :notes => 'Assigned to dlopper' },
- :time_entry => { :hours => '', :comments => '', :activity_id => TimeEntryActivity.first }
+ put :update, :params => {
+ :id => 1,
+ :issue => {
+ :status_id => 2,
+ :assigned_to_id => 3,
+ :notes => 'Assigned to dlopper'
+ },
+ :time_entry => {
+ :hours => '',
+ :comments => '',
+ :activity_id => TimeEntryActivity.first
+ }
+ }
end
end
assert_redirected_to :action => 'show', :id => '1'
@@ -3637,9 +4589,12 @@ class IssuesControllerTest < Redmine::ControllerTest
with_settings :notified_events => %w(issue_updated) do
# anonymous user
- put :update,
- :id => 1,
- :issue => { :notes => notes }
+ put :update, :params => {
+ :id => 1,
+ :issue => {
+ :notes => notes
+ }
+ }
end
assert_redirected_to :action => 'show', :id => '1'
j = Journal.order('id DESC').first
@@ -3656,7 +4611,13 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_difference 'Journal.count' do
- put :update, :id => 1, :issue => {:notes => notes, :private_notes => '1'}
+ put :update, :params => {
+ :id => 1,
+ :issue => {
+ :notes => notes,
+ :private_notes => '1'
+ }
+ }
assert_redirected_to :action => 'show', :id => '1'
end
@@ -3670,7 +4631,14 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_difference 'Journal.count', 2 do
- put :update, :id => 1, :issue => {:subject => 'New subject', :notes => notes, :private_notes => '1'}
+ put :update, :params => {
+ :id => 1,
+ :issue => {
+ :subject => 'New subject',
+ :notes => notes,
+ :private_notes => '1'
+ }
+ }
assert_redirected_to :action => 'show', :id => '1'
end
@@ -3689,10 +4657,17 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
spent_hours_before = Issue.find(1).spent_hours
assert_difference('TimeEntry.count') do
- put :update,
- :id => 1,
- :issue => { :notes => '2.5 hours added' },
- :time_entry => { :hours => '2.5', :comments => 'test_put_update_with_note_and_spent_time', :activity_id => TimeEntryActivity.first.id }
+ put :update, :params => {
+ :id => 1,
+ :issue => {
+ :notes => '2.5 hours added'
+ },
+ :time_entry => {
+ :hours => '2.5',
+ :comments => 'test_put_update_with_note_and_spent_time',
+ :activity_id => TimeEntryActivity.first.id
+ }
+ }
end
assert_redirected_to :action => 'show', :id => '1'
@@ -3714,10 +4689,18 @@ class IssuesControllerTest < Redmine::ControllerTest
assert !parent.visible?(User.find(3))
@request.session[:user_id] = 3
- get :edit, :id => issue.id
+ get :edit, :params => {
+ :id => issue.id
+ }
assert_select 'input[name=?][value=?]', 'issue[parent_issue_id]', parent.id.to_s
- put :update, :id => issue.id, :issue => {:subject => 'New subject', :parent_issue_id => parent.id.to_s}
+ put :update, :params => {
+ :id => issue.id,
+ :issue => {
+ :subject => 'New subject',
+ :parent_issue_id => parent.id.to_s
+ }
+ }
assert_response 302
assert_equal parent, issue.parent
end
@@ -3732,9 +4715,16 @@ class IssuesControllerTest < Redmine::ControllerTest
with_settings :notified_events => %w(issue_updated) do
# anonymous user
assert_difference 'Attachment.count' do
- put :update, :id => 1,
- :issue => {:notes => ''},
- :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'test file'}}
+ put :update, :params => {
+ :id => 1,
+ :issue => {
+ :notes => ''
+ },
+ :attachments => {
+ '1' => {
+ 'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'test file'}
+ }
+ }
end
end
@@ -3765,9 +4755,16 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_no_difference 'Journal.count' do
assert_difference 'Attachment.count' do
- put :update, :id => 1,
- :issue => { :subject => '' },
- :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'test file'}}
+ put :update, :params => {
+ :id => 1,
+ :issue => {
+ :subject => ''
+ },
+ :attachments => {
+ '1' => {
+ 'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'test file'}
+ }
+ }
assert_response :success
end
end
@@ -3788,9 +4785,16 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_no_difference 'Journal.count' do
assert_no_difference 'Attachment.count' do
- put :update, :id => 1,
- :issue => { :subject => '' },
- :attachments => {'p0' => {'token' => attachment.token}}
+ put :update, :params => {
+ :id => 1,
+ :issue => {
+ :subject => ''
+ },
+ :attachments => {
+ 'p0' => {
+ 'token' => attachment.token}
+ }
+ }
assert_response :success
end
end
@@ -3807,9 +4811,16 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_difference 'Journal.count' do
assert_difference 'JournalDetail.count' do
assert_no_difference 'Attachment.count' do
- put :update, :id => 1,
- :issue => {:notes => 'Attachment added'},
- :attachments => {'p0' => {'token' => attachment.token}}
+ put :update, :params => {
+ :id => 1,
+ :issue => {
+ :notes => 'Attachment added'
+ },
+ :attachments => {
+ 'p0' => {
+ 'token' => attachment.token}
+ }
+ }
assert_redirected_to '/issues/1'
end
end
@@ -3828,10 +4839,16 @@ class IssuesControllerTest < Redmine::ControllerTest
# anonymous user
with_settings :attachment_max_size => 0 do
- put :update,
- :id => 1,
- :issue => {:notes => ''},
- :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}}
+ put :update, :params => {
+ :id => 1,
+ :issue => {
+ :notes => ''
+ },
+ :attachments => {
+ '1' => {
+ 'file' => uploaded_test_file('testfile.txt', 'text/plain')}
+ }
+ }
assert_redirected_to :action => 'show', :id => '1'
assert_equal '1 file(s) could not be saved.', flash[:warning]
end
@@ -3844,12 +4861,14 @@ class IssuesControllerTest < Redmine::ControllerTest
journal = new_record(Journal) do
assert_difference 'Attachment.count', -2 do
- put :update,
+ put :update, :params => {
:id => 3,
:issue => {
:notes => 'Removing attachments',
:deleted_attachment_ids => ['1', '5']
+
}
+ }
end
end
assert_equal 'Removing attachments', journal.notes
@@ -3868,13 +4887,15 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_no_difference 'Journal.count' do
assert_no_difference 'Attachment.count' do
- put :update,
+ put :update, :params => {
:id => 3,
:issue => {
:subject => '',
:notes => 'Removing attachments',
:deleted_attachment_ids => ['1', '5']
+
}
+ }
end
end
assert_select 'input[name=?][value="1"][checked=checked]', 'issue[deleted_attachment_ids][]'
@@ -3887,9 +4908,12 @@ class IssuesControllerTest < Redmine::ControllerTest
issue.journals.clear
ActionMailer::Base.deliveries.clear
- put :update,
- :id => 1,
- :issue => {:notes => ''}
+ put :update, :params => {
+ :id => 1,
+ :issue => {
+ :notes => ''
+ }
+ }
assert_redirected_to :action => 'show', :id => '1'
issue.reload
@@ -3906,10 +4930,15 @@ class IssuesControllerTest < Redmine::ControllerTest
new_subject = 'Subject modified by IssuesControllerTest#test_post_edit'
with_settings :notified_events => %w(issue_updated) do
- put :update, :id => 1, :issue => {:subject => new_subject,
- :priority_id => '6',
- :category_id => '1' # no change
- }
+ put :update, :params => {
+ :id => 1,
+ :issue => {
+ :subject => new_subject,
+ :priority_id => '6',
+ :category_id => '1' # no change
+
+ }
+ }
assert_equal 1, ActionMailer::Base.deliveries.size
end
end
@@ -3919,10 +4948,15 @@ class IssuesControllerTest < Redmine::ControllerTest
notes = 'Note added by IssuesControllerTest#test_post_edit_with_invalid_spent_time'
assert_no_difference('Journal.count') do
- put :update,
- :id => 1,
- :issue => {:notes => notes},
- :time_entry => {"comments"=>"", "activity_id"=>"", "hours"=>"2z"}
+ put :update, :params => {
+ :id => 1,
+ :issue => {
+ :notes => notes
+ },
+ :time_entry => {
+ "comments"=>"", "activity_id"=>"", "hours"=>"2z"
+ }
+ }
end
assert_response :success
@@ -3936,10 +4970,15 @@ class IssuesControllerTest < Redmine::ControllerTest
notes = 'Note added by IssuesControllerTest#test_post_edit_with_invalid_spent_time'
assert_no_difference('Journal.count') do
- put :update,
- :id => 1,
- :issue => {:notes => notes},
- :time_entry => {"comments"=>"this is my comment", "activity_id"=>"", "hours"=>""}
+ put :update, :params => {
+ :id => 1,
+ :issue => {
+ :notes => notes
+ },
+ :time_entry => {
+ "comments"=>"this is my comment", "activity_id"=>"", "hours"=>""
+ }
+ }
end
assert_response :success
@@ -3953,11 +4992,13 @@ class IssuesControllerTest < Redmine::ControllerTest
issue = Issue.find(2)
@request.session[:user_id] = 2
- put :update,
- :id => issue.id,
- :issue => {
- :fixed_version_id => 4
- }
+ put :update, :params => {
+ :id => issue.id,
+ :issue => {
+ :fixed_version_id => 4
+
+ }
+ }
assert_response :redirect
issue.reload
@@ -3969,12 +5010,14 @@ class IssuesControllerTest < Redmine::ControllerTest
issue = Issue.find(2)
@request.session[:user_id] = 2
- put :update,
- :id => issue.id,
- :issue => {
- :fixed_version_id => 4
- },
- :back_url => '/issues'
+ put :update, :params => {
+ :id => issue.id,
+ :issue => {
+ :fixed_version_id => 4
+
+ },
+ :back_url => '/issues'
+ }
assert_response :redirect
assert_redirected_to '/issues'
@@ -3984,12 +5027,14 @@ class IssuesControllerTest < Redmine::ControllerTest
issue = Issue.find(2)
@request.session[:user_id] = 2
- put :update,
- :id => issue.id,
- :issue => {
- :fixed_version_id => 4
- },
- :back_url => 'http://google.com'
+ put :update, :params => {
+ :id => issue.id,
+ :issue => {
+ :fixed_version_id => 4
+
+ },
+ :back_url => 'http://google.com'
+ }
assert_response :redirect
assert_redirected_to :controller => 'issues', :action => 'show', :id => issue.id
@@ -3998,12 +5043,17 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_put_update_should_redirect_with_previous_and_next_issue_ids_params
@request.session[:user_id] = 2
- put :update, :id => 11,
- :issue => {:status_id => 6, :notes => 'Notes'},
- :prev_issue_id => 8,
- :next_issue_id => 12,
- :issue_position => 2,
- :issue_count => 3
+ put :update, :params => {
+ :id => 11,
+ :issue => {
+ :status_id => 6,
+ :notes => 'Notes'
+ },
+ :prev_issue_id => 8,
+ :next_issue_id => 12,
+ :issue_position => 2,
+ :issue_count => 3
+ }
assert_redirected_to '/issues/11?issue_count=3&issue_position=2&next_issue_id=12&prev_issue_id=8'
end
@@ -4015,7 +5065,12 @@ class IssuesControllerTest < Redmine::ControllerTest
issue = Issue.generate!(:project_id => 1, :tracker_id => 1, :subject => 'Original subject')
@request.session[:user_id] = 2
- put :update, :id => issue.id, :issue => {:subject => 'Changed subject'}
+ put :update, :params => {
+ :id => issue.id,
+ :issue => {
+ :subject => 'Changed subject'
+ }
+ }
assert_response 302
assert_equal 'Changed subject', issue.reload.subject
end
@@ -4027,14 +5082,21 @@ class IssuesControllerTest < Redmine::ControllerTest
issue = Issue.generate!(:project_id => 1, :tracker_id => 2, :subject => 'Original subject')
@request.session[:user_id] = 2
- put :update, :id => issue.id, :issue => {:subject => 'Changed subject'}
+ put :update, :params => {
+ :id => issue.id,
+ :issue => {
+ :subject => 'Changed subject'
+ }
+ }
assert_response 302
assert_equal 'Original subject', issue.reload.subject
end
def test_get_bulk_edit
@request.session[:user_id] = 2
- get :bulk_edit, :ids => [1, 3]
+ get :bulk_edit, :params => {
+ :ids => [1, 3]
+ }
assert_response :success
assert_select 'ul#bulk-selection' do
@@ -4069,7 +5131,9 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_get_bulk_edit_on_different_projects
@request.session[:user_id] = 2
- get :bulk_edit, :ids => [1, 2, 6]
+ get :bulk_edit, :params => {
+ :ids => [1, 2, 6]
+ }
assert_response :success
# Can not set issues from different projects as children of an issue
@@ -4086,7 +5150,9 @@ class IssuesControllerTest < Redmine::ControllerTest
field = IssueCustomField.create!(:name => 'Tester', :field_format => 'user', :is_for_all => true, :tracker_ids => [1,2,3])
@request.session[:user_id] = 2
- get :bulk_edit, :ids => [1, 2]
+ get :bulk_edit, :params => {
+ :ids => [1, 2]
+ }
assert_response :success
assert_select 'select.user_cf[name=?]', "issue[custom_field_values][#{field.id}]" do
@@ -4098,7 +5164,9 @@ class IssuesControllerTest < Redmine::ControllerTest
field = IssueCustomField.create!(:name => 'Affected version', :field_format => 'version', :is_for_all => true, :tracker_ids => [1,2,3])
@request.session[:user_id] = 2
- get :bulk_edit, :ids => [1, 2]
+ get :bulk_edit, :params => {
+ :ids => [1, 2]
+ }
assert_response :success
assert_select 'select.version_cf[name=?]', "issue[custom_field_values][#{field.id}]" do
@@ -4111,7 +5179,9 @@ class IssuesControllerTest < Redmine::ControllerTest
field.update_attribute :multiple, true
@request.session[:user_id] = 2
- get :bulk_edit, :ids => [1, 3]
+ get :bulk_edit, :params => {
+ :ids => [1, 3]
+ }
assert_response :success
assert_select 'select[name=?]', 'issue[custom_field_values][1][]' do
@@ -4121,7 +5191,9 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_bulk_edit_should_propose_to_clear_text_custom_fields
@request.session[:user_id] = 2
- get :bulk_edit, :ids => [1, 3]
+ get :bulk_edit, :params => {
+ :ids => [1, 3]
+ }
assert_response :success
assert_select 'input[name=?][value=?]', 'issue[custom_field_values][2]', '__none__'
@@ -4142,7 +5214,9 @@ class IssuesControllerTest < Redmine::ControllerTest
WorkflowTransition.create!(:role_id => 1, :tracker_id => 2,
:old_status_id => 2, :new_status_id => 5)
@request.session[:user_id] = 2
- get :bulk_edit, :ids => [1, 2]
+ get :bulk_edit, :params => {
+ :ids => [1, 2]
+ }
assert_select 'select[name=?]', 'issue[status_id]' do
assert_select 'option[value=""]'
@@ -4154,7 +5228,12 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_bulk_edit_should_propose_target_project_open_shared_versions
@request.session[:user_id] = 2
- post :bulk_edit, :ids => [1, 2, 6], :issue => {:project_id => 1}
+ post :bulk_edit, :params => {
+ :ids => [1, 2, 6],
+ :issue => {
+ :project_id => 1
+ }
+ }
assert_response :success
expected_versions = Project.find(1).shared_versions.open.to_a.sort
@@ -4171,7 +5250,12 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_bulk_edit_should_propose_target_project_categories
@request.session[:user_id] = 2
- post :bulk_edit, :ids => [1, 2, 6], :issue => {:project_id => 1}
+ post :bulk_edit, :params => {
+ :ids => [1, 2, 6],
+ :issue => {
+ :project_id => 1
+ }
+ }
assert_response :success
expected_categories = Project.find(1).issue_categories.sort
@@ -4193,7 +5277,9 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
issue_ids = Issue.where(:project_id => 1, :tracker_id => 1).limit(2).ids
- get :bulk_edit, :ids => issue_ids
+ get :bulk_edit, :params => {
+ :ids => issue_ids
+ }
assert_response :success
assert_select 'input[name=?]', "issue[custom_field_values][#{field1.id}]"
@@ -4207,7 +5293,12 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
issue_ids = Issue.where(:project_id => 1, :tracker_id => 1).limit(2).ids
- get :bulk_edit, :ids => issue_ids, :issue => {:tracker_id => 2}
+ get :bulk_edit, :params => {
+ :ids => issue_ids,
+ :issue => {
+ :tracker_id => 2
+ }
+ }
assert_response :success
assert_select 'input[name=?]', "issue[custom_field_values][#{field1.id}]", 0
@@ -4224,7 +5315,12 @@ class IssuesControllerTest < Redmine::ControllerTest
CustomValue.create!(:customized => Issue.find(2), :custom_field => not_cleared, :value => 'bar')
@request.session[:user_id] = 2
- get :bulk_edit, :ids => [1, 2], :issue => {:tracker_id => 3}
+ get :bulk_edit, :params => {
+ :ids => [1, 2],
+ :issue => {
+ :tracker_id => 3
+ }
+ }
assert_response :success
assert_select '.warning', :text => /automatic deletion of values/
assert_select '.warning span', :text => 'Cleared (1)'
@@ -4234,10 +5330,16 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_bulk_update
@request.session[:user_id] = 2
# update issues priority
- post :bulk_update, :ids => [1, 2], :notes => 'Bulk editing',
- :issue => {:priority_id => 7,
- :assigned_to_id => '',
- :custom_field_values => {'2' => ''}}
+ post :bulk_update, :params => {
+ :ids => [1, 2],
+ :notes => 'Bulk editing',
+ :issue => {
+ :priority_id => 7,
+ :assigned_to_id => '',
+ :custom_field_values => {
+ '2' => ''}
+ }
+ }
assert_response 302
# check that the issues were updated
@@ -4258,10 +5360,16 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
# update issues assignee
with_settings :issue_group_assignment => '1' do
- post :bulk_update, :ids => [1, 2], :notes => 'Bulk editing',
- :issue => {:priority_id => '',
- :assigned_to_id => group.id,
- :custom_field_values => {'2' => ''}}
+ post :bulk_update, :params => {
+ :ids => [1, 2],
+ :notes => 'Bulk editing',
+ :issue => {
+ :priority_id => '',
+ :assigned_to_id => group.id,
+ :custom_field_values => {
+ '2' => ''}
+ }
+ }
assert_response 302
assert_equal [group, group], Issue.where(:id => [1, 2]).collect {|i| i.assigned_to}
@@ -4271,10 +5379,16 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_bulk_update_on_different_projects
@request.session[:user_id] = 2
# update issues priority
- post :bulk_update, :ids => [1, 2, 6], :notes => 'Bulk editing',
- :issue => {:priority_id => 7,
- :assigned_to_id => '',
- :custom_field_values => {'2' => ''}}
+ post :bulk_update, :params => {
+ :ids => [1, 2, 6],
+ :notes => 'Bulk editing',
+ :issue => {
+ :priority_id => 7,
+ :assigned_to_id => '',
+ :custom_field_values => {
+ '2' => ''}
+ }
+ }
assert_response 302
# check that the issues were updated
@@ -4293,10 +5407,16 @@ class IssuesControllerTest < Redmine::ControllerTest
action = { :controller => "issues", :action => "bulk_update" }
assert user.allowed_to?(action, Issue.find(1).project)
assert ! user.allowed_to?(action, Issue.find(6).project)
- post :bulk_update, :ids => [1, 6], :notes => 'Bulk should fail',
- :issue => {:priority_id => 7,
- :assigned_to_id => '',
- :custom_field_values => {'2' => ''}}
+ post :bulk_update, :params => {
+ :ids => [1, 6],
+ :notes => 'Bulk should fail',
+ :issue => {
+ :priority_id => 7,
+ :assigned_to_id => '',
+ :custom_field_values => {
+ '2' => ''}
+ }
+ }
assert_response 403
assert_not_equal "Bulk should fail", Journal.last.notes
end
@@ -4305,16 +5425,15 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
ActionMailer::Base.deliveries.clear
with_settings :notified_events => %w(issue_updated) do
- post(:bulk_update,
- {
- :ids => [1, 2],
- :notes => 'Bulk editing',
- :issue => {
- :priority_id => 7,
- :assigned_to_id => '',
- :custom_field_values => {'2' => ''}
- }
- })
+ post :bulk_update, :params => {
+ :ids => [1, 2],
+ :notes => 'Bulk editing',
+ :issue => {
+ :priority_id => 7,
+ :assigned_to_id => '',
+ :custom_field_values => {'2' => ''}
+ }
+ }
assert_response 302
assert_equal 2, ActionMailer::Base.deliveries.size
end
@@ -4322,7 +5441,12 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_bulk_update_project
@request.session[:user_id] = 2
- post :bulk_update, :ids => [1, 2], :issue => {:project_id => '2'}
+ post :bulk_update, :params => {
+ :ids => [1, 2],
+ :issue => {
+ :project_id => '2'
+ }
+ }
assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook'
# Issues moved to project 2
assert_equal 2, Issue.find(1).project_id
@@ -4334,19 +5458,36 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_bulk_update_project_on_single_issue_should_follow_when_needed
@request.session[:user_id] = 2
- post :bulk_update, :id => 1, :issue => {:project_id => '2'}, :follow => '1'
+ post :bulk_update, :params => {
+ :id => 1,
+ :issue => {
+ :project_id => '2'
+ },
+ :follow => '1'
+ }
assert_redirected_to '/issues/1'
end
def test_bulk_update_project_on_multiple_issues_should_follow_when_needed
@request.session[:user_id] = 2
- post :bulk_update, :id => [1, 2], :issue => {:project_id => '2'}, :follow => '1'
+ post :bulk_update, :params => {
+ :id => [1, 2],
+ :issue => {
+ :project_id => '2'
+ },
+ :follow => '1'
+ }
assert_redirected_to '/projects/onlinestore/issues'
end
def test_bulk_update_tracker
@request.session[:user_id] = 2
- post :bulk_update, :ids => [1, 2], :issue => {:tracker_id => '2'}
+ post :bulk_update, :params => {
+ :ids => [1, 2],
+ :issue => {
+ :tracker_id => '2'
+ }
+ }
assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook'
assert_equal 2, Issue.find(1).tracker_id
assert_equal 2, Issue.find(2).tracker_id
@@ -4355,10 +5496,15 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_bulk_update_status
@request.session[:user_id] = 2
# update issues priority
- post :bulk_update, :ids => [1, 2], :notes => 'Bulk editing status',
- :issue => {:priority_id => '',
- :assigned_to_id => '',
- :status_id => '5'}
+ post :bulk_update, :params => {
+ :ids => [1, 2],
+ :notes => 'Bulk editing status',
+ :issue => {
+ :priority_id => '',
+ :assigned_to_id => '',
+ :status_id => '5'
+ }
+ }
assert_response 302
issue = Issue.find(1)
@@ -4367,7 +5513,12 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_bulk_update_priority
@request.session[:user_id] = 2
- post :bulk_update, :ids => [1, 2], :issue => {:priority_id => 6}
+ post :bulk_update, :params => {
+ :ids => [1, 2],
+ :issue => {
+ :priority_id => 6
+ }
+ }
assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook'
assert_equal 6, Issue.find(1).priority_id
@@ -4376,7 +5527,10 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_bulk_update_with_notes
@request.session[:user_id] = 2
- post :bulk_update, :ids => [1, 2], :notes => 'Moving two issues'
+ post :bulk_update, :params => {
+ :ids => [1, 2],
+ :notes => 'Moving two issues'
+ }
assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook'
assert_equal 'Moving two issues', Issue.find(1).journals.sort_by(&:id).last.notes
@@ -4386,10 +5540,16 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_bulk_update_parent_id
IssueRelation.delete_all
@request.session[:user_id] = 2
- post :bulk_update, :ids => [1, 3],
- :notes => 'Bulk editing parent',
- :issue => {:priority_id => '', :assigned_to_id => '',
- :status_id => '', :parent_issue_id => '2'}
+ post :bulk_update, :params => {
+ :ids => [1, 3],
+ :notes => 'Bulk editing parent',
+ :issue => {
+ :priority_id => '',
+ :assigned_to_id => '',
+ :status_id => '',
+ :parent_issue_id => '2'
+ }
+ }
assert_response 302
parent = Issue.find(2)
assert_equal parent.id, Issue.find(1).parent_id
@@ -4399,7 +5559,12 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_bulk_update_estimated_hours
@request.session[:user_id] = 2
- post :bulk_update, :ids => [1, 2], :issue => {:estimated_hours => 4.25}
+ post :bulk_update, :params => {
+ :ids => [1, 2],
+ :issue => {
+ :estimated_hours => 4.25
+ }
+ }
assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook'
assert_equal 4.25, Issue.find(1).estimated_hours
@@ -4409,10 +5574,16 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_bulk_update_custom_field
@request.session[:user_id] = 2
# update issues priority
- post :bulk_update, :ids => [1, 2], :notes => 'Bulk editing custom field',
- :issue => {:priority_id => '',
- :assigned_to_id => '',
- :custom_field_values => {'2' => '777'}}
+ post :bulk_update, :params => {
+ :ids => [1, 2],
+ :notes => 'Bulk editing custom field',
+ :issue => {
+ :priority_id => '',
+ :assigned_to_id => '',
+ :custom_field_values => {
+ '2' => '777'}
+ }
+ }
assert_response 302
@@ -4426,10 +5597,16 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_bulk_update_custom_field_to_blank
@request.session[:user_id] = 2
- post :bulk_update, :ids => [1, 3], :notes => 'Bulk editing custom field',
- :issue => {:priority_id => '',
- :assigned_to_id => '',
- :custom_field_values => {'1' => '__none__'}}
+ post :bulk_update, :params => {
+ :ids => [1, 3],
+ :notes => 'Bulk editing custom field',
+ :issue => {
+ :priority_id => '',
+ :assigned_to_id => '',
+ :custom_field_values => {
+ '1' => '__none__'}
+ }
+ }
assert_response 302
assert_equal '', Issue.find(1).custom_field_value(1)
assert_equal '', Issue.find(3).custom_field_value(1)
@@ -4440,10 +5617,16 @@ class IssuesControllerTest < Redmine::ControllerTest
field.update_attribute :multiple, true
@request.session[:user_id] = 2
- post :bulk_update, :ids => [1, 2, 3], :notes => 'Bulk editing multi custom field',
- :issue => {:priority_id => '',
- :assigned_to_id => '',
- :custom_field_values => {'1' => ['MySQL', 'Oracle']}}
+ post :bulk_update, :params => {
+ :ids => [1, 2, 3],
+ :notes => 'Bulk editing multi custom field',
+ :issue => {
+ :priority_id => '',
+ :assigned_to_id => '',
+ :custom_field_values => {
+ '1' => ['MySQL', 'Oracle']}
+ }
+ }
assert_response 302
@@ -4458,10 +5641,16 @@ class IssuesControllerTest < Redmine::ControllerTest
field.update_attribute :multiple, true
@request.session[:user_id] = 2
- post :bulk_update, :ids => [1, 3], :notes => 'Bulk editing multi custom field',
- :issue => {:priority_id => '',
- :assigned_to_id => '',
- :custom_field_values => {'1' => ['__none__']}}
+ post :bulk_update, :params => {
+ :ids => [1, 3],
+ :notes => 'Bulk editing multi custom field',
+ :issue => {
+ :priority_id => '',
+ :assigned_to_id => '',
+ :custom_field_values => {
+ '1' => ['__none__']}
+ }
+ }
assert_response 302
assert_equal [''], Issue.find(1).custom_field_value(1)
assert_equal [''], Issue.find(3).custom_field_value(1)
@@ -4471,7 +5660,13 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_not_nil Issue.find(2).assigned_to
@request.session[:user_id] = 2
# unassign issues
- post :bulk_update, :ids => [1, 2], :notes => 'Bulk unassigning', :issue => {:assigned_to_id => 'none'}
+ post :bulk_update, :params => {
+ :ids => [1, 2],
+ :notes => 'Bulk unassigning',
+ :issue => {
+ :assigned_to_id => 'none'
+ }
+ }
assert_response 302
# check that the issues were updated
assert_nil Issue.find(2).assigned_to
@@ -4480,7 +5675,12 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_post_bulk_update_should_allow_fixed_version_to_be_set_to_a_subproject
@request.session[:user_id] = 2
- post :bulk_update, :ids => [1,2], :issue => {:fixed_version_id => 4}
+ post :bulk_update, :params => {
+ :ids => [1,2],
+ :issue => {
+ :fixed_version_id => 4
+ }
+ }
assert_response :redirect
issues = Issue.find([1,2])
@@ -4492,7 +5692,10 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_post_bulk_update_should_redirect_back_using_the_back_url_parameter
@request.session[:user_id] = 2
- post :bulk_update, :ids => [1,2], :back_url => '/issues'
+ post :bulk_update, :params => {
+ :ids => [1,2],
+ :back_url => '/issues'
+ }
assert_response :redirect
assert_redirected_to '/issues'
@@ -4500,7 +5703,10 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_post_bulk_update_should_not_redirect_back_using_the_back_url_parameter_off_the_host
@request.session[:user_id] = 2
- post :bulk_update, :ids => [1,2], :back_url => 'http://google.com'
+ post :bulk_update, :params => {
+ :ids => [1,2],
+ :back_url => 'http://google.com'
+ }
assert_response :redirect
assert_redirected_to :controller => 'issues', :action => 'index', :project_id => Project.find(1).identifier
@@ -4508,7 +5714,12 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_bulk_update_with_all_failures_should_show_errors
@request.session[:user_id] = 2
- post :bulk_update, :ids => [1, 2], :issue => {:start_date => 'foo'}
+ post :bulk_update, :params => {
+ :ids => [1, 2],
+ :issue => {
+ :start_date => 'foo'
+ }
+ }
assert_response :success
assert_select '#errorExplanation span', :text => 'Failed to save 2 issue(s) on 2 selected: #1, #2.'
@@ -4520,8 +5731,12 @@ class IssuesControllerTest < Redmine::ControllerTest
issue2 = Issue.generate!(:start_date => '2013-05-15')
issue3 = Issue.generate!
@request.session[:user_id] = 2
- post :bulk_update, :ids => [issue1.id, issue2.id, issue3.id],
- :issue => {:due_date => '2013-05-01'}
+ post :bulk_update, :params => {
+ :ids => [issue1.id, issue2.id, issue3.id],
+ :issue => {
+ :due_date => '2013-05-01'
+ }
+ }
assert_response :success
assert_select '#errorExplanation span',
@@ -4534,7 +5749,13 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_bulk_update_with_failure_should_preserved_form_values
@request.session[:user_id] = 2
- post :bulk_update, :ids => [1, 2], :issue => {:tracker_id => '2', :start_date => 'foo'}
+ post :bulk_update, :params => {
+ :ids => [1, 2],
+ :issue => {
+ :tracker_id => '2',
+ :start_date => 'foo'
+ }
+ }
assert_response :success
assert_select 'select[name=?]', 'issue[tracker_id]' do
@@ -4545,7 +5766,10 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_get_bulk_copy
@request.session[:user_id] = 2
- get :bulk_edit, :ids => [1, 2, 3], :copy => '1'
+ get :bulk_edit, :params => {
+ :ids => [1, 2, 3],
+ :copy => '1'
+ }
assert_response :success
assert_select '#bulk-selection li', 3
@@ -4560,7 +5784,10 @@ class IssuesControllerTest < Redmine::ControllerTest
user = setup_user_with_copy_but_not_add_permission
@request.session[:user_id] = user.id
- get :bulk_edit, :ids => [1, 2, 3], :copy => '1'
+ get :bulk_edit, :params => {
+ :ids => [1, 2, 3],
+ :copy => '1'
+ }
assert_response :success
assert_select 'select[name=?]', 'issue[project_id]' do
@@ -4573,7 +5800,13 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_difference 'Issue.count', 2 do
assert_no_difference 'Project.find(1).issues.count' do
- post :bulk_update, :ids => [1, 2], :issue => {:project_id => '2'}, :copy => '1'
+ post :bulk_update, :params => {
+ :ids => [1, 2],
+ :issue => {
+ :project_id => '2'
+ },
+ :copy => '1'
+ }
end
end
assert_redirected_to '/projects/ecookbook/issues'
@@ -4589,7 +5822,13 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = user.id
assert_difference 'Issue.count', 3 do
- post :bulk_update, :ids => [1, 2, 3], :issue => {:project_id => '2'}, :copy => '1'
+ post :bulk_update, :params => {
+ :ids => [1, 2, 3],
+ :issue => {
+ :project_id => '2'
+ },
+ :copy => '1'
+ }
assert_response 302
end
end
@@ -4598,7 +5837,13 @@ class IssuesControllerTest < Redmine::ControllerTest
user = setup_user_with_copy_but_not_add_permission
@request.session[:user_id] = user.id
- post :bulk_update, :ids => [1, 2, 3], :issue => {:project_id => ''}, :copy => '1'
+ post :bulk_update, :params => {
+ :ids => [1, 2, 3],
+ :issue => {
+ :project_id => ''
+ },
+ :copy => '1'
+ }
assert_response 403
end
@@ -4606,7 +5851,13 @@ class IssuesControllerTest < Redmine::ControllerTest
user = setup_user_with_copy_but_not_add_permission
@request.session[:user_id] = user.id
- post :bulk_update, :ids => [1, 2, 3], :issue => {:project_id => '1'}, :copy => '1'
+ post :bulk_update, :params => {
+ :ids => [1, 2, 3],
+ :issue => {
+ :project_id => '1'
+ },
+ :copy => '1'
+ }
assert_response 403
end
@@ -4621,11 +5872,19 @@ class IssuesControllerTest < Redmine::ControllerTest
:assigned_to_id => 2)
]
assert_difference 'Issue.count', issues.size do
- post :bulk_update, :ids => issues.map(&:id), :copy => '1',
- :issue => {
- :project_id => '', :tracker_id => '', :assigned_to_id => '',
- :status_id => '', :start_date => '', :due_date => ''
- }
+ post :bulk_update, :params => {
+ :ids => issues.map(&:id),
+ :copy => '1',
+ :issue => {
+ :project_id => '',
+ :tracker_id => '',
+ :assigned_to_id => '',
+ :status_id => '',
+ :start_date => '',
+ :due_date => ''
+
+ }
+ }
end
copies = Issue.order('id DESC').limit(issues.size)
@@ -4653,11 +5912,19 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_difference 'Issue.count', 2 do
assert_no_difference 'Project.find(1).issues.count' do
- post :bulk_update, :ids => [1, 2], :copy => '1',
- :issue => {
- :project_id => '2', :tracker_id => '', :assigned_to_id => '2',
- :status_id => '1', :start_date => '2009-12-01', :due_date => '2009-12-31'
- }
+ post :bulk_update, :params => {
+ :ids => [1, 2],
+ :copy => '1',
+ :issue => {
+ :project_id => '2',
+ :tracker_id => '',
+ :assigned_to_id => '2',
+ :status_id => '1',
+ :start_date => '2009-12-01',
+ :due_date => '2009-12-31'
+
+ }
+ }
end
end
@@ -4675,12 +5942,19 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_bulk_copy_should_allow_adding_a_note
@request.session[:user_id] = 2
assert_difference 'Issue.count', 1 do
- post :bulk_update, :ids => [1], :copy => '1',
- :notes => 'Copying one issue',
- :issue => {
- :project_id => '', :tracker_id => '',
- :status_id => '3', :start_date => '2009-12-01', :due_date => '2009-12-31'
- }
+ post :bulk_update, :params => {
+ :ids => [1],
+ :copy => '1',
+ :notes => 'Copying one issue',
+ :issue => {
+ :project_id => '',
+ :tracker_id => '',
+ :status_id => '3',
+ :start_date => '2009-12-01',
+ :due_date => '2009-12-31'
+
+ }
+ }
end
issue = Issue.order('id DESC').first
assert_equal 1, issue.journals.size
@@ -4695,10 +5969,15 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_difference 'Issue.count', 1 do
assert_no_difference 'Attachment.count' do
- post :bulk_update, :ids => [3], :copy => '1', :copy_attachments => '0',
- :issue => {
- :project_id => ''
- }
+ post :bulk_update, :params => {
+ :ids => [3],
+ :copy => '1',
+ :copy_attachments => '0',
+ :issue => {
+ :project_id => ''
+
+ }
+ }
end
end
end
@@ -4710,10 +5989,15 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_difference 'Issue.count', 1 do
assert_difference 'Attachment.count', attachment_count do
- post :bulk_update, :ids => [3], :copy => '1', :copy_attachments => '1',
- :issue => {
- :project_id => ''
- }
+ post :bulk_update, :params => {
+ :ids => [3],
+ :copy => '1',
+ :copy_attachments => '1',
+ :issue => {
+ :project_id => ''
+
+ }
+ }
end
end
end
@@ -4723,10 +6007,15 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_difference 'Issue.count', 2 do
assert_difference 'IssueRelation.count', 2 do
- post :bulk_update, :ids => [1, 3], :copy => '1', :link_copy => '1',
- :issue => {
- :project_id => '1'
- }
+ post :bulk_update, :params => {
+ :ids => [1, 3],
+ :copy => '1',
+ :link_copy => '1',
+ :issue => {
+ :project_id => '1'
+
+ }
+ }
end
end
end
@@ -4736,10 +6025,15 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_difference 'Issue.count', 1 do
- post :bulk_update, :ids => [issue.id], :copy => '1', :copy_subtasks => '0',
- :issue => {
- :project_id => ''
- }
+ post :bulk_update, :params => {
+ :ids => [issue.id],
+ :copy => '1',
+ :copy_subtasks => '0',
+ :issue => {
+ :project_id => ''
+
+ }
+ }
end
end
@@ -4749,10 +6043,15 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_difference 'Issue.count', count+1 do
- post :bulk_update, :ids => [issue.id], :copy => '1', :copy_subtasks => '1',
- :issue => {
- :project_id => ''
- }
+ post :bulk_update, :params => {
+ :ids => [issue.id],
+ :copy => '1',
+ :copy_subtasks => '1',
+ :issue => {
+ :project_id => ''
+
+ }
+ }
end
copy = Issue.where(:parent_id => nil).order("id DESC").first
assert_equal count, copy.descendants.count
@@ -4763,10 +6062,15 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_difference 'Issue.count' do
- post :bulk_update, :ids => [1], :copy => '1', :copy_watchers => '1',
- :issue => {
- :project_id => ''
- }
+ post :bulk_update, :params => {
+ :ids => [1],
+ :copy => '1',
+ :copy_watchers => '1',
+ :issue => {
+ :project_id => ''
+
+ }
+ }
end
copy = Issue.order(:id => :desc).first
assert_equal 1, copy.watchers.count
@@ -4778,10 +6082,15 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_difference 'Issue.count', count+1 do
- post :bulk_update, :ids => issue.self_and_descendants.map(&:id), :copy => '1', :copy_subtasks => '1',
- :issue => {
- :project_id => ''
- }
+ post :bulk_update, :params => {
+ :ids => issue.self_and_descendants.map(&:id),
+ :copy => '1',
+ :copy_subtasks => '1',
+ :issue => {
+ :project_id => ''
+
+ }
+ }
end
copy = Issue.where(:parent_id => nil).order("id DESC").first
assert_equal count, copy.descendants.count
@@ -4789,14 +6098,27 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_bulk_copy_to_another_project_should_follow_when_needed
@request.session[:user_id] = 2
- post :bulk_update, :ids => [1], :copy => '1', :issue => {:project_id => 2}, :follow => '1'
+ post :bulk_update, :params => {
+ :ids => [1],
+ :copy => '1',
+ :issue => {
+ :project_id => 2
+ },
+ :follow => '1'
+ }
issue = Issue.order('id DESC').first
assert_redirected_to :controller => 'issues', :action => 'show', :id => issue
end
def test_bulk_copy_with_all_failures_should_display_errors
@request.session[:user_id] = 2
- post :bulk_update, :ids => [1, 2], :copy => '1', :issue => {:start_date => 'foo'}
+ post :bulk_update, :params => {
+ :ids => [1, 2],
+ :copy => '1',
+ :issue => {
+ :start_date => 'foo'
+ }
+ }
assert_response :success
end
@@ -4806,7 +6128,9 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_difference 'Issue.count', -1 do
- delete :destroy, :id => 2
+ delete :destroy, :params => {
+ :id => 2
+ }
end
assert_redirected_to :action => 'index', :project_id => 'ecookbook'
assert_nil Issue.find_by_id(2)
@@ -4816,7 +6140,9 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_no_difference 'Issue.count' do
- delete :destroy, :ids => [1, 3]
+ delete :destroy, :params => {
+ :ids => [1, 3]
+ }
end
assert_response :success
@@ -4833,7 +6159,9 @@ class IssuesControllerTest < Redmine::ControllerTest
TimeEntry.generate!(:issue => leaf)
@request.session[:user_id] = 2
- delete :destroy, :ids => [parent.id, leaf.id]
+ delete :destroy, :params => {
+ :ids => [parent.id, leaf.id]
+ }
assert_response :success
assert_select 'p', :text => /3\.00 hours were reported/
@@ -4844,7 +6172,10 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_difference 'Issue.count', -2 do
assert_difference 'TimeEntry.count', -3 do
- delete :destroy, :ids => [1, 3], :todo => 'destroy'
+ delete :destroy, :params => {
+ :ids => [1, 3],
+ :todo => 'destroy'
+ }
end
end
assert_redirected_to :action => 'index', :project_id => 'ecookbook'
@@ -4857,7 +6188,10 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_difference 'Issue.count', -2 do
assert_no_difference 'TimeEntry.count' do
- delete :destroy, :ids => [1, 3], :todo => 'nullify'
+ delete :destroy, :params => {
+ :ids => [1, 3],
+ :todo => 'nullify'
+ }
end
end
assert_redirected_to :action => 'index', :project_id => 'ecookbook'
@@ -4871,7 +6205,11 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_difference 'Issue.count', -2 do
assert_no_difference 'TimeEntry.count' do
- delete :destroy, :ids => [1, 3], :todo => 'reassign', :reassign_to_id => 2
+ delete :destroy, :params => {
+ :ids => [1, 3],
+ :todo => 'reassign',
+ :reassign_to_id => 2
+ }
end
end
assert_redirected_to :action => 'index', :project_id => 'ecookbook'
@@ -4891,7 +6229,11 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_difference 'Issue.count', -3 do
assert_no_difference 'TimeEntry.count' do
- delete :destroy, :ids => [parent.id, leaf.id], :todo => 'reassign', :reassign_to_id => target.id
+ delete :destroy, :params => {
+ :ids => [parent.id, leaf.id],
+ :todo => 'reassign',
+ :reassign_to_id => target.id
+ }
assert_response 302
end
end
@@ -4904,7 +6246,11 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_no_difference 'Issue.count' do
assert_no_difference 'TimeEntry.count' do
# try to reassign time to an issue of another project
- delete :destroy, :ids => [1, 3], :todo => 'reassign', :reassign_to_id => 4
+ delete :destroy, :params => {
+ :ids => [1, 3],
+ :todo => 'reassign',
+ :reassign_to_id => 4
+ }
end
end
assert_response :success
@@ -4915,7 +6261,11 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_no_difference 'Issue.count' do
assert_no_difference 'TimeEntry.count' do
- delete :destroy, :ids => [1, 3], :todo => 'reassign', :reassign_to_id => 3
+ delete :destroy, :params => {
+ :ids => [1, 3],
+ :todo => 'reassign',
+ :reassign_to_id => 3
+ }
end
end
assert_response :success
@@ -4926,7 +6276,10 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_difference 'Issue.count', -3 do
- delete :destroy, :ids => [1, 2, 6], :todo => 'destroy'
+ delete :destroy, :params => {
+ :ids => [1, 2, 6],
+ :todo => 'destroy'
+ }
end
assert_redirected_to :controller => 'issues', :action => 'index'
assert !(Issue.find_by_id(1) || Issue.find_by_id(2) || Issue.find_by_id(6))
@@ -4939,7 +6292,10 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_difference 'Issue.count', -2 do
- delete :destroy, :ids => [parent.id, child.id], :todo => 'destroy'
+ delete :destroy, :params => {
+ :ids => [parent.id, child.id],
+ :todo => 'destroy'
+ }
end
assert_response 302
end
@@ -4947,7 +6303,9 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_destroy_invalid_should_respond_with_404
@request.session[:user_id] = 2
assert_no_difference 'Issue.count' do
- delete :destroy, :id => 999
+ delete :destroy, :params => {
+ :id => 999
+ }
end
assert_response 404
end
@@ -4960,7 +6318,9 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_difference 'Issue.count', -1 do
- delete :destroy, :id => issue.id
+ delete :destroy, :params => {
+ :id => issue.id
+ }
end
assert_response 302
end
@@ -4973,7 +6333,9 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_no_difference 'Issue.count' do
- delete :destroy, :id => issue.id
+ delete :destroy, :params => {
+ :id => issue.id
+ }
end
assert_response 403
end
@@ -4998,7 +6360,9 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_cancel_edit_link_for_issue_show_action_should_have_onclick_action
@request.session[:user_id] = 1
- get :show, :id => 1
+ get :show, :params => {
+ :id => 1
+ }
assert_response :success
assert_select 'a[href=?][onclick=?]', "/issues/1", "$('#update').hide(); return false;", :text => 'Cancel'
end
@@ -5006,7 +6370,9 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_cancel_edit_link_for_issue_edit_action_should_not_have_onclick_action
@request.session[:user_id] = 1
- get :edit, :id => 1
+ get :edit, :params => {
+ :id => 1
+ }
assert_response :success
assert_select 'a[href=?][onclick=?]', "/issues/1", "", :text => 'Cancel'
end
diff --git a/test/functional/issues_controller_transaction_test.rb b/test/functional/issues_controller_transaction_test.rb
index b43572014..a48663164 100644
--- a/test/functional/issues_controller_transaction_test.rb
+++ b/test/functional/issues_controller_transaction_test.rb
@@ -56,14 +56,20 @@ class IssuesControllerTransactionTest < Redmine::ControllerTest
assert_no_difference 'Journal.count' do
assert_no_difference 'TimeEntry.count' do
- put :update,
- :id => issue.id,
- :issue => {
- :fixed_version_id => 4,
- :notes => 'My notes',
- :lock_version => (issue.lock_version - 1)
- },
- :time_entry => { :hours => '2.5', :comments => '', :activity_id => TimeEntryActivity.first.id }
+ put :update, :params => {
+ :id => issue.id,
+ :issue => {
+ :fixed_version_id => 4,
+ :notes => 'My notes',
+ :lock_version => (issue.lock_version - 1)
+
+ },
+ :time_entry => {
+ :hours => '2.5',
+ :comments => '',
+ :activity_id => TimeEntryActivity.first.id
+ }
+ }
end
end
@@ -86,15 +92,24 @@ class IssuesControllerTransactionTest < Redmine::ControllerTest
assert_no_difference 'Journal.count' do
assert_no_difference 'TimeEntry.count' do
assert_difference 'Attachment.count' do
- put :update,
- :id => issue.id,
- :issue => {
- :fixed_version_id => 4,
- :notes => 'My notes',
- :lock_version => (issue.lock_version - 1)
- },
- :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}},
- :time_entry => { :hours => '2.5', :comments => '', :activity_id => TimeEntryActivity.first.id }
+ put :update, :params => {
+ :id => issue.id,
+ :issue => {
+ :fixed_version_id => 4,
+ :notes => 'My notes',
+ :lock_version => (issue.lock_version - 1)
+
+ },
+ :attachments => {
+ '1' => {
+ 'file' => uploaded_test_file('testfile.txt', 'text/plain')}
+ },
+ :time_entry => {
+ :hours => '2.5',
+ :comments => '',
+ :activity_id => TimeEntryActivity.first.id
+ }
+ }
end
end
end
@@ -110,12 +125,15 @@ class IssuesControllerTransactionTest < Redmine::ControllerTest
issue = Issue.find(2)
@request.session[:user_id] = 2
- put :update, :id => issue.id,
- :issue => {
- :fixed_version_id => 4,
- :notes => '',
- :lock_version => (issue.lock_version - 1)
- }
+ put :update, :params => {
+ :id => issue.id,
+ :issue => {
+ :fixed_version_id => 4,
+ :notes => '',
+ :lock_version => (issue.lock_version - 1)
+
+ }
+ }
assert_response :success
assert_select 'div.conflict'
@@ -127,13 +145,16 @@ class IssuesControllerTransactionTest < Redmine::ControllerTest
def test_update_stale_issue_should_show_conflicting_journals
@request.session[:user_id] = 2
- put :update, :id => 1,
- :issue => {
- :fixed_version_id => 4,
- :notes => '',
- :lock_version => 2
- },
- :last_journal_id => 1
+ put :update, :params => {
+ :id => 1,
+ :issue => {
+ :fixed_version_id => 4,
+ :notes => '',
+ :lock_version => 2
+
+ },
+ :last_journal_id => 1
+ }
assert_response :success
assert_select '.conflict-journal', 1
@@ -143,13 +164,16 @@ class IssuesControllerTransactionTest < Redmine::ControllerTest
def test_update_stale_issue_without_previous_journal_should_show_all_journals
@request.session[:user_id] = 2
- put :update, :id => 1,
- :issue => {
- :fixed_version_id => 4,
- :notes => '',
- :lock_version => 2
- },
- :last_journal_id => ''
+ put :update, :params => {
+ :id => 1,
+ :issue => {
+ :fixed_version_id => 4,
+ :notes => '',
+ :lock_version => 2
+
+ },
+ :last_journal_id => ''
+ }
assert_response :success
assert_select '.conflict-journal', 2
@@ -161,12 +185,26 @@ class IssuesControllerTransactionTest < Redmine::ControllerTest
journal = Journal.create!(:journalized => Issue.find(1), :notes => 'Privates notes', :private_notes => true, :user_id => 1)
@request.session[:user_id] = 2
- put :update, :id => 1, :issue => {:fixed_version_id => 4, :lock_version => 2}, :last_journal_id => ''
+ put :update, :params => {
+ :id => 1,
+ :issue => {
+ :fixed_version_id => 4,
+ :lock_version => 2
+ },
+ :last_journal_id => ''
+ }
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 => ''
+ put :update, :params => {
+ :id => 1,
+ :issue => {
+ :fixed_version_id => 4,
+ :lock_version => 2
+ },
+ :last_journal_id => ''
+ }
assert_response :success
assert_select '.conflict-journal', :text => /Privates notes/, :count => 0
end
@@ -175,13 +213,16 @@ class IssuesControllerTransactionTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_difference 'Journal.count' do
- put :update, :id => 1,
- :issue => {
- :fixed_version_id => 4,
- :notes => 'overwrite_conflict_resolution',
- :lock_version => 2
- },
- :conflict_resolution => 'overwrite'
+ put :update, :params => {
+ :id => 1,
+ :issue => {
+ :fixed_version_id => 4,
+ :notes => 'overwrite_conflict_resolution',
+ :lock_version => 2
+
+ },
+ :conflict_resolution => 'overwrite'
+ }
end
assert_response 302
@@ -196,13 +237,16 @@ class IssuesControllerTransactionTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_difference 'Journal.count' do
- put :update, :id => 1,
- :issue => {
- :fixed_version_id => 4,
- :notes => 'add_notes_conflict_resolution',
- :lock_version => 2
- },
- :conflict_resolution => 'add_notes'
+ put :update, :params => {
+ :id => 1,
+ :issue => {
+ :fixed_version_id => 4,
+ :notes => 'add_notes_conflict_resolution',
+ :lock_version => 2
+
+ },
+ :conflict_resolution => 'add_notes'
+ }
end
assert_response 302
@@ -218,14 +262,17 @@ class IssuesControllerTransactionTest < Redmine::ControllerTest
@request.session[:user_id] = 2
journal = new_record(Journal) do
- put :update, :id => 1,
- :issue => {
- :fixed_version_id => 4,
- :notes => 'add_privates_notes_conflict_resolution',
- :private_notes => '1',
- :lock_version => 2
- },
- :conflict_resolution => 'add_notes'
+ put :update, :params => {
+ :id => 1,
+ :issue => {
+ :fixed_version_id => 4,
+ :notes => 'add_privates_notes_conflict_resolution',
+ :private_notes => '1',
+ :lock_version => 2
+
+ },
+ :conflict_resolution => 'add_notes'
+ }
end
assert_response 302
@@ -238,13 +285,16 @@ class IssuesControllerTransactionTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_no_difference 'Journal.count' do
- put :update, :id => 1,
- :issue => {
- :fixed_version_id => 4,
- :notes => 'add_notes_conflict_resolution',
- :lock_version => 2
- },
- :conflict_resolution => 'cancel'
+ put :update, :params => {
+ :id => 1,
+ :issue => {
+ :fixed_version_id => 4,
+ :notes => 'add_notes_conflict_resolution',
+ :lock_version => 2
+
+ },
+ :conflict_resolution => 'cancel'
+ }
end
assert_redirected_to '/issues/1'
@@ -256,10 +306,17 @@ class IssuesControllerTransactionTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_no_difference('TimeEntry.count') do
- put :update,
- :id => 1,
- :issue => { :subject => '' },
- :time_entry => { :hours => '2.5', :comments => 'should not be added', :activity_id => TimeEntryActivity.first.id }
+ put :update, :params => {
+ :id => 1,
+ :issue => {
+ :subject => ''
+ },
+ :time_entry => {
+ :hours => '2.5',
+ :comments => 'should not be added',
+ :activity_id => TimeEntryActivity.first.id
+ }
+ }
assert_response :success
end
diff --git a/test/functional/issues_custom_fields_visibility_test.rb b/test/functional/issues_custom_fields_visibility_test.rb
index cd395d88c..31fc2175e 100644
--- a/test/functional/issues_custom_fields_visibility_test.rb
+++ b/test/functional/issues_custom_fields_visibility_test.rb
@@ -65,7 +65,9 @@ class IssuesCustomFieldsVisibilityTest < Redmine::ControllerTest
def test_show_should_show_visible_custom_fields_only
@users_to_test.each do |user, fields|
@request.session[:user_id] = user.id
- get :show, :id => @issue.id
+ get :show, :params => {
+ :id => @issue.id
+ }
@fields.each_with_index do |field, i|
if fields.include?(field)
assert_select '.value', {:text => "Value#{i}", :count => 1}, "User #{user.id} was not able to view #{field.name}"
@@ -79,7 +81,12 @@ class IssuesCustomFieldsVisibilityTest < Redmine::ControllerTest
def test_show_should_show_visible_custom_fields_only_in_api
@users_to_test.each do |user, fields|
with_settings :rest_api_enabled => '1' do
- get :show, :id => @issue.id, :format => 'xml', :include => 'custom_fields', :key => user.api_key
+ get :show, :params => {
+ :id => @issue.id,
+ :format => 'xml',
+ :include => 'custom_fields',
+ :key => user.api_key
+ }
end
@fields.each_with_index do |field, i|
if fields.include?(field)
@@ -98,7 +105,9 @@ class IssuesCustomFieldsVisibilityTest < Redmine::ControllerTest
@users_to_test.each do |user, fields|
@request.session[:user_id] = user.id
- get :show, :id => @issue.id
+ get :show, :params => {
+ :id => @issue.id
+ }
@fields.each_with_index do |field, i|
if fields.include?(field)
assert_select 'ul.details i', {:text => "Value#{i}", :count => 1}, "User #{user.id} was not able to view #{field.name} change"
@@ -116,7 +125,12 @@ class IssuesCustomFieldsVisibilityTest < Redmine::ControllerTest
@users_to_test.each do |user, fields|
with_settings :rest_api_enabled => '1' do
- get :show, :id => @issue.id, :format => 'xml', :include => 'journals', :key => user.api_key
+ get :show, :params => {
+ :id => @issue.id,
+ :format => 'xml',
+ :include => 'journals',
+ :key => user.api_key
+ }
end
@fields.each_with_index do |field, i|
if fields.include?(field)
@@ -133,7 +147,9 @@ class IssuesCustomFieldsVisibilityTest < Redmine::ControllerTest
@users_to_test.each do |user, fields|
@request.session[:user_id] = user.id
- get :edit, :id => @issue.id
+ get :edit, :params => {
+ :id => @issue.id
+ }
@fields.each_with_index do |field, i|
if fields.include?(field)
assert_select 'input[value=?]', "Value#{i}", 1, "User #{user.id} was not able to edit #{field.name}"
@@ -149,12 +165,16 @@ class IssuesCustomFieldsVisibilityTest < Redmine::ControllerTest
@users_to_test.each do |user, fields|
@request.session[:user_id] = user.id
- put :update, :id => @issue.id,
- :issue => {:custom_field_values => {
- @field1.id.to_s => "User#{user.id}Value0",
- @field2.id.to_s => "User#{user.id}Value1",
- @field3.id.to_s => "User#{user.id}Value2",
- }}
+ put :update, :params => {
+ :id => @issue.id,
+ :issue => {
+ :custom_field_values => {
+ @field1.id.to_s => "User#{user.id}Value0",
+ @field2.id.to_s => "User#{user.id}Value1",
+ @field3.id.to_s => "User#{user.id}Value2",
+ }
+ }
+ }
@issue.reload
@fields.each_with_index do |field, i|
if fields.include?(field)
@@ -169,7 +189,9 @@ class IssuesCustomFieldsVisibilityTest < Redmine::ControllerTest
def test_index_should_show_visible_custom_fields_only
@users_to_test.each do |user, fields|
@request.session[:user_id] = user.id
- get :index, :c => (["subject"] + @fields.map{|f| "cf_#{f.id}"})
+ get :index, :params => {
+ :c => (["subject"] + @fields.map{|f| "cf_#{f.id}"})
+ }
@fields.each_with_index do |field, i|
if fields.include?(field)
assert_select 'td', {:text => "Value#{i}", :count => 1}, "User #{user.id} was not able to view #{field.name}"
@@ -183,7 +205,10 @@ class IssuesCustomFieldsVisibilityTest < Redmine::ControllerTest
def test_index_as_csv_should_show_visible_custom_fields_only
@users_to_test.each do |user, fields|
@request.session[:user_id] = user.id
- get :index, :c => (["subject"] + @fields.map{|f| "cf_#{f.id}"}), :format => 'csv'
+ get :index, :params => {
+ :c => (["subject"] + @fields.map{|f| "cf_#{f.id}"}),
+ :format => 'csv'
+ }
@fields.each_with_index do |field, i|
if fields.include?(field)
assert_include "Value#{i}", response.body, "User #{user.id} was not able to view #{field.name} in CSV"
@@ -206,20 +231,29 @@ class IssuesCustomFieldsVisibilityTest < Redmine::ControllerTest
Issue.generate!(:project => p1, :tracker_id => 1, :custom_field_values => {@field2.id => 'ValueC'})
@request.session[:user_id] = user.id
- get :index, :c => ["subject", "cf_#{@field2.id}"]
+ get :index, :params => {
+ :c => ["subject", "cf_#{@field2.id}"]
+ }
assert_select 'td', :text => 'ValueA'
assert_select 'td', :text => 'ValueB', :count => 0
assert_select 'td', :text => 'ValueC'
- get :index, :sort => "cf_#{@field2.id}"
+ get :index, :params => {
+ :sort => "cf_#{@field2.id}"
+ }
# ValueB is not visible to user and ignored while sorting
assert_equal %w(ValueB ValueA ValueC), issues_in_list.map{|i| i.custom_field_value(@field2)}
- get :index, :set_filter => '1', "cf_#{@field2.id}" => '*', :sort => "cf_#{@field2.id}"
+ get :index, :params => {
+ :set_filter => '1', "cf_#{@field2.id}" => '*',
+ :sort => "cf_#{@field2.id}"
+ }
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}"
+ get :index, :params => {
+ :group => "cf_#{@field2.id}"
+ }
assert_equal %w(ValueA ValueC), issues_in_list.map{|i| i.custom_field_value(@field2)}
end
@@ -231,15 +265,19 @@ class IssuesCustomFieldsVisibilityTest < Redmine::ControllerTest
@request.session[:user_id] = 1
with_settings :bcc_recipients => '1' do
assert_difference 'Issue.count' do
- post :create,
- :project_id => 1,
- :issue => {
- :tracker_id => 1,
- :status_id => 1,
- :subject => 'New issue',
- :priority_id => 5,
- :custom_field_values => {@field1.id.to_s => 'Value0', @field2.id.to_s => 'Value1', @field3.id.to_s => 'Value2'},
- :watcher_user_ids => users_to_test.keys.map(&:id)
+ post :create, :params => {
+ :project_id => 1,
+ :issue => {
+ :tracker_id => 1,
+ :status_id => 1,
+ :subject => 'New issue',
+ :priority_id => 5,
+ :custom_field_values => {
+ @field1.id.to_s => 'Value0', @field2.id.to_s => 'Value1', @field3.id.to_s => 'Value2'
+ },
+ :watcher_user_ids => users_to_test.keys.map(&:id)
+
+ }
}
assert_response 302
end
@@ -270,10 +308,14 @@ class IssuesCustomFieldsVisibilityTest < Redmine::ControllerTest
ActionMailer::Base.deliveries.clear
@request.session[:user_id] = 1
with_settings :bcc_recipients => '1' do
- put :update,
- :id => @issue.id,
- :issue => {
- :custom_field_values => {@field1.id.to_s => 'NewValue0', @field2.id.to_s => 'NewValue1', @field3.id.to_s => 'NewValue2'}
+ put :update, :params => {
+ :id => @issue.id,
+ :issue => {
+ :custom_field_values => {
+ @field1.id.to_s => 'NewValue0', @field2.id.to_s => 'NewValue1', @field3.id.to_s => 'NewValue2'
+ }
+
+ }
}
assert_response 302
end
@@ -303,10 +345,14 @@ class IssuesCustomFieldsVisibilityTest < Redmine::ControllerTest
ActionMailer::Base.deliveries.clear
@request.session[:user_id] = 1
with_settings :bcc_recipients => '1' do
- put :update,
- :id => @issue.id,
- :issue => {
- :custom_field_values => {@field2.id.to_s => 'NewValue1', @field3.id.to_s => 'NewValue2'}
+ put :update, :params => {
+ :id => @issue.id,
+ :issue => {
+ :custom_field_values => {
+ @field2.id.to_s => 'NewValue1', @field3.id.to_s => 'NewValue2'
+ }
+
+ }
}
assert_response 302
end
diff --git a/test/functional/journals_controller_test.rb b/test/functional/journals_controller_test.rb
index 446cdcc83..a4f06b7d1 100644
--- a/test/functional/journals_controller_test.rb
+++ b/test/functional/journals_controller_test.rb
@@ -26,13 +26,18 @@ class JournalsControllerTest < Redmine::ControllerTest
end
def test_index
- get :index, :project_id => 1
+ get :index, :params => {
+ :project_id => 1
+ }
assert_response :success
assert_equal 'application/atom+xml', @response.content_type
end
def test_index_with_invalid_query_id
- get :index, :project_id => 1, :query_id => 999
+ get :index, :params => {
+ :project_id => 1,
+ :query_id => 999
+ }
assert_response 404
end
@@ -40,18 +45,23 @@ class JournalsControllerTest < Redmine::ControllerTest
journal = Journal.create!(:journalized => Issue.find(2), :notes => 'Privates notes', :private_notes => true, :user_id => 1)
@request.session[:user_id] = 2
- get :index, :project_id => 1
+ get :index, :params => {
+ :project_id => 1
+ }
assert_response :success
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
+ get :index, :params => {
+ :project_id => 1
+ }
assert_response :success
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
Issue.destroy_all
+ Journal.delete_all
field_attributes = {:field_format => 'string', :is_for_all => true, :is_filter => true, :trackers => Tracker.all}
@fields = []
@fields << (@field1 = IssueCustomField.create!(field_attributes.merge(:name => 'Field 1', :visible => true)))
@@ -64,8 +74,8 @@ class JournalsControllerTest < Redmine::ControllerTest
:custom_field_values => {@field1.id => 'Value0', @field2.id => 'Value1', @field3.id => 'Value2'}
)
@issue.init_journal(User.find(1))
- @issue.update_attribute :custom_field_values, {@field1.id => 'NewValue0', @field2.id => 'NewValue1', @field3.id => 'NewValue2'}
-
+ @issue.custom_field_values = {@field1.id => 'NewValue0', @field2.id => 'NewValue1', @field3.id => 'NewValue2'}
+ @issue.save!
user_with_role_on_other_project = User.generate!
User.add_to_project(user_with_role_on_other_project, Project.find(2), Role.find(3))
@@ -78,7 +88,10 @@ class JournalsControllerTest < Redmine::ControllerTest
}
users_to_test.each do |user, visible_fields|
- get :index, :format => 'atom', :key => user.rss_key
+ get :index, :params => {
+ :format => 'atom',
+ :key => user.rss_key
+ }
@fields.each_with_index do |field, i|
if visible_fields.include?(field)
assert_select "content[type=html]", { :text => /NewValue#{i}/, :count => 1 }, "User #{user.id} was not able to view #{field.name} in API"
@@ -91,7 +104,10 @@ class JournalsControllerTest < Redmine::ControllerTest
end
def test_diff_for_description_change
- get :diff, :id => 3, :detail_id => 4
+ get :diff, :params => {
+ :id => 3,
+ :detail_id => 4
+ }
assert_response :success
assert_select 'span.diff_out', :text => /removed/
@@ -104,7 +120,10 @@ class JournalsControllerTest < Redmine::ControllerTest
detail = JournalDetail.create!(:journal => journal, :property => 'cf', :prop_key => field.id,
:old_value => 'Foo', :value => 'Bar')
- get :diff, :id => journal.id, :detail_id => detail.id
+ get :diff, :params => {
+ :id => journal.id,
+ :detail_id => detail.id
+ }
assert_response :success
assert_select 'span.diff_out', :text => /Foo/
@@ -117,12 +136,17 @@ class JournalsControllerTest < Redmine::ControllerTest
detail = JournalDetail.create!(:journal => journal, :property => 'cf', :prop_key => field.id,
:old_value => 'Foo', :value => 'Bar')
- get :diff, :id => journal.id, :detail_id => detail.id
+ get :diff, :params => {
+ :id => journal.id,
+ :detail_id => detail.id
+ }
assert_response 302
end
def test_diff_should_default_to_description_diff
- get :diff, :id => 3
+ get :diff, :params => {
+ :id => 3
+ }
assert_response :success
assert_select 'span.diff_out', :text => /removed/
@@ -131,7 +155,10 @@ class JournalsControllerTest < Redmine::ControllerTest
def test_reply_to_issue
@request.session[:user_id] = 2
- xhr :get, :new, :id => 6
+ get :new, :params => {
+ :id => 6
+ },
+ :xhr => true
assert_response :success
assert_equal 'text/javascript', response.content_type
@@ -140,13 +167,20 @@ class JournalsControllerTest < Redmine::ControllerTest
def test_reply_to_issue_without_permission
@request.session[:user_id] = 7
- xhr :get, :new, :id => 6
+ get :new, :params => {
+ :id => 6
+ },
+ :xhr => true
assert_response 403
end
def test_reply_to_note
@request.session[:user_id] = 2
- xhr :get, :new, :id => 6, :journal_id => 4
+ get :new, :params => {
+ :id => 6,
+ :journal_id => 4
+ },
+ :xhr => true
assert_response :success
assert_equal 'text/javascript', response.content_type
assert_include '> A comment with a private version', response.body
@@ -156,19 +190,30 @@ class JournalsControllerTest < Redmine::ControllerTest
journal = Journal.create!(:journalized => Issue.find(2), :notes => 'Privates notes', :private_notes => true)
@request.session[:user_id] = 2
- xhr :get, :new, :id => 2, :journal_id => journal.id
+ get :new, :params => {
+ :id => 2,
+ :journal_id => journal.id
+ },
+ :xhr => true
assert_response :success
assert_equal 'text/javascript', response.content_type
assert_include '> Privates notes', response.body
Role.find(1).remove_permission! :view_private_notes
- xhr :get, :new, :id => 2, :journal_id => journal.id
+ get :new, :params => {
+ :id => 2,
+ :journal_id => journal.id
+ },
+ :xhr => true
assert_response 404
end
def test_edit_xhr
@request.session[:user_id] = 1
- xhr :get, :edit, :id => 2
+ get :edit, :params => {
+ :id => 2
+ },
+ :xhr => true
assert_response :success
assert_equal 'text/javascript', response.content_type
assert_include 'textarea', response.body
@@ -179,19 +224,31 @@ class JournalsControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
Role.find(1).add_permission! :edit_issue_notes
- xhr :get, :edit, :id => journal.id
+ get :edit, :params => {
+ :id => journal.id
+ },
+ :xhr => true
assert_response :success
assert_equal 'text/javascript', response.content_type
assert_include 'textarea', response.body
Role.find(1).remove_permission! :view_private_notes
- xhr :get, :edit, :id => journal.id
+ get :edit, :params => {
+ :id => journal.id
+ },
+ :xhr => true
assert_response 404
end
def test_update_xhr
@request.session[:user_id] = 1
- xhr :post, :update, :id => 2, :journal => {:notes => 'Updated notes'}
+ post :update, :params => {
+ :id => 2,
+ :journal => {
+ :notes => 'Updated notes'
+ }
+ },
+ :xhr => true
assert_response :success
assert_equal 'text/javascript', response.content_type
assert_equal 'Updated notes', Journal.find(2).notes
@@ -200,7 +257,13 @@ class JournalsControllerTest < Redmine::ControllerTest
def test_update_xhr_with_private_notes_checked
@request.session[:user_id] = 1
- xhr :post, :update, :id => 2, :journal => {:private_notes => '1'}
+ post :update, :params => {
+ :id => 2,
+ :journal => {
+ :private_notes => '1'
+ }
+ },
+ :xhr => true
assert_response :success
assert_equal 'text/javascript', response.content_type
assert_equal true, Journal.find(2).private_notes
@@ -211,7 +274,13 @@ class JournalsControllerTest < Redmine::ControllerTest
def test_update_xhr_with_private_notes_unchecked
Journal.find(2).update_attributes(:private_notes => true)
@request.session[:user_id] = 1
- xhr :post, :update, :id => 2, :journal => {:private_notes => '0'}
+ post :update, :params => {
+ :id => 2,
+ :journal => {
+ :private_notes => '0'
+ }
+ },
+ :xhr => true
assert_response :success
assert_equal 'text/javascript', response.content_type
assert_equal false, Journal.find(2).private_notes
@@ -225,7 +294,13 @@ class JournalsControllerTest < Redmine::ControllerTest
Role.find(1).add_permission! :view_private_notes
Role.find(1).remove_permission! :set_notes_private
- xhr :post, :update, :id => 2, :journal => {:private_notes => '1'}
+ post :update, :params => {
+ :id => 2,
+ :journal => {
+ :private_notes => '1'
+ }
+ },
+ :xhr => true
assert_response :success
assert_equal false, Journal.find(2).private_notes
end
@@ -233,7 +308,13 @@ class JournalsControllerTest < Redmine::ControllerTest
def test_update_xhr_with_empty_notes_should_delete_the_journal
@request.session[:user_id] = 1
assert_difference 'Journal.count', -1 do
- xhr :post, :update, :id => 2, :journal => {:notes => ''}
+ post :update, :params => {
+ :id => 2,
+ :journal => {
+ :notes => ''
+ }
+ },
+ :xhr => true
assert_response :success
assert_equal 'text/javascript', response.content_type
end
diff --git a/test/functional/mail_handler_controller_test.rb b/test/functional/mail_handler_controller_test.rb
index 91d31b56c..5f4c6bb3a 100644
--- a/test/functional/mail_handler_controller_test.rb
+++ b/test/functional/mail_handler_controller_test.rb
@@ -33,7 +33,10 @@ class MailHandlerControllerTest < Redmine::ControllerTest
Setting.mail_handler_api_key = 'secret'
assert_difference 'Issue.count' do
- post :index, :key => 'secret', :email => IO.read(File.join(FIXTURES_PATH, 'ticket_on_given_project.eml'))
+ post :index, :params => {
+ :key => 'secret',
+ :email => IO.read(File.join(FIXTURES_PATH, 'ticket_on_given_project.eml'))
+ }
end
assert_response 201
end
@@ -44,9 +47,13 @@ class MailHandlerControllerTest < Redmine::ControllerTest
Setting.mail_handler_api_key = 'secret'
assert_difference 'Issue.count' do
- post :index, :key => 'secret',
- :email => IO.read(File.join(FIXTURES_PATH, 'ticket_on_given_project.eml')),
- :issue => {:is_private => '1'}
+ post :index, :params => {
+ :key => 'secret',
+ :email => IO.read(File.join(FIXTURES_PATH, 'ticket_on_given_project.eml')),
+ :issue => {
+ :is_private => '1'
+ }
+ }
end
assert_response 201
issue = Issue.order(:id => :desc).first
@@ -60,7 +67,10 @@ class MailHandlerControllerTest < Redmine::ControllerTest
Setting.mail_handler_api_key = 'secret'
assert_no_difference 'Issue.count' do
- post :index, :key => 'secret', :email => IO.read(File.join(FIXTURES_PATH, 'ticket_on_given_project.eml'))
+ post :index, :params => {
+ :key => 'secret',
+ :email => IO.read(File.join(FIXTURES_PATH, 'ticket_on_given_project.eml'))
+ }
end
assert_response 422
end
@@ -71,7 +81,10 @@ class MailHandlerControllerTest < Redmine::ControllerTest
Setting.mail_handler_api_key = 'secret'
assert_no_difference 'Issue.count' do
- post :index, :key => 'secret', :email => IO.read(File.join(FIXTURES_PATH, 'ticket_on_given_project.eml'))
+ post :index, :params => {
+ :key => 'secret',
+ :email => IO.read(File.join(FIXTURES_PATH, 'ticket_on_given_project.eml'))
+ }
end
assert_response 403
assert_include 'Access denied', response.body
@@ -82,7 +95,10 @@ class MailHandlerControllerTest < Redmine::ControllerTest
Setting.mail_handler_api_key = 'secret'
assert_no_difference 'Issue.count' do
- post :index, :key => 'wrong', :email => IO.read(File.join(FIXTURES_PATH, 'ticket_on_given_project.eml'))
+ post :index, :params => {
+ :key => 'wrong',
+ :email => IO.read(File.join(FIXTURES_PATH, 'ticket_on_given_project.eml'))
+ }
end
assert_response 403
assert_include 'Access denied', response.body
@@ -92,7 +108,9 @@ class MailHandlerControllerTest < Redmine::ControllerTest
Setting.mail_handler_api_enabled = 1
Setting.mail_handler_api_key = 'secret'
- get :new, :key => 'secret'
+ get :new, :params => {
+ :key => 'secret'
+ }
assert_response :success
end
end
diff --git a/test/functional/members_controller_test.rb b/test/functional/members_controller_test.rb
index 6de763fd1..19bff8199 100644
--- a/test/functional/members_controller_test.rb
+++ b/test/functional/members_controller_test.rb
@@ -26,7 +26,9 @@ class MembersControllerTest < Redmine::ControllerTest
end
def test_new
- get :new, :project_id => 1
+ get :new, :params => {
+ :project_id => 1
+ }
assert_response :success
end
@@ -35,7 +37,9 @@ class MembersControllerTest < Redmine::ControllerTest
role.update! :all_roles_managed => false
role.managed_roles = Role.where(:id => [2, 3]).to_a
- get :new, :project_id => 1
+ get :new, :params => {
+ :project_id => 1
+ }
assert_response :success
assert_select 'div.roles-selection' do
assert_select 'label', :text => 'Manager', :count => 0
@@ -45,14 +49,23 @@ class MembersControllerTest < Redmine::ControllerTest
end
def test_xhr_new
- xhr :get, :new, :project_id => 1
+ get :new, :params => {
+ :project_id => 1
+ },
+ :xhr => true
assert_response :success
assert_equal 'text/javascript', response.content_type
end
def test_create
assert_difference 'Member.count' do
- post :create, :project_id => 1, :membership => {:role_ids => [1], :user_id => 7}
+ post :create, :params => {
+ :project_id => 1,
+ :membership => {
+ :role_ids => [1],
+ :user_id => 7
+ }
+ }
end
assert_redirected_to '/projects/ecookbook/settings/members'
assert User.find(7).member_of?(Project.find(1))
@@ -60,7 +73,13 @@ class MembersControllerTest < Redmine::ControllerTest
def test_create_multiple
assert_difference 'Member.count', 3 do
- post :create, :project_id => 1, :membership => {:role_ids => [1], :user_ids => [7, 8, 9]}
+ post :create, :params => {
+ :project_id => 1,
+ :membership => {
+ :role_ids => [1],
+ :user_ids => [7, 8, 9]
+ }
+ }
end
assert_redirected_to '/projects/ecookbook/settings/members'
assert User.find(7).member_of?(Project.find(1))
@@ -72,7 +91,13 @@ class MembersControllerTest < Redmine::ControllerTest
role.managed_roles = Role.where(:id => [2, 3]).to_a
assert_difference 'Member.count' do
- post :create, :project_id => 1, :membership => {:role_ids => [1, 2], :user_id => 7}
+ post :create, :params => {
+ :project_id => 1,
+ :membership => {
+ :role_ids => [1, 2],
+ :user_id => 7
+ }
+ }
end
member = Member.order(:id => :desc).first
assert_equal [2], member.role_ids
@@ -83,7 +108,13 @@ class MembersControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 1
assert_difference 'Member.count' do
- post :create, :project_id => 1, :membership => {:role_ids => [1, 2], :user_id => 7}
+ post :create, :params => {
+ :project_id => 1,
+ :membership => {
+ :role_ids => [1, 2],
+ :user_id => 7
+ }
+ }
end
member = Member.order(:id => :desc).first
assert_equal [1, 2], member.role_ids
@@ -91,7 +122,14 @@ class MembersControllerTest < Redmine::ControllerTest
def test_xhr_create
assert_difference 'Member.count', 3 do
- xhr :post, :create, :project_id => 1, :membership => {:role_ids => [1], :user_ids => [7, 8, 9]}
+ post :create, :params => {
+ :project_id => 1,
+ :membership => {
+ :role_ids => [1],
+ :user_ids => [7, 8, 9]
+ }
+ },
+ :xhr => true
assert_response :success
assert_equal 'text/javascript', response.content_type
end
@@ -103,7 +141,14 @@ class MembersControllerTest < Redmine::ControllerTest
def test_xhr_create_with_failure
assert_no_difference 'Member.count' do
- xhr :post, :create, :project_id => 1, :membership => {:role_ids => [], :user_ids => [7, 8, 9]}
+ post :create, :params => {
+ :project_id => 1,
+ :membership => {
+ :role_ids => [],
+ :user_ids => [7, 8, 9]
+ }
+ },
+ :xhr => true
assert_response :success
assert_equal 'text/javascript', response.content_type
end
@@ -111,19 +156,30 @@ class MembersControllerTest < Redmine::ControllerTest
end
def test_edit
- get :edit, :id => 2
+ get :edit, :params => {
+ :id => 2
+ }
assert_response :success
assert_select 'input[name=?][value=?][checked=checked]', 'membership[role_ids][]', '2'
end
def test_xhr_edit
- xhr :get, :edit, :id => 2
+ get :edit, :params => {
+ :id => 2
+ },
+ :xhr => true
assert_response :success
end
def test_update
assert_no_difference 'Member.count' do
- put :update, :id => 2, :membership => {:role_ids => [1], :user_id => 3}
+ put :update, :params => {
+ :id => 2,
+ :membership => {
+ :role_ids => [1],
+ :user_id => 3
+ }
+ }
end
assert_redirected_to '/projects/ecookbook/settings/members'
end
@@ -131,7 +187,12 @@ class MembersControllerTest < Redmine::ControllerTest
def test_update_locked_member_should_be_allowed
User.find(3).lock!
- put :update, :id => 2, :membership => {:role_ids => [1]}
+ put :update, :params => {
+ :id => 2,
+ :membership => {
+ :role_ids => [1]
+ }
+ }
assert_response 302
member = Member.find(2)
assert member.user.locked?
@@ -144,7 +205,12 @@ class MembersControllerTest < Redmine::ControllerTest
role.managed_roles = Role.where(:id => [2, 3]).to_a
member = Member.create!(:user => User.find(9), :role_ids => [3], :project_id => 1)
- put :update, :id => member.id, :membership => {:role_ids => [1, 2, 3]}
+ put :update, :params => {
+ :id => member.id,
+ :membership => {
+ :role_ids => [1, 2, 3]
+ }
+ }
assert_equal [2, 3], member.reload.role_ids.sort
end
@@ -154,13 +220,25 @@ class MembersControllerTest < Redmine::ControllerTest
role.managed_roles = Role.where(:id => [2, 3]).to_a
member = Member.create!(:user => User.find(9), :role_ids => [1, 3], :project_id => 1)
- put :update, :id => member.id, :membership => {:role_ids => [2]}
+ put :update, :params => {
+ :id => member.id,
+ :membership => {
+ :role_ids => [2]
+ }
+ }
assert_equal [1, 2], member.reload.role_ids.sort
end
def test_xhr_update
assert_no_difference 'Member.count' do
- xhr :put, :update, :id => 2, :membership => {:role_ids => [1], :user_id => 3}
+ put :update, :params => {
+ :id => 2,
+ :membership => {
+ :role_ids => [1],
+ :user_id => 3
+ }
+ },
+ :xhr => true
assert_response :success
assert_equal 'text/javascript', response.content_type
end
@@ -172,7 +250,9 @@ class MembersControllerTest < Redmine::ControllerTest
def test_destroy
assert_difference 'Member.count', -1 do
- delete :destroy, :id => 2
+ delete :destroy, :params => {
+ :id => 2
+ }
end
assert_redirected_to '/projects/ecookbook/settings/members'
assert !User.find(3).member_of?(Project.find(1))
@@ -182,7 +262,9 @@ class MembersControllerTest < Redmine::ControllerTest
assert User.find(3).lock!
assert_difference 'Member.count', -1 do
- delete :destroy, :id => 2
+ delete :destroy, :params => {
+ :id => 2
+ }
end
end
@@ -193,7 +275,9 @@ class MembersControllerTest < Redmine::ControllerTest
member = Member.create!(:user => User.find(9), :role_ids => [1, 3], :project_id => 1)
assert_no_difference 'Member.count' do
- delete :destroy, :id => member.id
+ delete :destroy, :params => {
+ :id => member.id
+ }
end
end
@@ -204,13 +288,18 @@ class MembersControllerTest < Redmine::ControllerTest
member = Member.create!(:user => User.find(9), :role_ids => [3], :project_id => 1)
assert_difference 'Member.count', -1 do
- delete :destroy, :id => member.id
+ delete :destroy, :params => {
+ :id => member.id
+ }
end
end
def test_xhr_destroy
assert_difference 'Member.count', -1 do
- xhr :delete, :destroy, :id => 2
+ delete :destroy, :params => {
+ :id => 2
+ },
+ :xhr => true
assert_response :success
assert_equal 'text/javascript', response.content_type
end
@@ -219,7 +308,12 @@ class MembersControllerTest < Redmine::ControllerTest
end
def test_autocomplete
- xhr :get, :autocomplete, :project_id => 1, :q => 'mis', :format => 'js'
+ get :autocomplete, :params => {
+ :project_id => 1,
+ :q => 'mis',
+ :format => 'js'
+ },
+ :xhr => true
assert_response :success
assert_include 'User Misc', response.body
end
diff --git a/test/functional/messages_controller_test.rb b/test/functional/messages_controller_test.rb
index 7609f4052..d47e41bc0 100644
--- a/test/functional/messages_controller_test.rb
+++ b/test/functional/messages_controller_test.rb
@@ -25,7 +25,10 @@ class MessagesControllerTest < Redmine::ControllerTest
end
def test_show
- get :show, :board_id => 1, :id => 1
+ get :show, :params => {
+ :board_id => 1,
+ :id => 1
+ }
assert_response :success
assert_select 'h2', :text => 'First post'
@@ -33,7 +36,10 @@ class MessagesControllerTest < Redmine::ControllerTest
def test_show_should_contain_reply_field_tags_for_quoting
@request.session[:user_id] = 2
- get :show, :board_id => 1, :id => 1
+ get :show, :params => {
+ :board_id => 1,
+ :id => 1
+ }
assert_response :success
# tags required by MessagesController#quote
@@ -54,7 +60,11 @@ class MessagesControllerTest < Redmine::ControllerTest
end
reply_ids = message.children.map(&:id).sort
- get :show, :board_id => 1, :id => 1, :r => reply_ids.last
+ get :show, :params => {
+ :board_id => 1,
+ :id => 1,
+ :r => reply_ids.last
+ }
assert_response :success
assert_select 'a[href=?]', "/boards/1/topics/1?r=#{reply_ids.last}#message-#{reply_ids.last}"
@@ -63,25 +73,36 @@ class MessagesControllerTest < Redmine::ControllerTest
def test_show_with_reply_permission
@request.session[:user_id] = 2
- get :show, :board_id => 1, :id => 1
+ get :show, :params => {
+ :board_id => 1,
+ :id => 1
+ }
assert_response :success
assert_select 'div#reply textarea#message_content'
end
def test_show_message_not_found
- get :show, :board_id => 1, :id => 99999
+ get :show, :params => {
+ :board_id => 1,
+ :id => 99999
+ }
assert_response 404
end
def test_show_message_from_invalid_board_should_respond_with_404
- get :show, :board_id => 999, :id => 1
+ get :show, :params => {
+ :board_id => 999,
+ :id => 1
+ }
assert_response 404
end
def test_get_new
@request.session[:user_id] = 2
- get :new, :board_id => 1
+ get :new, :params => {
+ :board_id => 1
+ }
assert_response :success
assert_select 'input[name=?]', 'message[subject]'
@@ -89,7 +110,9 @@ class MessagesControllerTest < Redmine::ControllerTest
def test_get_new_with_invalid_board
@request.session[:user_id] = 2
- get :new, :board_id => 99
+ get :new, :params => {
+ :board_id => 99
+ }
assert_response 404
end
@@ -98,9 +121,13 @@ class MessagesControllerTest < Redmine::ControllerTest
ActionMailer::Base.deliveries.clear
with_settings :notified_events => %w(message_posted) do
- post :new, :board_id => 1,
- :message => { :subject => 'Test created message',
- :content => 'Message body'}
+ post :new, :params => {
+ :board_id => 1,
+ :message => {
+ :subject => 'Test created message',
+ :content => 'Message body'
+ }
+ }
end
message = Message.find_by_subject('Test created message')
assert_not_nil message
@@ -121,7 +148,10 @@ class MessagesControllerTest < Redmine::ControllerTest
def test_get_edit
@request.session[:user_id] = 2
- get :edit, :board_id => 1, :id => 1
+ get :edit, :params => {
+ :board_id => 1,
+ :id => 1
+ }
assert_response :success
assert_select 'input[name=?][value=?]', 'message[subject]', 'First post'
@@ -129,9 +159,14 @@ class MessagesControllerTest < Redmine::ControllerTest
def test_post_edit
@request.session[:user_id] = 2
- post :edit, :board_id => 1, :id => 1,
- :message => { :subject => 'New subject',
- :content => 'New body'}
+ post :edit, :params => {
+ :board_id => 1,
+ :id => 1,
+ :message => {
+ :subject => 'New subject',
+ :content => 'New body'
+ }
+ }
assert_redirected_to '/boards/1/topics/1'
message = Message.find(1)
assert_equal 'New subject', message.subject
@@ -140,11 +175,16 @@ class MessagesControllerTest < Redmine::ControllerTest
def test_post_edit_sticky_and_locked
@request.session[:user_id] = 2
- post :edit, :board_id => 1, :id => 1,
- :message => { :subject => 'New subject',
- :content => 'New body',
- :locked => '1',
- :sticky => '1'}
+ post :edit, :params => {
+ :board_id => 1,
+ :id => 1,
+ :message => {
+ :subject => 'New subject',
+ :content => 'New body',
+ :locked => '1',
+ :sticky => '1'
+ }
+ }
assert_redirected_to '/boards/1/topics/1'
message = Message.find(1)
assert_equal true, message.sticky?
@@ -153,10 +193,15 @@ class MessagesControllerTest < Redmine::ControllerTest
def test_post_edit_should_allow_to_change_board
@request.session[:user_id] = 2
- post :edit, :board_id => 1, :id => 1,
- :message => { :subject => 'New subject',
- :content => 'New body',
- :board_id => 2}
+ post :edit, :params => {
+ :board_id => 1,
+ :id => 1,
+ :message => {
+ :subject => 'New subject',
+ :content => 'New body',
+ :board_id => 2
+ }
+ }
assert_redirected_to '/boards/2/topics/1'
message = Message.find(1)
assert_equal Board.find(2), message.board
@@ -164,7 +209,14 @@ class MessagesControllerTest < Redmine::ControllerTest
def test_reply
@request.session[:user_id] = 2
- post :reply, :board_id => 1, :id => 1, :reply => { :content => 'This is a test reply', :subject => 'Test reply' }
+ post :reply, :params => {
+ :board_id => 1,
+ :id => 1,
+ :reply => {
+ :content => 'This is a test reply',
+ :subject => 'Test reply'
+ }
+ }
reply = Message.order('id DESC').first
assert_redirected_to "/boards/1/topics/1?r=#{reply.id}"
assert Message.find_by_subject('Test reply')
@@ -173,7 +225,10 @@ class MessagesControllerTest < Redmine::ControllerTest
def test_destroy_topic
@request.session[:user_id] = 2
assert_difference 'Message.count', -3 do
- post :destroy, :board_id => 1, :id => 1
+ post :destroy, :params => {
+ :board_id => 1,
+ :id => 1
+ }
end
assert_redirected_to '/projects/ecookbook/boards/1'
assert_nil Message.find_by_id(1)
@@ -182,7 +237,10 @@ class MessagesControllerTest < Redmine::ControllerTest
def test_destroy_reply
@request.session[:user_id] = 2
assert_difference 'Message.count', -1 do
- post :destroy, :board_id => 1, :id => 2
+ post :destroy, :params => {
+ :board_id => 1,
+ :id => 2
+ }
end
assert_redirected_to '/boards/1/topics/1?r=2'
assert_nil Message.find_by_id(2)
@@ -190,7 +248,11 @@ class MessagesControllerTest < Redmine::ControllerTest
def test_quote
@request.session[:user_id] = 2
- xhr :get, :quote, :board_id => 1, :id => 3
+ get :quote, :params => {
+ :board_id => 1,
+ :id => 3
+ },
+ :xhr => true
assert_response :success
assert_equal 'text/javascript', response.content_type
@@ -200,19 +262,27 @@ class MessagesControllerTest < Redmine::ControllerTest
def test_preview_new
@request.session[:user_id] = 2
- post :preview,
- :board_id => 1,
- :message => {:subject => "", :content => "Previewed text"}
+ post :preview, :params => {
+ :board_id => 1,
+ :message => {
+ :subject => "",
+ :content => "Previewed text"
+ }
+ }
assert_response :success
assert_include 'Previewed text', response.body
end
def test_preview_edit
@request.session[:user_id] = 2
- post :preview,
- :id => 4,
- :board_id => 1,
- :message => {:subject => "", :content => "Previewed text"}
+ post :preview, :params => {
+ :id => 4,
+ :board_id => 1,
+ :message => {
+ :subject => "",
+ :content => "Previewed text"
+ }
+ }
assert_response :success
assert_include 'Previewed text', response.body
end
diff --git a/test/functional/my_controller_test.rb b/test/functional/my_controller_test.rb
index c35ff9043..19bad27ef 100644
--- a/test/functional/my_controller_test.rb
+++ b/test/functional/my_controller_test.rb
@@ -238,13 +238,17 @@ class MyControllerTest < Redmine::ControllerTest
end
def test_update_account
- post :account,
- :user => {
- :firstname => "Joe",
- :login => "root",
- :admin => 1,
- :group_ids => ['10'],
- :custom_field_values => {"4" => "0100562500"}
+ post :account, :params => {
+ :user => {
+ :firstname => "Joe",
+ :login => "root",
+ :admin => 1,
+ :group_ids => ['10'],
+ :custom_field_values => {
+ "4" => "0100562500"
+ }
+
+ }
}
assert_redirected_to '/my/account'
@@ -259,9 +263,11 @@ class MyControllerTest < Redmine::ControllerTest
def test_update_account_should_send_security_notification
ActionMailer::Base.deliveries.clear
- post :account,
- :user => {
- :mail => 'foobar@example.com'
+ post :account, :params => {
+ :user => {
+ :mail => 'foobar@example.com'
+
+ }
}
assert_not_nil (mail = ActionMailer::Base.deliveries.last)
@@ -297,7 +303,9 @@ class MyControllerTest < Redmine::ControllerTest
def test_post_destroy_without_confirmation_should_destroy_account
assert_difference 'User.count', -1 do
- post :destroy, :confirm => '1'
+ post :destroy, :params => {
+ :confirm => '1'
+ }
end
assert_redirected_to '/'
assert_match /deleted/i, flash[:notice]
@@ -307,7 +315,9 @@ class MyControllerTest < Redmine::ControllerTest
User.any_instance.stubs(:own_account_deletable?).returns(false)
assert_no_difference 'User.count' do
- post :destroy, :confirm => '1'
+ post :destroy, :params => {
+ :confirm => '1'
+ }
end
assert_redirected_to '/my/account'
end
@@ -321,17 +331,21 @@ class MyControllerTest < Redmine::ControllerTest
end
def test_update_password
- post :password, :password => 'jsmith',
- :new_password => 'secret123',
- :new_password_confirmation => 'secret123'
+ post :password, :params => {
+ :password => 'jsmith',
+ :new_password => 'secret123',
+ :new_password_confirmation => 'secret123'
+ }
assert_redirected_to '/my/account'
assert User.try_to_login('jsmith', 'secret123')
end
def test_update_password_with_non_matching_confirmation
- post :password, :password => 'jsmith',
- :new_password => 'secret123',
- :new_password_confirmation => 'secret1234'
+ post :password, :params => {
+ :password => 'jsmith',
+ :new_password => 'secret123',
+ :new_password_confirmation => 'secret1234'
+ }
assert_response :success
assert_select_error /Password doesn.*t match confirmation/
assert User.try_to_login('jsmith', 'jsmith')
@@ -339,9 +353,11 @@ class MyControllerTest < Redmine::ControllerTest
def test_update_password_with_wrong_password
# wrong password
- post :password, :password => 'wrongpassword',
- :new_password => 'secret123',
- :new_password_confirmation => 'secret123'
+ post :password, :params => {
+ :password => 'wrongpassword',
+ :new_password => 'secret123',
+ :new_password_confirmation => 'secret123'
+ }
assert_response :success
assert_equal 'Wrong password', flash[:error]
assert User.try_to_login('jsmith', 'jsmith')
@@ -357,9 +373,11 @@ class MyControllerTest < Redmine::ControllerTest
def test_update_password_should_send_security_notification
ActionMailer::Base.deliveries.clear
- post :password, :password => 'jsmith',
- :new_password => 'secret123',
- :new_password_confirmation => 'secret123'
+ post :password, :params => {
+ :password => 'jsmith',
+ :new_password => 'secret123',
+ :new_password_confirmation => 'secret123'
+ }
assert_not_nil (mail = ActionMailer::Base.deliveries.last)
assert_mail_body_no_match 'secret123', mail # just to be sure: pw should never be sent!
@@ -372,7 +390,13 @@ class MyControllerTest < Redmine::ControllerTest
user = User.generate!(:language => 'en')
@request.session[:user_id] = user.id
- xhr :post, :update_page, :settings => {'issuesassignedtome' => {'columns' => ['subject', 'due_date']}}
+ post :update_page, :params => {
+ :settings => {
+ 'issuesassignedtome' => {
+ 'columns' => ['subject', 'due_date']}
+ }
+ },
+ :xhr => true
assert_response :success
assert_include '$("#block-issuesassignedtome").replaceWith(', response.body
assert_include 'Due date', response.body
@@ -381,30 +405,42 @@ class MyControllerTest < Redmine::ControllerTest
end
def test_add_block
- post :add_block, :block => 'issueswatched'
+ post :add_block, :params => {
+ :block => 'issueswatched'
+ }
assert_redirected_to '/my/page'
assert User.find(2).pref[:my_page_layout]['top'].include?('issueswatched')
end
def test_add_block_xhr
- xhr :post, :add_block, :block => 'issueswatched'
+ post :add_block, :params => {
+ :block => 'issueswatched'
+ },
+ :xhr => true
assert_response :success
assert_include 'issueswatched', User.find(2).pref[:my_page_layout]['top']
end
def test_add_invalid_block_should_error
- post :add_block, :block => 'invalid'
+ post :add_block, :params => {
+ :block => 'invalid'
+ }
assert_response 422
end
def test_remove_block
- post :remove_block, :block => 'issuesassignedtome'
+ post :remove_block, :params => {
+ :block => 'issuesassignedtome'
+ }
assert_redirected_to '/my/page'
assert !User.find(2).pref[:my_page_layout].values.flatten.include?('issuesassignedtome')
end
def test_remove_block_xhr
- xhr :post, :remove_block, :block => 'issuesassignedtome'
+ post :remove_block, :params => {
+ :block => 'issuesassignedtome'
+ },
+ :xhr => true
assert_response :success
assert_include '$("#block-issuesassignedtome").remove();', response.body
assert !User.find(2).pref[:my_page_layout].values.flatten.include?('issuesassignedtome')
@@ -415,7 +451,11 @@ class MyControllerTest < Redmine::ControllerTest
pref.my_page_layout = {'left' => ['news', 'calendar','documents']}
pref.save!
- xhr :post, :order_blocks, :group => 'left', :blocks => ['documents', 'calendar', 'news']
+ post :order_blocks, :params => {
+ :group => 'left',
+ :blocks => ['documents', 'calendar', 'news']
+ },
+ :xhr => true
assert_response :success
assert_equal ['documents', 'calendar', 'news'], User.find(2).pref.my_page_layout['left']
end
@@ -425,7 +465,11 @@ class MyControllerTest < Redmine::ControllerTest
pref.my_page_layout = {'left' => ['news','documents'], 'right' => ['calendar']}
pref.save!
- xhr :post, :order_blocks, :group => 'left', :blocks => ['news', 'calendar', 'documents']
+ post :order_blocks, :params => {
+ :group => 'left',
+ :blocks => ['news', 'calendar', 'documents']
+ },
+ :xhr => true
assert_response :success
assert_equal({'left' => ['news', 'calendar', 'documents'], 'right' => []}, User.find(2).pref.my_page_layout)
end
diff --git a/test/functional/news_controller_test.rb b/test/functional/news_controller_test.rb
index 6ef39317a..8cb9d86bb 100644
--- a/test/functional/news_controller_test.rb
+++ b/test/functional/news_controller_test.rb
@@ -33,18 +33,24 @@ class NewsControllerTest < Redmine::ControllerTest
end
def test_index_with_project
- get :index, :project_id => 1
+ get :index, :params => {
+ :project_id => 1
+ }
assert_response :success
assert_select 'h3 a', :text => 'eCookbook first release !'
end
def test_index_with_invalid_project_should_respond_with_404
- get :index, :project_id => 999
+ get :index, :params => {
+ :project_id => 999
+ }
assert_response 404
end
def test_show
- get :show, :id => 1
+ get :show, :params => {
+ :id => 1
+ }
assert_response :success
assert_select 'h2', :text => 'eCookbook first release !'
end
@@ -54,7 +60,9 @@ class NewsControllerTest < Redmine::ControllerTest
attachment.container = News.find(1)
attachment.save!
- get :show, :id => 1
+ get :show, :params => {
+ :id => 1
+ }
assert_response :success
assert_select 'a', :text => attachment.filename
end
@@ -65,7 +73,9 @@ class NewsControllerTest < Redmine::ControllerTest
user.pref.save!
@request.session[:user_id] = 1
- get :show, :id => 1
+ get :show, :params => {
+ :id => 1
+ }
assert_response :success
comments = css_select('#comments .wiki').map(&:text).map(&:strip)
@@ -73,13 +83,17 @@ class NewsControllerTest < Redmine::ControllerTest
end
def test_show_not_found
- get :show, :id => 999
+ get :show, :params => {
+ :id => 999
+ }
assert_response 404
end
def test_get_new
@request.session[:user_id] = 2
- get :new, :project_id => 1
+ get :new, :params => {
+ :project_id => 1
+ }
assert_response :success
assert_select 'input[name=?]', 'news[title]'
end
@@ -89,9 +103,14 @@ class NewsControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
with_settings :notified_events => %w(news_added) do
- post :create, :project_id => 1, :news => { :title => 'NewsControllerTest',
- :description => 'This is the description',
- :summary => '' }
+ post :create, :params => {
+ :project_id => 1,
+ :news => {
+ :title => 'NewsControllerTest',
+ :description => 'This is the description',
+ :summary => ''
+ }
+ }
end
assert_redirected_to '/projects/ecookbook/news'
@@ -108,9 +127,17 @@ class NewsControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_difference 'News.count' do
assert_difference 'Attachment.count' do
- post :create, :project_id => 1,
- :news => { :title => 'Test', :description => 'This is the description' },
- :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}}
+ post :create, :params => {
+ :project_id => 1,
+ :news => {
+ :title => 'Test',
+ :description => 'This is the description'
+ },
+ :attachments => {
+ '1' => {
+ 'file' => uploaded_test_file('testfile.txt', 'text/plain')}
+ }
+ }
end
end
attachment = Attachment.order('id DESC').first
@@ -120,23 +147,35 @@ class NewsControllerTest < Redmine::ControllerTest
def test_post_create_with_validation_failure
@request.session[:user_id] = 2
- post :create, :project_id => 1, :news => { :title => '',
- :description => 'This is the description',
- :summary => '' }
+ post :create, :params => {
+ :project_id => 1,
+ :news => {
+ :title => '',
+ :description => 'This is the description',
+ :summary => ''
+ }
+ }
assert_response :success
assert_select_error /title cannot be blank/i
end
def test_get_edit
@request.session[:user_id] = 2
- get :edit, :id => 1
+ get :edit, :params => {
+ :id => 1
+ }
assert_response :success
assert_select 'input[name=?][value=?]', 'news[title]', 'eCookbook first release !'
end
def test_put_update
@request.session[:user_id] = 2
- put :update, :id => 1, :news => { :description => 'Description changed by test_post_edit' }
+ put :update, :params => {
+ :id => 1,
+ :news => {
+ :description => 'Description changed by test_post_edit'
+ }
+ }
assert_redirected_to '/news/1'
news = News.find(1)
assert_equal 'Description changed by test_post_edit', news.description
@@ -147,9 +186,16 @@ class NewsControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_no_difference 'News.count' do
assert_difference 'Attachment.count' do
- put :update, :id => 1,
- :news => { :description => 'This is the description' },
- :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}}
+ put :update, :params => {
+ :id => 1,
+ :news => {
+ :description => 'This is the description'
+ },
+ :attachments => {
+ '1' => {
+ 'file' => uploaded_test_file('testfile.txt', 'text/plain')}
+ }
+ }
end
end
attachment = Attachment.order('id DESC').first
@@ -158,14 +204,21 @@ class NewsControllerTest < Redmine::ControllerTest
def test_update_with_failure
@request.session[:user_id] = 2
- put :update, :id => 1, :news => { :description => '' }
+ put :update, :params => {
+ :id => 1,
+ :news => {
+ :description => ''
+ }
+ }
assert_response :success
assert_select_error /description cannot be blank/i
end
def test_destroy
@request.session[:user_id] = 2
- delete :destroy, :id => 1
+ delete :destroy, :params => {
+ :id => 1
+ }
assert_redirected_to '/projects/ecookbook/news'
assert_nil News.find_by_id(1)
end
diff --git a/test/functional/previews_controller_test.rb b/test/functional/previews_controller_test.rb
index e75a670fe..231d9519d 100644
--- a/test/functional/previews_controller_test.rb
+++ b/test/functional/previews_controller_test.rb
@@ -30,7 +30,12 @@ class PreviewsControllerTest < Redmine::ControllerTest
def test_preview_new_issue
@request.session[:user_id] = 2
- post :issue, :project_id => '1', :issue => {:description => 'Foo'}
+ post :issue, :params => {
+ :project_id => '1',
+ :issue => {
+ :description => 'Foo'
+ }
+ }
assert_response :success
assert_select 'fieldset' do
assert_select 'legend', :text => 'Description'
@@ -40,8 +45,14 @@ class PreviewsControllerTest < Redmine::ControllerTest
def test_preview_issue_notes_with_no_change_to_description
@request.session[:user_id] = 2
- post :issue, :project_id => '1', :id => 1,
- :issue => {:description => Issue.find(1).description, :notes => 'Foo'}
+ post :issue, :params => {
+ :project_id => '1',
+ :id => 1,
+ :issue => {
+ :description => Issue.find(1).description,
+ :notes => 'Foo'
+ }
+ }
assert_response :success
assert_select 'legend', :text => 'Description', :count => 0
assert_select 'legend', :text => 'Notes'
@@ -49,8 +60,14 @@ class PreviewsControllerTest < Redmine::ControllerTest
def test_preview_issue_notes_with_change_to_description
@request.session[:user_id] = 2
- post :issue, :project_id => '1', :id => 1,
- :issue => {:description => 'Changed description', :notes => 'Foo'}
+ post :issue, :params => {
+ :project_id => '1',
+ :id => 1,
+ :issue => {
+ :description => 'Changed description',
+ :notes => 'Foo'
+ }
+ }
assert_response :success
assert_select 'legend', :text => 'Description'
assert_select 'legend', :text => 'Notes'
@@ -58,7 +75,13 @@ class PreviewsControllerTest < Redmine::ControllerTest
def test_preview_journal_notes_for_update
@request.session[:user_id] = 2
- post :issue, :project_id => '1', :id => 1, :journal => {:notes => 'Foo'}
+ post :issue, :params => {
+ :project_id => '1',
+ :id => 1,
+ :journal => {
+ :notes => 'Foo'
+ }
+ }
assert_response :success
assert_select 'legend', :text => 'Notes'
assert_select 'p', :text => 'Foo'
@@ -67,32 +90,54 @@ class PreviewsControllerTest < Redmine::ControllerTest
def test_preview_issue_notes_should_support_links_to_existing_attachments
Attachment.generate!(:container => Issue.find(1), :filename => 'foo.bar')
@request.session[:user_id] = 2
- post :issue, :project_id => '1', :id => 1, :issue => {:notes => 'attachment:foo.bar'}
+ post :issue, :params => {
+ :project_id => '1',
+ :id => 1,
+ :issue => {
+ :notes => 'attachment:foo.bar'
+ }
+ }
assert_response :success
assert_select 'a.attachment', :text => 'foo.bar'
end
def test_preview_issue_with_project_changed
@request.session[:user_id] = 2
- post :issue, :project_id => '1', :id => 1, :issue => {:notes => 'notes', :project_id => 2}
+ post :issue, :params => {
+ :project_id => '1',
+ :id => 1,
+ :issue => {
+ :notes => 'notes',
+ :project_id => 2
+ }
+ }
assert_response :success
assert_select 'legend', :text => 'Notes'
end
def test_preview_new_news
- get :news, :project_id => 1,
- :news => {:title => '',
- :description => 'News description',
- :summary => ''}
+ get :news, :params => {
+ :project_id => 1,
+ :news => {
+ :title => '',
+ :description => 'News description',
+ :summary => ''
+ }
+ }
assert_response :success
assert_select 'fieldset.preview', :text => /News description/
end
def test_preview_existing_news
- get :news, :project_id => 1, :id => 2,
- :news => {:title => '',
- :description => 'News description',
- :summary => ''}
+ get :news, :params => {
+ :project_id => 1,
+ :id => 2,
+ :news => {
+ :title => '',
+ :description => 'News description',
+ :summary => ''
+ }
+ }
assert_response :success
assert_select 'fieldset.preview', :text => /News description/
end
diff --git a/test/functional/principal_memberships_controller_test.rb b/test/functional/principal_memberships_controller_test.rb
index ca0b2c53a..753b1e2bb 100644
--- a/test/functional/principal_memberships_controller_test.rb
+++ b/test/functional/principal_memberships_controller_test.rb
@@ -25,7 +25,9 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest
end
def test_new_user_membership
- get :new, :user_id => 7
+ get :new, :params => {
+ :user_id => 7
+ }
assert_response :success
assert_select 'label', :text => 'eCookbook' do
assert_select 'input[name=?][value="1"]:not([disabled])', 'membership[project_ids][]'
@@ -35,7 +37,9 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest
def test_new_user_membership_should_disable_user_projects
Member.create!(:user_id => 7, :project_id => 1, :role_ids => [1])
- get :new, :user_id => 7
+ get :new, :params => {
+ :user_id => 7
+ }
assert_response :success
assert_select 'label', :text => 'eCookbook' do
assert_select 'input[name=?][value="1"][disabled=disabled]', 'membership[project_ids][]'
@@ -43,14 +47,23 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest
end
def test_xhr_new_user_membership
- xhr :get, :new, :user_id => 7
+ get :new, :params => {
+ :user_id => 7
+ },
+ :xhr => true
assert_response :success
assert_equal 'text/javascript', response.content_type
end
def test_create_user_membership
assert_difference 'Member.count' do
- post :create, :user_id => 7, :membership => {:project_ids => [3], :role_ids => [2]}
+ post :create, :params => {
+ :user_id => 7,
+ :membership => {
+ :project_ids => [3],
+ :role_ids => [2]
+ }
+ }
end
assert_redirected_to '/users/7/edit?tab=memberships'
member = Member.order('id DESC').first
@@ -61,7 +74,13 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest
def test_create_user_membership_with_multiple_roles
assert_difference 'Member.count' do
- post :create, :user_id => 7, :membership => {:project_ids => [3], :role_ids => [2, 3]}
+ post :create, :params => {
+ :user_id => 7,
+ :membership => {
+ :project_ids => [3],
+ :role_ids => [2, 3]
+ }
+ }
end
member = Member.order('id DESC').first
assert_equal User.find(7), member.principal
@@ -71,7 +90,13 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest
def test_create_user_membership_with_multiple_projects_and_roles
assert_difference 'Member.count', 2 do
- post :create, :user_id => 7, :membership => {:project_ids => [1, 3], :role_ids => [2, 3]}
+ post :create, :params => {
+ :user_id => 7,
+ :membership => {
+ :project_ids => [1, 3],
+ :role_ids => [2, 3]
+ }
+ }
end
members = Member.order('id DESC').limit(2).sort_by(&:project_id)
assert_equal 1, members[0].project_id
@@ -84,7 +109,15 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest
def test_xhr_create_user_membership
assert_difference 'Member.count' do
- xhr :post, :create, :user_id => 7, :membership => {:project_ids => [3], :role_ids => [2]}, :format => 'js'
+ post :create, :params => {
+ :user_id => 7,
+ :membership => {
+ :project_ids => [3],
+ :role_ids => [2]
+ },
+ :format => 'js'
+ },
+ :xhr => true
assert_response :success
assert_equal 'text/javascript', response.content_type
end
@@ -97,7 +130,14 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest
def test_xhr_create_user_membership_with_failure
assert_no_difference 'Member.count' do
- xhr :post, :create, :user_id => 7, :membership => {:project_ids => [3]}, :format => 'js'
+ post :create, :params => {
+ :user_id => 7,
+ :membership => {
+ :project_ids => [3]
+ },
+ :format => 'js'
+ },
+ :xhr => true
assert_response :success
assert_equal 'text/javascript', response.content_type
end
@@ -106,19 +146,32 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest
end
def test_edit_user_membership
- get :edit, :user_id => 2, :id => 1
+ get :edit, :params => {
+ :user_id => 2,
+ :id => 1
+ }
assert_response :success
assert_select 'input[name=?][value=?][checked=checked]', 'membership[role_ids][]', '1'
end
def test_xhr_edit_user_membership
- xhr :get, :edit, :user_id => 2, :id => 1
+ get :edit, :params => {
+ :user_id => 2,
+ :id => 1
+ },
+ :xhr => true
assert_response :success
end
def test_update_user_membership
assert_no_difference 'Member.count' do
- put :update, :user_id => 2, :id => 1, :membership => {:role_ids => [2]}
+ put :update, :params => {
+ :user_id => 2,
+ :id => 1,
+ :membership => {
+ :role_ids => [2]
+ }
+ }
assert_redirected_to '/users/2/edit?tab=memberships'
end
assert_equal [2], Member.find(1).role_ids
@@ -126,7 +179,15 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest
def test_xhr_update_user_membership
assert_no_difference 'Member.count' do
- xhr :put, :update, :user_id => 2, :id => 1, :membership => {:role_ids => [2]}, :format => 'js'
+ put :update, :params => {
+ :user_id => 2,
+ :id => 1,
+ :membership => {
+ :role_ids => [2]
+ },
+ :format => 'js'
+ },
+ :xhr => true
assert_response :success
assert_equal 'text/javascript', response.content_type
end
@@ -136,7 +197,10 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest
def test_destroy_user_membership
assert_difference 'Member.count', -1 do
- delete :destroy, :user_id => 2, :id => 1
+ delete :destroy, :params => {
+ :user_id => 2,
+ :id => 1
+ }
end
assert_redirected_to '/users/2/edit?tab=memberships'
assert_nil Member.find_by_id(1)
@@ -144,7 +208,11 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest
def test_xhr_destroy_user_membership_js_format
assert_difference 'Member.count', -1 do
- xhr :delete, :destroy, :user_id => 2, :id => 1
+ delete :destroy, :params => {
+ :user_id => 2,
+ :id => 1
+ },
+ :xhr => true
assert_response :success
assert_equal 'text/javascript', response.content_type
end
@@ -153,20 +221,36 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest
end
def test_xhr_new_group_membership
- xhr :get, :new, :group_id => 10
+ get :new, :params => {
+ :group_id => 10
+ },
+ :xhr => true
assert_response :success
assert_equal 'text/javascript', response.content_type
end
def test_create_group_membership
assert_difference 'Group.find(10).members.count' do
- post :create, :group_id => 10, :membership => {:project_ids => [2], :role_ids => ['1', '2']}
+ post :create, :params => {
+ :group_id => 10,
+ :membership => {
+ :project_ids => [2],
+ :role_ids => ['1', '2']
+ }
+ }
end
end
def test_xhr_create_group_membership
assert_difference 'Group.find(10).members.count' do
- xhr :post, :create, :group_id => 10, :membership => {:project_ids => [2], :role_ids => ['1', '2']}
+ post :create, :params => {
+ :group_id => 10,
+ :membership => {
+ :project_ids => [2],
+ :role_ids => ['1', '2']
+ }
+ },
+ :xhr => true
assert_response :success
assert_equal 'text/javascript', response.content_type
end
@@ -175,7 +259,14 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest
def test_xhr_create_group_membership_with_failure
assert_no_difference 'Group.find(10).members.count' do
- xhr :post, :create, :group_id => 10, :membership => {:project_ids => [999], :role_ids => ['1', '2']}
+ post :create, :params => {
+ :group_id => 10,
+ :membership => {
+ :project_ids => [999],
+ :role_ids => ['1', '2']
+ }
+ },
+ :xhr => true
assert_response :success
assert_equal 'text/javascript', response.content_type
end
@@ -184,13 +275,26 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest
def test_update_group_membership
assert_no_difference 'Group.find(10).members.count' do
- put :update, :group_id => 10, :id => 6, :membership => {:role_ids => ['1', '3']}
+ put :update, :params => {
+ :group_id => 10,
+ :id => 6,
+ :membership => {
+ :role_ids => ['1', '3']
+ }
+ }
end
end
def test_xhr_update_group_membership
assert_no_difference 'Group.find(10).members.count' do
- xhr :post, :update, :group_id => 10, :id => 6, :membership => {:role_ids => ['1', '3']}
+ post :update, :params => {
+ :group_id => 10,
+ :id => 6,
+ :membership => {
+ :role_ids => ['1', '3']
+ }
+ },
+ :xhr => true
assert_response :success
assert_equal 'text/javascript', response.content_type
end
@@ -198,13 +302,20 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest
def test_destroy_group_membership
assert_difference 'Group.find(10).members.count', -1 do
- delete :destroy, :group_id => 10, :id => 6
+ delete :destroy, :params => {
+ :group_id => 10,
+ :id => 6
+ }
end
end
def test_xhr_destroy_group_membership
assert_difference 'Group.find(10).members.count', -1 do
- xhr :delete, :destroy, :group_id => 10, :id => 6
+ delete :destroy, :params => {
+ :group_id => 10,
+ :id => 6
+ },
+ :xhr => true
assert_response :success
assert_equal 'text/javascript', response.content_type
end
diff --git a/test/functional/project_enumerations_controller_test.rb b/test/functional/project_enumerations_controller_test.rb
index c098b2b30..81a9d81a7 100644
--- a/test/functional/project_enumerations_controller_test.rb
+++ b/test/functional/project_enumerations_controller_test.rb
@@ -40,12 +40,15 @@ class ProjectEnumerationsControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2 # manager
billable_field = TimeEntryActivityCustomField.find_by_name("Billable")
- put :update, :project_id => 1, :enumerations => {
- "9"=> {"parent_id"=>"9", "custom_field_values"=>{"7" => "1"}, "active"=>"0"}, # Design, De-activate
- "10"=> {"parent_id"=>"10", "custom_field_values"=>{"7"=>"0"}, "active"=>"1"}, # Development, Change custom value
- "14"=>{"parent_id"=>"14", "custom_field_values"=>{"7"=>"1"}, "active"=>"1"}, # Inactive Activity, Activate with custom value
- "11"=>{"parent_id"=>"11", "custom_field_values"=>{"7"=>"1"}, "active"=>"1"} # QA, no changes
- }
+ put :update, :params => {
+ :project_id => 1,
+ :enumerations => {
+ "9"=> {"parent_id"=>"9", "custom_field_values"=> {"7" => "1"}, "active"=>"0"}, # Design, De-activate
+ "10"=> {"parent_id"=>"10", "custom_field_values"=>{"7"=>"0"}, "active"=>"1"}, # Development, Change custom value
+ "14"=>{"parent_id"=>"14", "custom_field_values"=>{"7"=>"1"}, "active"=>"1"}, # Inactive Activity, Activate with custom value
+ "11"=>{"parent_id"=>"11", "custom_field_values"=>{"7"=>"1"}, "active"=>"1"} # QA, no changes
+ }
+ }
assert_response :redirect
assert_redirected_to '/projects/ecookbook/settings/activities'
@@ -105,10 +108,13 @@ class ProjectEnumerationsControllerTest < Redmine::ControllerTest
assert project_activity_two.save
- put :update, :project_id => 1, :enumerations => {
- project_activity.id => {"custom_field_values"=>{"7" => "1"}, "active"=>"0"}, # De-activate
- project_activity_two.id => {"custom_field_values"=>{"7" => "1"}, "active"=>"0"} # De-activate
- }
+ put :update, :params => {
+ :project_id => 1,
+ :enumerations => {
+ project_activity.id => {"custom_field_values"=> {"7" => "1"}, "active"=>"0"}, # De-activate
+ project_activity_two.id => {"custom_field_values"=>{"7" => "1"}, "active"=>"0"} # De-activate
+ }
+ }
assert_response :redirect
assert_redirected_to '/projects/ecookbook/settings/activities'
@@ -132,9 +138,15 @@ class ProjectEnumerationsControllerTest < Redmine::ControllerTest
assert_equal 3, TimeEntry.where(:activity_id => 9, :project_id => 1).count
@request.session[:user_id] = 2 # manager
- put :update, :project_id => 1, :enumerations => {
- "9"=> {"parent_id"=>"9", "custom_field_values"=>{"7" => "1"}, "active"=>"0"} # Design, De-activate
- }
+ put :update, :params => {
+ :project_id => 1,
+ :enumerations => {
+ "9"=> {
+ "parent_id"=>"9", "custom_field_values"=> {
+ "7" => "1"}, "active"=>"0"} # Design, De-activate
+
+ }
+ }
assert_response :redirect
# No more TimeEntries using the system activity
@@ -160,12 +172,15 @@ class ProjectEnumerationsControllerTest < Redmine::ControllerTest
assert_equal 1, TimeEntry.where(:activity_id => 10, :project_id => 1).count
@request.session[:user_id] = 2 # manager
- put :update, :project_id => 1, :enumerations => {
- # Design
- "9"=> {"parent_id"=>"9", "custom_field_values"=>{"7" => "1"}, "active"=>"0"},
- # Development, Change custom value
- "10"=> {"parent_id"=>"10", "custom_field_values"=>{"7"=>"0"}, "active"=>"1"}
- }
+ put :update, :params => {
+ :project_id => 1,
+ :enumerations => {
+ # Design
+ "9"=> {"parent_id"=>"9", "custom_field_values"=>{"7" => "1"}, "active"=>"0"},
+ # Development, Change custom value
+ "10"=> {"parent_id"=>"10", "custom_field_values"=>{"7"=>"0"}, "active"=>"1"}
+ }
+ }
assert_response :redirect
# TimeEntries shouldn't have been reassigned on the failed record
@@ -195,7 +210,9 @@ class ProjectEnumerationsControllerTest < Redmine::ControllerTest
})
assert project_activity_two.save
- delete :destroy, :project_id => 1
+ delete :destroy, :params => {
+ :project_id => 1
+ }
assert_response :redirect
assert_redirected_to '/projects/ecookbook/settings/activities'
@@ -216,7 +233,9 @@ class ProjectEnumerationsControllerTest < Redmine::ControllerTest
update_all("activity_id = '#{project_activity.id}'")
assert_equal 3, TimeEntry.where(:activity_id => project_activity.id,
:project_id => 1).count
- delete :destroy, :project_id => 1
+ delete :destroy, :params => {
+ :project_id => 1
+ }
assert_response :redirect
assert_redirected_to '/projects/ecookbook/settings/activities'
diff --git a/test/functional/projects_controller_test.rb b/test/functional/projects_controller_test.rb
index 92d5f4a56..be79f5e60 100644
--- a/test/functional/projects_controller_test.rb
+++ b/test/functional/projects_controller_test.rb
@@ -46,14 +46,20 @@ class ProjectsControllerTest < Redmine::ControllerTest
end
def test_index_atom
- get :index, :format => 'atom'
+ get :index, :params => {
+ :format => 'atom'
+ }
assert_response :success
assert_select 'feed>title', :text => 'Redmine: Latest projects'
assert_select 'feed>entry', :count => Project.visible(User.current).count
end
def test_autocomplete_js
- xhr :get, :autocomplete, :format => 'js', :q => 'coo'
+ get :autocomplete, :params => {
+ :format => 'js',
+ :q => 'coo'
+ },
+ :xhr => true
assert_response :success
assert_equal 'text/javascript', response.content_type
end
@@ -106,7 +112,9 @@ class ProjectsControllerTest < Redmine::ControllerTest
Role.find(1).add_permission! :add_subprojects
@request.session[:user_id] = 2
- get :new, :parent_id => 'ecookbook'
+ get :new, :params => {
+ :parent_id => 'ecookbook'
+ }
assert_response :success
assert_select 'select[name=?]', 'project[parent_id]' do
@@ -145,18 +153,21 @@ class ProjectsControllerTest < Redmine::ControllerTest
test "#create by admin user should create a new project" do
@request.session[:user_id] = 1
- post :create,
- :project => {
- :name => "blog",
- :description => "weblog",
- :homepage => 'http://weblog',
- :identifier => "blog",
- :is_public => 1,
- :custom_field_values => { '3' => 'Beta' },
- :tracker_ids => ['1', '3'],
- # an issue custom field that is not for all project
- :issue_custom_field_ids => ['9'],
- :enabled_module_names => ['issue_tracking', 'news', 'repository']
+ post :create, :params => {
+ :project => {
+ :name => "blog",
+ :description => "weblog",
+ :homepage => 'http://weblog',
+ :identifier => "blog",
+ :is_public => 1,
+ :custom_field_values => {
+ '3' => 'Beta'
+ },
+ :tracker_ids => ['1', '3'],
+ # an issue custom field that is not for all project
+ :issue_custom_field_ids => ['9'],
+ :enabled_module_names => ['issue_tracking', 'news', 'repository']
+ }
}
assert_redirected_to '/projects/blog/settings'
@@ -177,13 +188,19 @@ class ProjectsControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 1
assert_difference 'Project.count' do
- post :create, :project => { :name => "blog",
- :description => "weblog",
- :identifier => "blog",
- :is_public => 1,
- :custom_field_values => { '3' => 'Beta' },
- :parent_id => 1
- }
+ post :create, :params => {
+ :project => {
+ :name => "blog",
+ :description => "weblog",
+ :identifier => "blog",
+ :is_public => 1,
+ :custom_field_values => {
+ '3' => 'Beta'
+ },
+ :parent_id => 1
+
+ }
+ }
assert_redirected_to '/projects/blog/settings'
end
@@ -196,7 +213,13 @@ class ProjectsControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 1
assert_difference 'Project.count' do
- post :create, :project => {:name => "blog", :identifier => "blog"}, :continue => 'Create and continue'
+ post :create, :params => {
+ :project => {
+ :name => "blog",
+ :identifier => "blog"
+ },
+ :continue => 'Create and continue'
+ }
end
assert_redirected_to '/projects/new'
end
@@ -205,14 +228,20 @@ class ProjectsControllerTest < Redmine::ControllerTest
Role.non_member.add_permission! :add_project
@request.session[:user_id] = 9
- post :create, :project => { :name => "blog",
- :description => "weblog",
- :identifier => "blog",
- :is_public => 1,
- :custom_field_values => { '3' => 'Beta' },
- :tracker_ids => ['1', '3'],
- :enabled_module_names => ['issue_tracking', 'news', 'repository']
- }
+ post :create, :params => {
+ :project => {
+ :name => "blog",
+ :description => "weblog",
+ :identifier => "blog",
+ :is_public => 1,
+ :custom_field_values => {
+ '3' => 'Beta'
+ },
+ :tracker_ids => ['1', '3'],
+ :enabled_module_names => ['issue_tracking', 'news', 'repository']
+
+ }
+ }
assert_redirected_to '/projects/blog/settings'
@@ -234,13 +263,19 @@ class ProjectsControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 9
assert_no_difference 'Project.count' do
- post :create, :project => { :name => "blog",
- :description => "weblog",
- :identifier => "blog",
- :is_public => 1,
- :custom_field_values => { '3' => 'Beta' },
- :parent_id => 1
- }
+ post :create, :params => {
+ :project => {
+ :name => "blog",
+ :description => "weblog",
+ :identifier => "blog",
+ :is_public => 1,
+ :custom_field_values => {
+ '3' => 'Beta'
+ },
+ :parent_id => 1
+
+ }
+ }
end
assert_response :success
assert_select_error /Subproject of is invalid/
@@ -251,13 +286,19 @@ class ProjectsControllerTest < Redmine::ControllerTest
Role.find(1).add_permission! :add_subprojects
@request.session[:user_id] = 2
- post :create, :project => { :name => "blog",
- :description => "weblog",
- :identifier => "blog",
- :is_public => 1,
- :custom_field_values => { '3' => 'Beta' },
- :parent_id => 1
- }
+ post :create, :params => {
+ :project => {
+ :name => "blog",
+ :description => "weblog",
+ :identifier => "blog",
+ :is_public => 1,
+ :custom_field_values => {
+ '3' => 'Beta'
+ },
+ :parent_id => 1
+
+ }
+ }
assert_redirected_to '/projects/blog/settings'
project = Project.find_by_name('blog')
assert_equal 1, project.parent_id
@@ -269,12 +310,18 @@ class ProjectsControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_no_difference 'Project.count' do
- post :create, :project => { :name => "blog",
- :description => "weblog",
- :identifier => "blog",
- :is_public => 1,
- :custom_field_values => { '3' => 'Beta' }
- }
+ post :create, :params => {
+ :project => {
+ :name => "blog",
+ :description => "weblog",
+ :identifier => "blog",
+ :is_public => 1,
+ :custom_field_values => {
+ '3' => 'Beta'
+ }
+
+ }
+ }
end
assert_response :success
assert_select_error /Subproject of is invalid/
@@ -287,13 +334,19 @@ class ProjectsControllerTest < Redmine::ControllerTest
assert !User.find(2).member_of?(Project.find(6))
assert_no_difference 'Project.count' do
- post :create, :project => { :name => "blog",
- :description => "weblog",
- :identifier => "blog",
- :is_public => 1,
- :custom_field_values => { '3' => 'Beta' },
- :parent_id => 6
- }
+ post :create, :params => {
+ :project => {
+ :name => "blog",
+ :description => "weblog",
+ :identifier => "blog",
+ :is_public => 1,
+ :custom_field_values => {
+ '3' => 'Beta'
+ },
+ :parent_id => 6
+
+ }
+ }
end
assert_response :success
assert_select_error /Subproject of is invalid/
@@ -307,20 +360,26 @@ class ProjectsControllerTest < Redmine::ControllerTest
with_settings :new_project_user_role_id => default_role.id.to_s, :default_projects_modules => %w(news files) do
project = new_record(Project) do
- post :create, :project => {
- :name => "blog1",
- :identifier => "blog1",
- :enabled_module_names => ["issue_tracking", "repository"]
+ post :create, :params => {
+ :project => {
+ :name => "blog1",
+ :identifier => "blog1",
+ :enabled_module_names => ["issue_tracking", "repository"]
+
+ }
}
end
assert_equal %w(files news), project.enabled_module_names.sort
default_role.add_permission!(:select_project_modules)
project = new_record(Project) do
- post :create, :project => {
- :name => "blog2",
- :identifier => "blog2",
- :enabled_module_names => ["issue_tracking", "repository"]
+ post :create, :params => {
+ :project => {
+ :name => "blog2",
+ :identifier => "blog2",
+ :enabled_module_names => ["issue_tracking", "repository"]
+
+ }
}
end
assert_equal %w(issue_tracking repository), project.enabled_module_names.sort
@@ -333,9 +392,15 @@ class ProjectsControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_difference 'Project.count' do
- post :create, :project => {
- :name => 'inherited', :identifier => 'inherited', :parent_id => parent.id, :inherit_members => '1'
- }
+ post :create, :params => {
+ :project => {
+ :name => 'inherited',
+ :identifier => 'inherited',
+ :parent_id => parent.id,
+ :inherit_members => '1'
+
+ }
+ }
assert_response 302
end
@@ -350,11 +415,14 @@ class ProjectsControllerTest < Redmine::ControllerTest
with_settings :default_projects_modules => ['issue_tracking', 'repository'] do
@request.session[:user_id] = 1
assert_no_difference 'Project.count' do
- post :create, :project => {
- :name => "blog",
- :identifier => "",
- :enabled_module_names => %w(issue_tracking news)
- }
+ post :create, :params => {
+ :project => {
+ :name => "blog",
+ :identifier => "",
+ :enabled_module_names => %w(issue_tracking news)
+
+ }
+ }
end
assert_response :success
%w(issue_tracking news).each do |mod|
@@ -365,13 +433,17 @@ class ProjectsControllerTest < Redmine::ControllerTest
end
def test_show_by_id
- get :show, :id => 1
+ get :show, :params => {
+ :id => 1
+ }
assert_response :success
assert_select '#header h1', :text => "eCookbook"
end
def test_show_by_identifier
- get :show, :id => 'ecookbook'
+ get :show, :params => {
+ :id => 'ecookbook'
+ }
assert_response :success
assert_select '#header h1', :text => "eCookbook"
end
@@ -381,14 +453,18 @@ class ProjectsControllerTest < Redmine::ControllerTest
p.enabled_module_names = []
p.save!
- get :show, :id => 'ecookbook'
+ get :show, :params => {
+ :id => 'ecookbook'
+ }
assert_response :success
assert_select '#main.nosidebar'
end
def test_show_should_display_visible_custom_fields
ProjectCustomField.find_by_name('Development status').update_attribute :visible, true
- get :show, :id => 'ecookbook'
+ get :show, :params => {
+ :id => 'ecookbook'
+ }
assert_response :success
assert_select 'li', :text => /Development status/
@@ -396,7 +472,9 @@ class ProjectsControllerTest < Redmine::ControllerTest
def test_show_should_not_display_hidden_custom_fields
ProjectCustomField.find_by_name('Development status').update_attribute :visible, false
- get :show, :id => 'ecookbook'
+ get :show, :params => {
+ :id => 'ecookbook'
+ }
assert_response :success
assert_select 'li', :text => /Development status/, :count => 0
@@ -407,7 +485,9 @@ class ProjectsControllerTest < Redmine::ControllerTest
f2 = ProjectCustomField.generate! :field_format => 'list', :possible_values => %w(Baz Qux), :multiple => true
project = Project.generate!(:custom_field_values => {f2.id.to_s => %w(Qux)})
- get :show, :id => project.id
+ get :show, :params => {
+ :id => project.id
+ }
assert_response :success
assert_select 'li', :text => /#{f1.name}/, :count => 0
@@ -417,7 +497,9 @@ class ProjectsControllerTest < Redmine::ControllerTest
def test_show_should_not_display_blank_text_custom_fields
f1 = ProjectCustomField.generate! :field_format => 'text'
- get :show, :id => 1
+ get :show, :params => {
+ :id => 1
+ }
assert_response :success
assert_select 'li', :text => /#{f1.name}/, :count => 0
@@ -426,7 +508,9 @@ class ProjectsControllerTest < Redmine::ControllerTest
def test_show_should_not_fail_when_custom_values_are_nil
project = Project.find_by_identifier('ecookbook')
project.custom_values.first.update_attribute(:value, nil)
- get :show, :id => 'ecookbook'
+ get :show, :params => {
+ :id => 'ecookbook'
+ }
assert_response :success
end
@@ -434,28 +518,36 @@ class ProjectsControllerTest < Redmine::ControllerTest
project = Project.find_by_identifier('ecookbook')
project.archive!
- get :show, :id => 'ecookbook'
+ get :show, :params => {
+ :id => 'ecookbook'
+ }
assert_response 403
assert_select 'p', :text => /archived/
assert_not_include project.name, response.body
end
def test_show_should_not_show_private_subprojects_that_are_not_visible
- get :show, :id => 'ecookbook'
+ get :show, :params => {
+ :id => 'ecookbook'
+ }
assert_response :success
assert_select 'a', :text => /Private child/, :count => 0
end
def test_show_should_show_private_subprojects_that_are_visible
@request.session[:user_id] = 2 # manager who is a member of the private subproject
- get :show, :id => 'ecookbook'
+ get :show, :params => {
+ :id => 'ecookbook'
+ }
assert_response :success
assert_select 'a', :text => /Private child/
end
def test_settings
@request.session[:user_id] = 2 # manager
- get :settings, :id => 1
+ get :settings, :params => {
+ :id => 1
+ }
assert_response :success
assert_select 'input[name=?]', 'project[name]'
@@ -463,7 +555,9 @@ class ProjectsControllerTest < Redmine::ControllerTest
def test_settings_of_subproject
@request.session[:user_id] = 2
- get :settings, :id => 'private-child'
+ get :settings, :params => {
+ :id => 'private-child'
+ }
assert_response :success
assert_select 'input[type=checkbox][name=?]', 'project[inherit_members]'
@@ -473,14 +567,18 @@ class ProjectsControllerTest < Redmine::ControllerTest
Project.find(1).close
@request.session[:user_id] = 2 # manager
- get :settings, :id => 1
+ get :settings, :params => {
+ :id => 1
+ }
assert_response 403
end
def test_settings_should_be_denied_for_anonymous_on_closed_project
Project.find(1).close
- get :settings, :id => 1
+ get :settings, :params => {
+ :id => 1
+ }
assert_response 302
end
@@ -489,7 +587,9 @@ class ProjectsControllerTest < Redmine::ControllerTest
Role.find(1).add_permission! :manage_wiki
@request.session[:user_id] = 2
- get :settings, :id => 1
+ get :settings, :params => {
+ :id => 1
+ }
assert_response :success
assert_select 'form[action=?]', '/projects/ecookbook/wiki' do
@@ -500,7 +600,11 @@ class ProjectsControllerTest < Redmine::ControllerTest
def test_settings_should_accept_version_status_filter
@request.session[:user_id] = 2
- get :settings, :id => 'ecookbook', :tab => 'versions', :version_status => 'locked'
+ get :settings, :params => {
+ :id => 'ecookbook',
+ :tab => 'versions',
+ :version_status => 'locked'
+ }
assert_response :success
assert_select 'select[name=version_status]' do
@@ -516,7 +620,12 @@ class ProjectsControllerTest < Redmine::ControllerTest
def test_settings_should_accept_version_name_filter
@request.session[:user_id] = 2
- get :settings, :id => 'ecookbook', :tab => 'versions', :version_status => '', :version_name => '.1'
+ get :settings, :params => {
+ :id => 'ecookbook',
+ :tab => 'versions',
+ :version_status => '',
+ :version_name => '.1'
+ }
assert_response :success
assert_select 'input[name=version_name][value=?]', '.1'
@@ -534,15 +643,23 @@ class ProjectsControllerTest < Redmine::ControllerTest
assert user.reload.locked?
@request.session[:user_id] = 2
- get :settings, :id => 'ecookbook', :tab => 'members'
+ get :settings, :params => {
+ :id => 'ecookbook',
+ :tab => 'members'
+ }
assert_response :success
assert_select "tr#member-#{member.id}"
end
def test_update
@request.session[:user_id] = 2 # manager
- post :update, :id => 1, :project => {:name => 'Test changed name',
- :issue_custom_field_ids => ['']}
+ post :update, :params => {
+ :id => 1,
+ :project => {
+ :name => 'Test changed name',
+ :issue_custom_field_ids => ['']
+ }
+ }
assert_redirected_to '/projects/ecookbook/settings'
project = Project.find(1)
assert_equal 'Test changed name', project.name
@@ -550,7 +667,12 @@ class ProjectsControllerTest < Redmine::ControllerTest
def test_update_with_failure
@request.session[:user_id] = 2 # manager
- post :update, :id => 1, :project => {:name => ''}
+ post :update, :params => {
+ :id => 1,
+ :project => {
+ :name => ''
+ }
+ }
assert_response :success
assert_select_error /name cannot be blank/i
end
@@ -559,7 +681,12 @@ class ProjectsControllerTest < Redmine::ControllerTest
Project.find(1).close
@request.session[:user_id] = 2 # manager
- post :update, :id => 1, :project => {:name => 'Closed'}
+ post :update, :params => {
+ :id => 1,
+ :project => {
+ :name => 'Closed'
+ }
+ }
assert_response 403
assert_equal 'eCookbook', Project.find(1).name
end
@@ -567,7 +694,12 @@ class ProjectsControllerTest < Redmine::ControllerTest
def test_update_should_be_denied_for_anonymous_on_closed_project
Project.find(1).close
- post :update, :id => 1, :project => {:name => 'Closed'}
+ post :update, :params => {
+ :id => 1,
+ :project => {
+ :name => 'Closed'
+ }
+ }
assert_response 302
assert_equal 'eCookbook', Project.find(1).name
end
@@ -578,7 +710,12 @@ class ProjectsControllerTest < Redmine::ControllerTest
User.add_to_project(user, child, Role.generate!(:permissions => [:edit_project]))
@request.session[:user_id] = user.id
- post :update, :id => child.id, :project => {:name => 'Updated'}
+ post :update, :params => {
+ :id => child.id,
+ :project => {
+ :name => 'Updated'
+ }
+ }
assert_response 302
assert_match /Successful update/, flash[:notice]
end
@@ -587,7 +724,10 @@ class ProjectsControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
Project.find(1).enabled_module_names = ['issue_tracking', 'news']
- post :modules, :id => 1, :enabled_module_names => ['issue_tracking', 'repository', 'documents']
+ post :modules, :params => {
+ :id => 1,
+ :enabled_module_names => ['issue_tracking', 'repository', 'documents']
+ }
assert_redirected_to '/projects/ecookbook/settings/modules'
assert_equal ['documents', 'issue_tracking', 'repository'], Project.find(1).enabled_module_names.sort
end
@@ -596,7 +736,9 @@ class ProjectsControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 1 # admin
assert_no_difference 'Project.count' do
- delete :destroy, :id => 2
+ delete :destroy, :params => {
+ :id => 2
+ }
assert_response :success
end
assert_select '.warning', :text => /Are you sure you want to delete this project/
@@ -606,7 +748,9 @@ class ProjectsControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 1 # admin
assert_no_difference 'Project.count' do
- delete :destroy, :id => 1
+ delete :destroy, :params => {
+ :id => 1
+ }
assert_response :success
end
assert_select 'strong',
@@ -619,7 +763,10 @@ class ProjectsControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 1 # admin
assert_difference 'Project.count', -5 do
- delete :destroy, :id => 1, :confirm => 1
+ delete :destroy, :params => {
+ :id => 1,
+ :confirm => 1
+ }
assert_redirected_to '/admin/projects'
end
assert_nil Project.find_by_id(1)
@@ -627,7 +774,9 @@ class ProjectsControllerTest < Redmine::ControllerTest
def test_archive
@request.session[:user_id] = 1 # admin
- post :archive, :id => 1
+ post :archive, :params => {
+ :id => 1
+ }
assert_redirected_to '/admin/projects'
assert !Project.find(1).active?
end
@@ -635,7 +784,9 @@ class ProjectsControllerTest < Redmine::ControllerTest
def test_archive_with_failure
@request.session[:user_id] = 1
Project.any_instance.stubs(:archive).returns(false)
- post :archive, :id => 1
+ post :archive, :params => {
+ :id => 1
+ }
assert_redirected_to '/admin/projects'
assert_match /project cannot be archived/i, flash[:error]
end
@@ -643,14 +794,18 @@ class ProjectsControllerTest < Redmine::ControllerTest
def test_unarchive
@request.session[:user_id] = 1 # admin
Project.find(1).archive
- post :unarchive, :id => 1
+ post :unarchive, :params => {
+ :id => 1
+ }
assert_redirected_to '/admin/projects'
assert Project.find(1).active?
end
def test_close
@request.session[:user_id] = 2
- post :close, :id => 1
+ post :close, :params => {
+ :id => 1
+ }
assert_redirected_to '/projects/ecookbook'
assert_equal Project::STATUS_CLOSED, Project.find(1).status
end
@@ -658,7 +813,9 @@ class ProjectsControllerTest < Redmine::ControllerTest
def test_reopen
Project.find(1).close
@request.session[:user_id] = 2
- post :reopen, :id => 1
+ post :reopen, :params => {
+ :id => 1
+ }
assert_redirected_to '/projects/ecookbook'
assert Project.find(1).active?
end
@@ -668,7 +825,9 @@ class ProjectsControllerTest < Redmine::ControllerTest
parent = nil
6.times do |i|
p = Project.generate_with_parent!(parent)
- get :show, :id => p
+ get :show, :params => {
+ :id => p
+ }
assert_select '#header h1' do
assert_select 'a', :count => [i, 3].min
end
@@ -681,7 +840,9 @@ class ProjectsControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 1 # admin
orig = Project.find(1)
- get :copy, :id => orig.id
+ get :copy, :params => {
+ :id => orig.id
+ }
assert_response :success
assert_select 'textarea[name=?]', 'project[description]', :text => orig.description
@@ -690,7 +851,9 @@ class ProjectsControllerTest < Redmine::ControllerTest
def test_get_copy_with_invalid_source_should_respond_with_404
@request.session[:user_id] = 1
- get :copy, :id => 99
+ get :copy, :params => {
+ :id => 99
+ }
assert_response 404
end
@@ -700,7 +863,9 @@ class ProjectsControllerTest < Redmine::ControllerTest
source = Project.generate!(:issue_custom_fields => [field1])
@request.session[:user_id] = 1
- get :copy, :id => source.id
+ get :copy, :params => {
+ :id => source.id
+ }
assert_response :success
assert_select 'fieldset#project_issue_custom_fields' do
assert_select 'input[type=checkbox][value=?][checked=checked]', field1.id.to_s
@@ -713,14 +878,17 @@ class ProjectsControllerTest < Redmine::ControllerTest
CustomField.delete_all
assert_difference 'Project.count' do
- post :copy, :id => 1,
- :project => {
- :name => 'Copy',
- :identifier => 'unique-copy',
- :tracker_ids => ['1', '2', '3', ''],
- :enabled_module_names => %w(issue_tracking time_tracking)
- },
- :only => %w(issues versions)
+ post :copy, :params => {
+ :id => 1,
+ :project => {
+ :name => 'Copy',
+ :identifier => 'unique-copy',
+ :tracker_ids => ['1', '2', '3', ''],
+ :enabled_module_names => %w(issue_tracking time_tracking)
+
+ },
+ :only => %w(issues versions)
+ }
end
project = Project.find('unique-copy')
source = Project.find(1)
@@ -733,45 +901,72 @@ class ProjectsControllerTest < Redmine::ControllerTest
def test_post_copy_should_redirect_to_settings_when_successful
@request.session[:user_id] = 1 # admin
- post :copy, :id => 1, :project => {:name => 'Copy', :identifier => 'unique-copy'}
+ post :copy, :params => {
+ :id => 1,
+ :project => {
+ :name => 'Copy',
+ :identifier => 'unique-copy'
+ }
+ }
assert_response :redirect
assert_redirected_to :controller => 'projects', :action => 'settings', :id => 'unique-copy'
end
def test_post_copy_with_failure
@request.session[:user_id] = 1
- post :copy, :id => 1, :project => {:name => 'Copy', :identifier => ''}
+ post :copy, :params => {
+ :id => 1,
+ :project => {
+ :name => 'Copy',
+ :identifier => ''
+ }
+ }
assert_response :success
assert_select_error /Identifier cannot be blank/
end
def test_jump_without_project_id_should_redirect_to_active_tab
- get :index, :jump => 'issues'
+ get :index, :params => {
+ :jump => 'issues'
+ }
assert_redirected_to '/issues'
end
def test_jump_should_not_redirect_to_unknown_tab
- get :index, :jump => 'foobar'
+ get :index, :params => {
+ :jump => 'foobar'
+ }
assert_response :success
end
def test_jump_should_redirect_to_active_tab
- get :show, :id => 1, :jump => 'issues'
+ get :show, :params => {
+ :id => 1,
+ :jump => 'issues'
+ }
assert_redirected_to '/projects/ecookbook/issues'
end
def test_jump_should_not_redirect_to_inactive_tab
- get :show, :id => 3, :jump => 'documents'
+ get :show, :params => {
+ :id => 3,
+ :jump => 'documents'
+ }
assert_response :success
end
def test_jump_should_not_redirect_to_unknown_tab
- get :show, :id => 3, :jump => 'foobar'
+ get :show, :params => {
+ :id => 3,
+ :jump => 'foobar'
+ }
assert_response :success
end
def test_body_should_have_project_css_class
- get :show, :id => 1
+ get :show, :params => {
+ :id => 1
+ }
assert_select 'body.project-ecookbook'
end
end
diff --git a/test/functional/queries_controller_test.rb b/test/functional/queries_controller_test.rb
index cabdab968..8bc42e890 100644
--- a/test/functional/queries_controller_test.rb
+++ b/test/functional/queries_controller_test.rb
@@ -37,7 +37,9 @@ class QueriesControllerTest < Redmine::ControllerTest
def test_new_project_query
@request.session[:user_id] = 2
- get :new, :project_id => 1
+ get :new, :params => {
+ :project_id => 1
+ }
assert_response :success
assert_select 'input[name=?][value="0"][checked=checked]', 'query[visibility]'
@@ -59,26 +61,38 @@ class QueriesControllerTest < Redmine::ControllerTest
def test_new_on_invalid_project
@request.session[:user_id] = 2
- get :new, :project_id => 'invalid'
+ get :new, :params => {
+ :project_id => 'invalid'
+ }
assert_response 404
end
def test_new_time_entry_query
@request.session[:user_id] = 2
- get :new, :project_id => 1, :type => 'TimeEntryQuery'
+ get :new, :params => {
+ :project_id => 1,
+ :type => 'TimeEntryQuery'
+ }
assert_response :success
assert_select 'input[name=type][value=?]', 'TimeEntryQuery'
end
def test_create_project_public_query
@request.session[:user_id] = 2
- post :create,
- :project_id => 'ecookbook',
- :default_columns => '1',
- :f => ["status_id", "assigned_to_id"],
- :op => {"assigned_to_id" => "=", "status_id" => "o"},
- :v => { "assigned_to_id" => ["1"], "status_id" => ["1"]},
- :query => {"name" => "test_new_project_public_query", "visibility" => "2"}
+ post :create, :params => {
+ :project_id => 'ecookbook',
+ :default_columns => '1',
+ :f => ["status_id", "assigned_to_id"],
+ :op => {
+ "assigned_to_id" => "=", "status_id" => "o"
+ },
+ :v => {
+ "assigned_to_id" => ["1"], "status_id" => ["1"]
+ },
+ :query => {
+ "name" => "test_new_project_public_query", "visibility" => "2"
+ }
+ }
q = Query.find_by_name('test_new_project_public_query')
assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook', :query_id => q
@@ -89,13 +103,20 @@ class QueriesControllerTest < Redmine::ControllerTest
def test_create_project_private_query
@request.session[:user_id] = 3
- post :create,
- :project_id => 'ecookbook',
- :default_columns => '1',
- :fields => ["status_id", "assigned_to_id"],
- :operators => {"assigned_to_id" => "=", "status_id" => "o"},
- :values => { "assigned_to_id" => ["1"], "status_id" => ["1"]},
- :query => {"name" => "test_new_project_private_query", "visibility" => "0"}
+ post :create, :params => {
+ :project_id => 'ecookbook',
+ :default_columns => '1',
+ :fields => ["status_id", "assigned_to_id"],
+ :operators => {
+ "assigned_to_id" => "=", "status_id" => "o"
+ },
+ :values => {
+ "assigned_to_id" => ["1"], "status_id" => ["1"]
+ },
+ :query => {
+ "name" => "test_new_project_private_query", "visibility" => "0"
+ }
+ }
q = Query.find_by_name('test_new_project_private_query')
assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook', :query_id => q
@@ -106,13 +127,20 @@ class QueriesControllerTest < Redmine::ControllerTest
def test_create_project_roles_query
@request.session[:user_id] = 2
- post :create,
- :project_id => 'ecookbook',
- :default_columns => '1',
- :fields => ["status_id", "assigned_to_id"],
- :operators => {"assigned_to_id" => "=", "status_id" => "o"},
- :values => { "assigned_to_id" => ["1"], "status_id" => ["1"]},
- :query => {"name" => "test_create_project_roles_query", "visibility" => "1", "role_ids" => ["1", "2", ""]}
+ post :create, :params => {
+ :project_id => 'ecookbook',
+ :default_columns => '1',
+ :fields => ["status_id", "assigned_to_id"],
+ :operators => {
+ "assigned_to_id" => "=", "status_id" => "o"
+ },
+ :values => {
+ "assigned_to_id" => ["1"], "status_id" => ["1"]
+ },
+ :query => {
+ "name" => "test_create_project_roles_query", "visibility" => "1", "role_ids" => ["1", "2", ""]
+ }
+ }
q = Query.find_by_name('test_create_project_roles_query')
assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook', :query_id => q
@@ -122,12 +150,19 @@ class QueriesControllerTest < Redmine::ControllerTest
def test_create_global_private_query_with_custom_columns
@request.session[:user_id] = 3
- post :create,
- :fields => ["status_id", "assigned_to_id"],
- :operators => {"assigned_to_id" => "=", "status_id" => "o"},
- :values => { "assigned_to_id" => ["me"], "status_id" => ["1"]},
- :query => {"name" => "test_new_global_private_query", "visibility" => "0"},
- :c => ["", "tracker", "subject", "priority", "category"]
+ post :create, :params => {
+ :fields => ["status_id", "assigned_to_id"],
+ :operators => {
+ "assigned_to_id" => "=", "status_id" => "o"
+ },
+ :values => {
+ "assigned_to_id" => ["me"], "status_id" => ["1"]
+ },
+ :query => {
+ "name" => "test_new_global_private_query", "visibility" => "0"
+ },
+ :c => ["", "tracker", "subject", "priority", "category"]
+ }
q = Query.find_by_name('test_new_global_private_query')
assert_redirected_to :controller => 'issues', :action => 'index', :project_id => nil, :query_id => q
@@ -139,11 +174,18 @@ class QueriesControllerTest < Redmine::ControllerTest
def test_create_global_query_with_custom_filters
@request.session[:user_id] = 3
- post :create,
- :fields => ["assigned_to_id"],
- :operators => {"assigned_to_id" => "="},
- :values => { "assigned_to_id" => ["me"]},
- :query => {"name" => "test_new_global_query"}
+ post :create, :params => {
+ :fields => ["assigned_to_id"],
+ :operators => {
+ "assigned_to_id" => "="
+ },
+ :values => {
+ "assigned_to_id" => ["me"]
+ },
+ :query => {
+ "name" => "test_new_global_query"
+ }
+ }
q = Query.find_by_name('test_new_global_query')
assert_redirected_to :controller => 'issues', :action => 'index', :project_id => nil, :query_id => q
@@ -155,13 +197,21 @@ class QueriesControllerTest < Redmine::ControllerTest
def test_create_with_sort
@request.session[:user_id] = 1
- post :create,
- :default_columns => '1',
- :operators => {"status_id" => "o"},
- :values => {"status_id" => ["1"]},
- :query => {:name => "test_new_with_sort",
- :visibility => "2",
- :sort_criteria => {"0" => ["due_date", "desc"], "1" => ["tracker", ""]}}
+ post :create, :params => {
+ :default_columns => '1',
+ :operators => {
+ "status_id" => "o"
+ },
+ :values => {
+ "status_id" => ["1"]
+ },
+ :query => {
+ :name => "test_new_with_sort",
+ :visibility => "2",
+ :sort_criteria => {
+ "0" => ["due_date", "desc"], "1" => ["tracker", ""]}
+ }
+ }
query = Query.find_by_name("test_new_with_sort")
assert_not_nil query
@@ -171,7 +221,12 @@ class QueriesControllerTest < Redmine::ControllerTest
def test_create_with_failure
@request.session[:user_id] = 2
assert_no_difference '::Query.count' do
- post :create, :project_id => 'ecookbook', :query => {:name => ''}
+ post :create, :params => {
+ :project_id => 'ecookbook',
+ :query => {
+ :name => ''
+ }
+ }
end
assert_response :success
@@ -181,13 +236,20 @@ class QueriesControllerTest < Redmine::ControllerTest
def test_create_global_query_from_gantt
@request.session[:user_id] = 1
assert_difference 'IssueQuery.count' do
- post :create,
- :gantt => 1,
- :operators => {"status_id" => "o"},
- :values => {"status_id" => ["1"]},
- :query => {:name => "test_create_from_gantt",
- :draw_relations => '1',
- :draw_progress_line => '1'}
+ post :create, :params => {
+ :gantt => 1,
+ :operators => {
+ "status_id" => "o"
+ },
+ :values => {
+ "status_id" => ["1"]
+ },
+ :query => {
+ :name => "test_create_from_gantt",
+ :draw_relations => '1',
+ :draw_progress_line => '1'
+ }
+ }
assert_response 302
end
query = IssueQuery.order('id DESC').first
@@ -199,14 +261,21 @@ class QueriesControllerTest < Redmine::ControllerTest
def test_create_project_query_from_gantt
@request.session[:user_id] = 1
assert_difference 'IssueQuery.count' do
- post :create,
- :project_id => 'ecookbook',
- :gantt => 1,
- :operators => {"status_id" => "o"},
- :values => {"status_id" => ["1"]},
- :query => {:name => "test_create_from_gantt",
- :draw_relations => '0',
- :draw_progress_line => '0'}
+ post :create, :params => {
+ :project_id => 'ecookbook',
+ :gantt => 1,
+ :operators => {
+ "status_id" => "o"
+ },
+ :values => {
+ "status_id" => ["1"]
+ },
+ :query => {
+ :name => "test_create_from_gantt",
+ :draw_relations => '0',
+ :draw_progress_line => '0'
+ }
+ }
assert_response 302
end
query = IssueQuery.order('id DESC').first
@@ -218,9 +287,12 @@ class QueriesControllerTest < Redmine::ControllerTest
def test_create_project_public_query_should_force_private_without_manage_public_queries_permission
@request.session[:user_id] = 3
query = new_record(Query) do
- post :create,
- :project_id => 'ecookbook',
- :query => {"name" => "name", "visibility" => "2"}
+ post :create, :params => {
+ :project_id => 'ecookbook',
+ :query => {
+ "name" => "name", "visibility" => "2"
+ }
+ }
assert_response 302
end
assert_not_nil query.project
@@ -230,9 +302,13 @@ class QueriesControllerTest < Redmine::ControllerTest
def test_create_global_public_query_should_force_private_without_manage_public_queries_permission
@request.session[:user_id] = 3
query = new_record(Query) do
- post :create,
- :project_id => 'ecookbook', :query_is_for_all => '1',
- :query => {"name" => "name", "visibility" => "2"}
+ post :create, :params => {
+ :project_id => 'ecookbook',
+ :query_is_for_all => '1',
+ :query => {
+ "name" => "name", "visibility" => "2"
+ }
+ }
assert_response 302
end
assert_nil query.project
@@ -242,9 +318,12 @@ class QueriesControllerTest < Redmine::ControllerTest
def test_create_project_public_query_with_manage_public_queries_permission
@request.session[:user_id] = 2
query = new_record(Query) do
- post :create,
- :project_id => 'ecookbook',
- :query => {"name" => "name", "visibility" => "2"}
+ post :create, :params => {
+ :project_id => 'ecookbook',
+ :query => {
+ "name" => "name", "visibility" => "2"
+ }
+ }
assert_response 302
end
assert_not_nil query.project
@@ -254,9 +333,13 @@ class QueriesControllerTest < Redmine::ControllerTest
def test_create_global_public_query_should_force_private_with_manage_public_queries_permission
@request.session[:user_id] = 2
query = new_record(Query) do
- post :create,
- :project_id => 'ecookbook', :query_is_for_all => '1',
- :query => {"name" => "name", "visibility" => "2"}
+ post :create, :params => {
+ :project_id => 'ecookbook',
+ :query_is_for_all => '1',
+ :query => {
+ "name" => "name", "visibility" => "2"
+ }
+ }
assert_response 302
end
assert_nil query.project
@@ -266,9 +349,13 @@ class QueriesControllerTest < Redmine::ControllerTest
def test_create_global_public_query_by_admin
@request.session[:user_id] = 1
query = new_record(Query) do
- post :create,
- :project_id => 'ecookbook', :query_is_for_all => '1',
- :query => {"name" => "name", "visibility" => "2"}
+ post :create, :params => {
+ :project_id => 'ecookbook',
+ :query_is_for_all => '1',
+ :query => {
+ "name" => "name", "visibility" => "2"
+ }
+ }
assert_response 302
end
assert_nil query.project
@@ -279,14 +366,21 @@ class QueriesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
q = new_record(TimeEntryQuery) do
- post :create,
- :project_id => 'ecookbook',
- :type => 'TimeEntryQuery',
- :default_columns => '1',
- :f => ["spent_on"],
- :op => {"spent_on" => "="},
- :v => { "spent_on" => ["2016-07-14"]},
- :query => {"name" => "test_new_project_public_query", "visibility" => "2"}
+ post :create, :params => {
+ :project_id => 'ecookbook',
+ :type => 'TimeEntryQuery',
+ :default_columns => '1',
+ :f => ["spent_on"],
+ :op => {
+ "spent_on" => "="
+ },
+ :v => {
+ "spent_on" => ["2016-07-14"]
+ },
+ :query => {
+ "name" => "test_new_project_public_query", "visibility" => "2"
+ }
+ }
end
assert_redirected_to :controller => 'timelog', :action => 'index', :project_id => 'ecookbook', :query_id => q.id
@@ -297,7 +391,9 @@ class QueriesControllerTest < Redmine::ControllerTest
def test_edit_global_public_query
@request.session[:user_id] = 1
- get :edit, :id => 4
+ get :edit, :params => {
+ :id => 4
+ }
assert_response :success
assert_select 'input[name=?][value="2"][checked=checked]', 'query[visibility]'
@@ -306,7 +402,9 @@ class QueriesControllerTest < Redmine::ControllerTest
def test_edit_global_private_query
@request.session[:user_id] = 3
- get :edit, :id => 3
+ get :edit, :params => {
+ :id => 3
+ }
assert_response :success
assert_select 'input[name=?]', 'query[visibility]', 0
@@ -315,7 +413,9 @@ class QueriesControllerTest < Redmine::ControllerTest
def test_edit_project_private_query
@request.session[:user_id] = 3
- get :edit, :id => 2
+ get :edit, :params => {
+ :id => 2
+ }
assert_response :success
assert_select 'input[name=?]', 'query[visibility]', 0
@@ -324,7 +424,9 @@ class QueriesControllerTest < Redmine::ControllerTest
def test_edit_project_public_query
@request.session[:user_id] = 2
- get :edit, :id => 1
+ get :edit, :params => {
+ :id => 1
+ }
assert_response :success
assert_select 'input[name=?][value="2"][checked=checked]', 'query[visibility]'
@@ -333,7 +435,9 @@ class QueriesControllerTest < Redmine::ControllerTest
def test_edit_sort_criteria
@request.session[:user_id] = 1
- get :edit, :id => 5
+ get :edit, :params => {
+ :id => 5
+ }
assert_response :success
assert_select 'select[name=?]', 'query[sort_criteria][0][]' do
@@ -344,19 +448,28 @@ class QueriesControllerTest < Redmine::ControllerTest
def test_edit_invalid_query
@request.session[:user_id] = 2
- get :edit, :id => 99
+ get :edit, :params => {
+ :id => 99
+ }
assert_response 404
end
def test_udpate_global_private_query
@request.session[:user_id] = 3
- put :update,
- :id => 3,
- :default_columns => '1',
- :fields => ["status_id", "assigned_to_id"],
- :operators => {"assigned_to_id" => "=", "status_id" => "o"},
- :values => { "assigned_to_id" => ["me"], "status_id" => ["1"]},
- :query => {"name" => "test_edit_global_private_query", "visibility" => "2"}
+ put :update, :params => {
+ :id => 3,
+ :default_columns => '1',
+ :fields => ["status_id", "assigned_to_id"],
+ :operators => {
+ "assigned_to_id" => "=", "status_id" => "o"
+ },
+ :values => {
+ "assigned_to_id" => ["me"], "status_id" => ["1"]
+ },
+ :query => {
+ "name" => "test_edit_global_private_query", "visibility" => "2"
+ }
+ }
assert_redirected_to :controller => 'issues', :action => 'index', :query_id => 3
q = Query.find_by_name('test_edit_global_private_query')
@@ -367,13 +480,20 @@ class QueriesControllerTest < Redmine::ControllerTest
def test_update_global_public_query
@request.session[:user_id] = 1
- put :update,
- :id => 4,
- :default_columns => '1',
- :fields => ["status_id", "assigned_to_id"],
- :operators => {"assigned_to_id" => "=", "status_id" => "o"},
- :values => { "assigned_to_id" => ["1"], "status_id" => ["1"]},
- :query => {"name" => "test_edit_global_public_query", "visibility" => "2"}
+ put :update, :params => {
+ :id => 4,
+ :default_columns => '1',
+ :fields => ["status_id", "assigned_to_id"],
+ :operators => {
+ "assigned_to_id" => "=", "status_id" => "o"
+ },
+ :values => {
+ "assigned_to_id" => ["1"], "status_id" => ["1"]
+ },
+ :query => {
+ "name" => "test_edit_global_public_query", "visibility" => "2"
+ }
+ }
assert_redirected_to :controller => 'issues', :action => 'index', :query_id => 4
q = Query.find_by_name('test_edit_global_public_query')
@@ -384,28 +504,40 @@ class QueriesControllerTest < Redmine::ControllerTest
def test_update_with_failure
@request.session[:user_id] = 1
- put :update, :id => 4, :query => {:name => ''}
+ put :update, :params => {
+ :id => 4,
+ :query => {
+ :name => ''
+ }
+ }
assert_response :success
assert_select_error /Name cannot be blank/
end
def test_destroy
@request.session[:user_id] = 2
- delete :destroy, :id => 1
+ delete :destroy, :params => {
+ :id => 1
+ }
assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook', :set_filter => 1, :query_id => nil
assert_nil Query.find_by_id(1)
end
def test_backslash_should_be_escaped_in_filters
@request.session[:user_id] = 2
- get :new, :subject => 'foo/bar'
+ get :new, :params => {
+ :subject => 'foo/bar'
+ }
assert_response :success
assert_include 'addFilter("subject", "=", ["foo\/bar"]);', response.body
end
def test_filter_with_project_id_should_return_filter_values
@request.session[:user_id] = 2
- get :filter, :project_id => 1, :name => 'fixed_version_id'
+ get :filter, :params => {
+ :project_id => 1,
+ :name => 'fixed_version_id'
+ }
assert_response :success
assert_equal 'application/json', response.content_type
@@ -415,7 +547,9 @@ class QueriesControllerTest < Redmine::ControllerTest
def test_filter_without_project_id_should_return_filter_values
@request.session[:user_id] = 2
- get :filter, :name => 'fixed_version_id'
+ get :filter, :params => {
+ :name => 'fixed_version_id'
+ }
assert_response :success
assert_equal 'application/json', response.content_type
diff --git a/test/functional/reports_controller_test.rb b/test/functional/reports_controller_test.rb
index 4d999d881..2b8ed911a 100644
--- a/test/functional/reports_controller_test.rb
+++ b/test/functional/reports_controller_test.rb
@@ -28,13 +28,18 @@ class ReportsControllerTest < Redmine::ControllerTest
:versions
def test_get_issue_report
- get :issue_report, :id => 1
+ get :issue_report, :params => {
+ :id => 1
+ }
assert_response :success
end
def test_get_issue_report_details
%w(tracker version priority category assigned_to author subproject).each do |detail|
- get :issue_report_details, :id => 1, :detail => detail
+ get :issue_report_details, :params => {
+ :id => 1,
+ :detail => detail
+ }
assert_response :success
end
end
@@ -46,7 +51,10 @@ class ReportsControllerTest < Redmine::ControllerTest
Issue.generate!(:tracker_id => 1, :status_id => 5)
Issue.generate!(:tracker_id => 2)
- get :issue_report_details, :id => 1, :detail => 'tracker'
+ get :issue_report_details, :params => {
+ :id => 1,
+ :detail => 'tracker'
+ }
assert_select 'table.list tbody :nth-child(1)' do
assert_select 'td', :text => 'Bug'
assert_select ':nth-child(2)', :text => '2' # status:1
@@ -58,7 +66,10 @@ class ReportsControllerTest < Redmine::ControllerTest
end
def test_get_issue_report_details_with_an_invalid_detail
- get :issue_report_details, :id => 1, :detail => 'invalid'
+ get :issue_report_details, :params => {
+ :id => 1,
+ :detail => 'invalid'
+ }
assert_response 404
end
end
diff --git a/test/functional/repositories_bazaar_controller_test.rb b/test/functional/repositories_bazaar_controller_test.rb
index 8938c97a2..e59407703 100644
--- a/test/functional/repositories_bazaar_controller_test.rb
+++ b/test/functional/repositories_bazaar_controller_test.rb
@@ -42,7 +42,10 @@ class RepositoriesBazaarControllerTest < Redmine::ControllerTest
def test_get_new
@request.session[:user_id] = 1
@project.repository.destroy
- get :new, :project_id => 'subproject1', :repository_scm => 'Bazaar'
+ get :new, :params => {
+ :project_id => 'subproject1',
+ :repository_scm => 'Bazaar'
+ }
assert_response :success
assert_select 'select[name=?]', 'repository_scm' do
assert_select 'option[value=?][selected=selected]', 'Bazaar'
@@ -50,7 +53,9 @@ class RepositoriesBazaarControllerTest < Redmine::ControllerTest
end
def test_browse_root
- get :show, :id => PRJ_ID
+ get :show, :params => {
+ :id => PRJ_ID
+ }
assert_response :success
assert_select 'table.entries tbody' do
assert_select 'tr', 2
@@ -60,7 +65,10 @@ class RepositoriesBazaarControllerTest < Redmine::ControllerTest
end
def test_browse_directory
- get :show, :id => PRJ_ID, :path => repository_path_hash(['directory'])[:param]
+ get :show, :params => {
+ :id => PRJ_ID,
+ :path => repository_path_hash(['directory'])[:param]
+ }
assert_response :success
assert_select 'table.entries tbody' do
assert_select 'tr', 3
@@ -71,8 +79,11 @@ class RepositoriesBazaarControllerTest < Redmine::ControllerTest
end
def test_browse_at_given_revision
- get :show, :id => PRJ_ID, :path => repository_path_hash([])[:param],
+ get :show, :params => {
+ :id => PRJ_ID,
+ :path => repository_path_hash([])[:param],
:rev => 3
+ }
assert_response :success
assert_select 'table.entries tbody' do
assert_select 'tr', 4
@@ -84,32 +95,40 @@ class RepositoriesBazaarControllerTest < Redmine::ControllerTest
end
def test_changes
- get :changes, :id => PRJ_ID,
+ get :changes, :params => {
+ :id => PRJ_ID,
:path => repository_path_hash(['doc-mkdir.txt'])[:param]
+ }
assert_response :success
assert_select 'h2', :text => /doc-mkdir.txt/
end
def test_entry_show
- get :entry, :id => PRJ_ID,
+ get :entry, :params => {
+ :id => PRJ_ID,
:path => repository_path_hash(['directory', 'doc-ls.txt'])[:param]
+ }
assert_response :success
# Line 19
assert_select 'tr#L29 td.line-code', :text => /Show help message/
end
def test_entry_download
- get :entry, :id => PRJ_ID,
+ get :entry, :params => {
+ :id => PRJ_ID,
:path => repository_path_hash(['directory', 'doc-ls.txt'])[:param],
:format => 'raw'
+ }
assert_response :success
# File content
assert @response.body.include?('Show help message')
end
def test_directory_entry
- get :entry, :id => PRJ_ID,
+ get :entry, :params => {
+ :id => PRJ_ID,
:path => repository_path_hash(['directory'])[:param]
+ }
assert_response :success
assert_select 'table.entries tbody'
end
@@ -117,7 +136,11 @@ class RepositoriesBazaarControllerTest < Redmine::ControllerTest
def test_diff
# Full diff of changeset 3
['inline', 'sbs'].each do |dt|
- get :diff, :id => PRJ_ID, :rev => 3, :type => dt
+ get :diff, :params => {
+ :id => PRJ_ID,
+ :rev => 3,
+ :type => dt
+ }
assert_response :success
# Line 11 removed
assert_select 'th.line-num:contains(11) ~ td.diff_out', :text => /Display more information/
@@ -125,8 +148,10 @@ class RepositoriesBazaarControllerTest < Redmine::ControllerTest
end
def test_annotate
- get :annotate, :id => PRJ_ID,
+ get :annotate, :params => {
+ :id => PRJ_ID,
:path => repository_path_hash(['doc-mkdir.txt'])[:param]
+ }
assert_response :success
assert_select "th.line-num", :text => '2' do
@@ -147,8 +172,11 @@ class RepositoriesBazaarControllerTest < Redmine::ControllerTest
:identifier => 'author_escaping',
:log_encoding => 'UTF-8')
assert repository
- get :annotate, :id => PRJ_ID, :repository_id => 'author_escaping',
+ get :annotate, :params => {
+ :id => PRJ_ID,
+ :repository_id => 'author_escaping',
:path => repository_path_hash(['author-escaping-test.txt'])[:param]
+ }
assert_response :success
assert_select "th.line-num", :text => '1' do
@@ -175,8 +203,11 @@ class RepositoriesBazaarControllerTest < Redmine::ControllerTest
:identifier => 'author_non_ascii',
:log_encoding => log_encoding)
assert repository
- get :annotate, :id => PRJ_ID, :repository_id => 'author_non_ascii',
+ get :annotate, :params => {
+ :id => PRJ_ID,
+ :repository_id => 'author_non_ascii',
:path => repository_path_hash(['author-non-ascii-test.txt'])[:param]
+ }
assert_response :success
assert_select "th.line-num", :text => '1' do
@@ -198,7 +229,9 @@ class RepositoriesBazaarControllerTest < Redmine::ControllerTest
assert @repository.changesets.count > 0
assert_difference 'Repository.count', -1 do
- delete :destroy, :id => @repository.id
+ delete :destroy, :params => {
+ :id => @repository.id
+ }
end
assert_response 302
@project.reload
@@ -217,7 +250,9 @@ class RepositoriesBazaarControllerTest < Redmine::ControllerTest
assert_equal 0, @repository.changesets.count
assert_difference 'Repository.count', -1 do
- delete :destroy, :id => @repository.id
+ delete :destroy, :params => {
+ :id => @repository.id
+ }
end
assert_response 302
@project.reload
diff --git a/test/functional/repositories_controller_test.rb b/test/functional/repositories_controller_test.rb
index 5fec94c37..72ed05a2c 100644
--- a/test/functional/repositories_controller_test.rb
+++ b/test/functional/repositories_controller_test.rb
@@ -28,7 +28,9 @@ class RepositoriesControllerTest < Redmine::ControllerTest
def test_new
@request.session[:user_id] = 1
- get :new, :project_id => 'subproject1'
+ get :new, :params => {
+ :project_id => 'subproject1'
+ }
assert_response :success
assert_select 'select[name=?]', 'repository_scm' do
assert_select 'option[value=?][selected=selected]', 'Subversion'
@@ -39,7 +41,9 @@ class RepositoriesControllerTest < Redmine::ControllerTest
def test_new_should_propose_enabled_scm_only
@request.session[:user_id] = 1
with_settings :enabled_scm => ['Mercurial', 'Git'] do
- get :new, :project_id => 'subproject1'
+ get :new, :params => {
+ :project_id => 'subproject1'
+ }
end
assert_response :success
@@ -52,7 +56,10 @@ class RepositoriesControllerTest < Redmine::ControllerTest
def test_get_new_with_type
@request.session[:user_id] = 1
- get :new, :project_id => 'subproject1', :repository_scm => 'Git'
+ get :new, :params => {
+ :project_id => 'subproject1',
+ :repository_scm => 'Git'
+ }
assert_response :success
assert_select 'select[name=?]', 'repository_scm' do
@@ -63,9 +70,15 @@ class RepositoriesControllerTest < Redmine::ControllerTest
def test_create
@request.session[:user_id] = 1
assert_difference 'Repository.count' do
- post :create, :project_id => 'subproject1',
- :repository_scm => 'Subversion',
- :repository => {:url => 'file:///test', :is_default => '1', :identifier => ''}
+ post :create, :params => {
+ :project_id => 'subproject1',
+ :repository_scm => 'Subversion',
+ :repository => {
+ :url => 'file:///test',
+ :is_default => '1',
+ :identifier => ''
+ }
+ }
end
assert_response 302
repository = Repository.order('id DESC').first
@@ -76,9 +89,13 @@ class RepositoriesControllerTest < Redmine::ControllerTest
def test_create_with_failure
@request.session[:user_id] = 1
assert_no_difference 'Repository.count' do
- post :create, :project_id => 'subproject1',
- :repository_scm => 'Subversion',
- :repository => {:url => 'invalid'}
+ post :create, :params => {
+ :project_id => 'subproject1',
+ :repository_scm => 'Subversion',
+ :repository => {
+ :url => 'invalid'
+ }
+ }
end
assert_response :success
assert_select_error /URL is invalid/
@@ -89,21 +106,33 @@ class RepositoriesControllerTest < Redmine::ControllerTest
def test_edit
@request.session[:user_id] = 1
- get :edit, :id => 11
+ get :edit, :params => {
+ :id => 11
+ }
assert_response :success
assert_select 'input[name=?][value=?][disabled=disabled]', 'repository[url]', 'svn://localhost/test'
end
def test_update
@request.session[:user_id] = 1
- put :update, :id => 11, :repository => {:password => 'test_update'}
+ put :update, :params => {
+ :id => 11,
+ :repository => {
+ :password => 'test_update'
+ }
+ }
assert_response 302
assert_equal 'test_update', Repository.find(11).password
end
def test_update_with_failure
@request.session[:user_id] = 1
- put :update, :id => 11, :repository => {:password => 'x'*260}
+ put :update, :params => {
+ :id => 11,
+ :repository => {
+ :password => 'x'*260
+ }
+ }
assert_response :success
assert_select_error /Password is too long/
end
@@ -111,7 +140,9 @@ class RepositoriesControllerTest < Redmine::ControllerTest
def test_destroy
@request.session[:user_id] = 1
assert_difference 'Repository.count', -1 do
- delete :destroy, :id => 11
+ delete :destroy, :params => {
+ :id => 11
+ }
end
assert_response 302
assert_nil Repository.find_by_id(11)
@@ -121,7 +152,9 @@ class RepositoriesControllerTest < Redmine::ControllerTest
Repository::Subversion.any_instance.expects(:fetch_changesets).once
with_settings :autofetch_changesets => '1' do
- get :show, :id => 1
+ get :show, :params => {
+ :id => 1
+ }
end
end
@@ -129,7 +162,9 @@ class RepositoriesControllerTest < Redmine::ControllerTest
Repository::Subversion.any_instance.expects(:fetch_changesets).never
with_settings :autofetch_changesets => '0' do
- get :show, :id => 1
+ get :show, :params => {
+ :id => 1
+ }
end
end
@@ -138,12 +173,16 @@ class RepositoriesControllerTest < Redmine::ControllerTest
Project.find(1).close
with_settings :autofetch_changesets => '1' do
- get :show, :id => 1
+ get :show, :params => {
+ :id => 1
+ }
end
end
def test_revisions
- get :revisions, :id => 1
+ get :revisions, :params => {
+ :id => 1
+ }
assert_response :success
assert_select 'table.changesets'
end
@@ -151,18 +190,27 @@ class RepositoriesControllerTest < Redmine::ControllerTest
def test_revisions_for_other_repository
repository = Repository::Subversion.create!(:project_id => 1, :identifier => 'foo', :url => 'file:///foo')
- get :revisions, :id => 1, :repository_id => 'foo'
+ get :revisions, :params => {
+ :id => 1,
+ :repository_id => 'foo'
+ }
assert_response :success
assert_select 'table.changesets'
end
def test_revisions_for_invalid_repository
- get :revisions, :id => 1, :repository_id => 'foo'
+ get :revisions, :params => {
+ :id => 1,
+ :repository_id => 'foo'
+ }
assert_response 404
end
def test_revision
- get :revision, :id => 1, :rev => 1
+ get :revision, :params => {
+ :id => 1,
+ :rev => 1
+ }
assert_response :success
assert_select 'h2', :text => 'Revision 1'
end
@@ -171,7 +219,10 @@ class RepositoriesControllerTest < Redmine::ControllerTest
Changeset.where(:id => 100).update_all(:comments => 'Simple *text*')
with_settings :commit_logs_formatting => '0' do
- get :revision, :id => 1, :rev => 1
+ get :revision, :params => {
+ :id => 1,
+ :rev => 1
+ }
assert_response :success
assert_select '.changeset-comments', :text => 'Simple *text*'
end
@@ -181,7 +232,10 @@ class RepositoriesControllerTest < Redmine::ControllerTest
Role.find(1).add_permission! :manage_related_issues
@request.session[:user_id] = 2
- get :revision, :id => 1, :rev => 1
+ get :revision, :params => {
+ :id => 1,
+ :rev => 1
+ }
assert_response :success
assert_select 'form[action=?]', '/projects/ecookbook/repository/revisions/1/issues' do
@@ -190,14 +244,20 @@ class RepositoriesControllerTest < Redmine::ControllerTest
end
def test_revision_should_not_change_the_project_menu_link
- get :revision, :id => 1, :rev => 1
+ get :revision, :params => {
+ :id => 1,
+ :rev => 1
+ }
assert_response :success
assert_select '#main-menu a.repository[href=?]', '/projects/ecookbook/repository'
end
def test_revision_with_before_nil_and_afer_normal
- get :revision, {:id => 1, :rev => 1}
+ get :revision, :params => {
+ :id => 1,
+ :rev => 1
+ }
assert_response :success
assert_select 'div.contextual' do
@@ -209,7 +269,13 @@ class RepositoriesControllerTest < Redmine::ControllerTest
def test_add_related_issue
@request.session[:user_id] = 2
assert_difference 'Changeset.find(103).issues.size' do
- xhr :post, :add_related_issue, :id => 1, :rev => 4, :issue_id => 2, :format => 'js'
+ post :add_related_issue, :params => {
+ :id => 1,
+ :rev => 4,
+ :issue_id => 2,
+ :format => 'js'
+ },
+ :xhr => true
assert_response :success
assert_equal 'text/javascript', response.content_type
end
@@ -221,7 +287,13 @@ class RepositoriesControllerTest < Redmine::ControllerTest
def test_add_related_issue_should_accept_issue_id_with_sharp
@request.session[:user_id] = 2
assert_difference 'Changeset.find(103).issues.size' do
- xhr :post, :add_related_issue, :id => 1, :rev => 4, :issue_id => "#2", :format => 'js'
+ post :add_related_issue, :params => {
+ :id => 1,
+ :rev => 4,
+ :issue_id => "#2",
+ :format => 'js'
+ },
+ :xhr => true
end
assert_equal [2], Changeset.find(103).issue_ids
end
@@ -229,7 +301,13 @@ class RepositoriesControllerTest < Redmine::ControllerTest
def test_add_related_issue_with_invalid_issue_id
@request.session[:user_id] = 2
assert_no_difference 'Changeset.find(103).issues.size' do
- xhr :post, :add_related_issue, :id => 1, :rev => 4, :issue_id => 9999, :format => 'js'
+ post :add_related_issue, :params => {
+ :id => 1,
+ :rev => 4,
+ :issue_id => 9999,
+ :format => 'js'
+ },
+ :xhr => true
assert_response :success
assert_equal 'text/javascript', response.content_type
end
@@ -242,7 +320,13 @@ class RepositoriesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_difference 'Changeset.find(103).issues.size', -1 do
- xhr :delete, :remove_related_issue, :id => 1, :rev => 4, :issue_id => 2, :format => 'js'
+ delete :remove_related_issue, :params => {
+ :id => 1,
+ :rev => 4,
+ :issue_id => 2,
+ :format => 'js'
+ },
+ :xhr => true
assert_response :success
assert_equal 'text/javascript', response.content_type
end
@@ -256,13 +340,19 @@ class RepositoriesControllerTest < Redmine::ControllerTest
assert_not_nil latest
Date.stubs(:today).returns(latest.to_date + 10)
- get :graph, :id => 1, :graph => 'commits_per_month'
+ get :graph, :params => {
+ :id => 1,
+ :graph => 'commits_per_month'
+ }
assert_response :success
assert_equal 'image/svg+xml', @response.content_type
end
def test_graph_commits_per_author
- get :graph, :id => 1, :graph => 'commits_per_author'
+ get :graph, :params => {
+ :id => 1,
+ :graph => 'commits_per_author'
+ }
assert_response :success
assert_equal 'image/svg+xml', @response.content_type
end
@@ -278,7 +368,9 @@ class RepositoriesControllerTest < Redmine::ControllerTest
:comments => 'Committed by foo.'
)
- get :committers, :id => 10
+ get :committers, :params => {
+ :id => 10
+ }
assert_response :success
assert_select 'input[value=dlopper] + select option[value="3"][selected=selected]', :text => 'Dave Lopper'
@@ -289,7 +381,9 @@ class RepositoriesControllerTest < Redmine::ControllerTest
Changeset.delete_all
@request.session[:user_id] = 2
- get :committers, :id => 10
+ get :committers, :params => {
+ :id => 10
+ }
assert_response :success
end
@@ -304,7 +398,12 @@ class RepositoriesControllerTest < Redmine::ControllerTest
:comments => 'Committed by foo.'
)
assert_no_difference "Changeset.where(:user_id => 3).count" do
- post :committers, :id => 10, :committers => { '0' => ['foo', '2'], '1' => ['dlopper', '3']}
+ post :committers, :params => {
+ :id => 10,
+ :committers => {
+ '0' => ['foo', '2'], '1' => ['dlopper', '3']
+ }
+ }
assert_response 302
assert_equal User.find(2), c.reload.user
end
diff --git a/test/functional/repositories_cvs_controller_test.rb b/test/functional/repositories_cvs_controller_test.rb
index 6d48812a8..2f22d5f36 100644
--- a/test/functional/repositories_cvs_controller_test.rb
+++ b/test/functional/repositories_cvs_controller_test.rb
@@ -46,7 +46,10 @@ class RepositoriesCvsControllerTest < Redmine::ControllerTest
def test_get_new
@request.session[:user_id] = 1
@project.repository.destroy
- get :new, :project_id => 'subproject1', :repository_scm => 'Cvs'
+ get :new, :params => {
+ :project_id => 'subproject1',
+ :repository_scm => 'Cvs'
+ }
assert_response :success
assert_select 'select[name=?]', 'repository_scm' do
@@ -59,7 +62,9 @@ class RepositoriesCvsControllerTest < Redmine::ControllerTest
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :show, :id => PRJ_ID
+ get :show, :params => {
+ :id => PRJ_ID
+ }
assert_response :success
assert_select 'table.entries tbody' do
@@ -78,7 +83,10 @@ class RepositoriesCvsControllerTest < Redmine::ControllerTest
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :show, :id => PRJ_ID, :path => repository_path_hash(['images'])[:param]
+ get :show, :params => {
+ :id => PRJ_ID,
+ :path => repository_path_hash(['images'])[:param]
+ }
assert_response :success
assert_select 'table.entries tbody' do
@@ -94,8 +102,11 @@ class RepositoriesCvsControllerTest < Redmine::ControllerTest
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :show, :id => PRJ_ID, :path => repository_path_hash(['images'])[:param],
+ get :show, :params => {
+ :id => PRJ_ID,
+ :path => repository_path_hash(['images'])[:param],
:rev => 1
+ }
assert_response :success
assert_select 'table.entries tbody' do
@@ -110,8 +121,10 @@ class RepositoriesCvsControllerTest < Redmine::ControllerTest
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :entry, :id => PRJ_ID,
+ get :entry, :params => {
+ :id => PRJ_ID,
:path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param]
+ }
assert_response :success
assert_select 'td.line-code', :text => /before_filter/, :count => 0
@@ -123,9 +136,11 @@ class RepositoriesCvsControllerTest < Redmine::ControllerTest
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :entry, :id => PRJ_ID,
+ get :entry, :params => {
+ :id => PRJ_ID,
:path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param],
:rev => 2
+ }
assert_response :success
# this line was removed in r3
@@ -137,8 +152,10 @@ class RepositoriesCvsControllerTest < Redmine::ControllerTest
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :entry, :id => PRJ_ID,
+ get :entry, :params => {
+ :id => PRJ_ID,
:path => repository_path_hash(['sources', 'zzz.c'])[:param]
+ }
assert_select 'p#errorExplanation', :text => /The entry or revision was not found in the repository/
end
@@ -147,9 +164,11 @@ class RepositoriesCvsControllerTest < Redmine::ControllerTest
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :entry, :id => PRJ_ID,
+ get :entry, :params => {
+ :id => PRJ_ID,
:path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param],
:format => 'raw'
+ }
assert_response :success
end
@@ -158,8 +177,10 @@ class RepositoriesCvsControllerTest < Redmine::ControllerTest
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :entry, :id => PRJ_ID,
+ get :entry, :params => {
+ :id => PRJ_ID,
:path => repository_path_hash(['sources'])[:param]
+ }
assert_response :success
assert_select 'table.entries tbody'
end
@@ -170,7 +191,11 @@ class RepositoriesCvsControllerTest < Redmine::ControllerTest
@project.reload
assert_equal NUM_REV, @repository.changesets.count
['inline', 'sbs'].each do |dt|
- get :diff, :id => PRJ_ID, :rev => 3, :type => dt
+ get :diff, :params => {
+ :id => PRJ_ID,
+ :rev => 3,
+ :type => dt
+ }
assert_response :success
assert_select 'td.line-code.diff_out', :text => /before_filter :require_login/
@@ -184,7 +209,11 @@ class RepositoriesCvsControllerTest < Redmine::ControllerTest
@project.reload
assert_equal NUM_REV, @repository.changesets.count
['inline', 'sbs'].each do |dt|
- get :diff, :id => PRJ_ID, :rev => 1, :type => dt
+ get :diff, :params => {
+ :id => PRJ_ID,
+ :rev => 1,
+ :type => dt
+ }
assert_response :success
assert_select 'td.line-code.diff_in', :text => /watched.remove_watcher/
@@ -200,8 +229,10 @@ class RepositoriesCvsControllerTest < Redmine::ControllerTest
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :annotate, :id => PRJ_ID,
+ get :annotate, :params => {
+ :id => PRJ_ID,
:path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param]
+ }
assert_response :success
# 1.1 line
@@ -226,7 +257,9 @@ class RepositoriesCvsControllerTest < Redmine::ControllerTest
assert_equal NUM_REV, @repository.changesets.count
assert_difference 'Repository.count', -1 do
- delete :destroy, :id => @repository.id
+ delete :destroy, :params => {
+ :id => @repository.id
+ }
end
assert_response 302
@project.reload
@@ -247,7 +280,9 @@ class RepositoriesCvsControllerTest < Redmine::ControllerTest
assert_equal 0, @repository.changesets.count
assert_difference 'Repository.count', -1 do
- delete :destroy, :id => @repository.id
+ delete :destroy, :params => {
+ :id => @repository.id
+ }
end
assert_response 302
@project.reload
diff --git a/test/functional/repositories_darcs_controller_test.rb b/test/functional/repositories_darcs_controller_test.rb
index 4d86e1afa..0006c94ef 100644
--- a/test/functional/repositories_darcs_controller_test.rb
+++ b/test/functional/repositories_darcs_controller_test.rb
@@ -42,7 +42,10 @@ class RepositoriesDarcsControllerTest < Redmine::ControllerTest
def test_get_new
@request.session[:user_id] = 1
@project.repository.destroy
- get :new, :project_id => 'subproject1', :repository_scm => 'Darcs'
+ get :new, :params => {
+ :project_id => 'subproject1',
+ :repository_scm => 'Darcs'
+ }
assert_response :success
assert_select 'select[name=?]', 'repository_scm' do
assert_select 'option[value=?][selected=selected]', 'Darcs'
@@ -54,7 +57,9 @@ class RepositoriesDarcsControllerTest < Redmine::ControllerTest
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :show, :id => PRJ_ID
+ get :show, :params => {
+ :id => PRJ_ID
+ }
assert_select 'table.entries tbody' do
assert_select 'tr', 3
assert_select 'tr.dir td.filename a', :text => 'images'
@@ -68,7 +73,10 @@ class RepositoriesDarcsControllerTest < Redmine::ControllerTest
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :show, :id => PRJ_ID, :path => repository_path_hash(['images'])[:param]
+ get :show, :params => {
+ :id => PRJ_ID,
+ :path => repository_path_hash(['images'])[:param]
+ }
assert_response :success
assert_select 'table.entries tbody' do
assert_select 'tr', 2
@@ -82,8 +90,11 @@ class RepositoriesDarcsControllerTest < Redmine::ControllerTest
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :show, :id => PRJ_ID, :path => repository_path_hash(['images'])[:param],
+ get :show, :params => {
+ :id => PRJ_ID,
+ :path => repository_path_hash(['images'])[:param],
:rev => 1
+ }
assert_response :success
assert_select 'table.entries tbody' do
assert_select 'tr', 1
@@ -96,8 +107,10 @@ class RepositoriesDarcsControllerTest < Redmine::ControllerTest
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :changes, :id => PRJ_ID,
+ get :changes, :params => {
+ :id => PRJ_ID,
:path => repository_path_hash(['images', 'edit.png'])[:param]
+ }
assert_response :success
assert_select 'h2', :text => /edit.png/
end
@@ -109,7 +122,11 @@ class RepositoriesDarcsControllerTest < Redmine::ControllerTest
assert_equal NUM_REV, @repository.changesets.count
# Full diff of changeset 5
['inline', 'sbs'].each do |dt|
- get :diff, :id => PRJ_ID, :rev => 5, :type => dt
+ get :diff, :params => {
+ :id => PRJ_ID,
+ :rev => 5,
+ :type => dt
+ }
assert_response :success
# Line 22 removed
assert_select 'th.line-num:contains(22) ~ td.diff_out', :text => /def remove/
@@ -124,7 +141,9 @@ class RepositoriesDarcsControllerTest < Redmine::ControllerTest
assert_equal NUM_REV, @repository.changesets.count
assert_difference 'Repository.count', -1 do
- delete :destroy, :id => @repository.id
+ delete :destroy, :params => {
+ :id => @repository.id
+ }
end
assert_response 302
@project.reload
@@ -144,7 +163,9 @@ class RepositoriesDarcsControllerTest < Redmine::ControllerTest
assert_equal 0, @repository.changesets.count
assert_difference 'Repository.count', -1 do
- delete :destroy, :id => @repository.id
+ delete :destroy, :params => {
+ :id => @repository.id
+ }
end
assert_response 302
@project.reload
diff --git a/test/functional/repositories_filesystem_controller_test.rb b/test/functional/repositories_filesystem_controller_test.rb
index 1e25bb824..7cb6047a7 100644
--- a/test/functional/repositories_filesystem_controller_test.rb
+++ b/test/functional/repositories_filesystem_controller_test.rb
@@ -43,7 +43,10 @@ class RepositoriesFilesystemControllerTest < Redmine::ControllerTest
def test_get_new
@request.session[:user_id] = 1
@project.repository.destroy
- get :new, :project_id => 'subproject1', :repository_scm => 'Filesystem'
+ get :new, :params => {
+ :project_id => 'subproject1',
+ :repository_scm => 'Filesystem'
+ }
assert_response :success
assert_select 'select[name=?]', 'repository_scm' do
assert_select 'option[value=?][selected=selected]', 'Filesystem'
@@ -53,7 +56,9 @@ class RepositoriesFilesystemControllerTest < Redmine::ControllerTest
def test_browse_root
@repository.fetch_changesets
@repository.reload
- get :show, :id => PRJ_ID
+ get :show, :params => {
+ :id => PRJ_ID
+ }
assert_response :success
assert_select 'table.entries tbody' do
@@ -71,21 +76,29 @@ class RepositoriesFilesystemControllerTest < Redmine::ControllerTest
end
def test_show_no_extension
- get :entry, :id => PRJ_ID, :path => repository_path_hash(['test'])[:param]
+ get :entry, :params => {
+ :id => PRJ_ID,
+ :path => repository_path_hash(['test'])[:param]
+ }
assert_response :success
assert_select 'tr#L1 td.line-code', :text => /TEST CAT/
end
def test_entry_download_no_extension
- get :raw, :id => PRJ_ID, :path => repository_path_hash(['test'])[:param]
+ get :raw, :params => {
+ :id => PRJ_ID,
+ :path => repository_path_hash(['test'])[:param]
+ }
assert_response :success
assert_equal 'application/octet-stream', @response.content_type
end
def test_show_non_ascii_contents
with_settings :repositories_encodings => 'UTF-8,EUC-JP' do
- get :entry, :id => PRJ_ID,
+ get :entry, :params => {
+ :id => PRJ_ID,
:path => repository_path_hash(['japanese', 'euc-jp.txt'])[:param]
+ }
assert_response :success
assert_select 'tr#L2 td.line-code', :text => /japanese/
if @ruby19_non_utf8_pass
@@ -102,8 +115,10 @@ class RepositoriesFilesystemControllerTest < Redmine::ControllerTest
def test_show_utf16
enc = 'UTF-16'
with_settings :repositories_encodings => enc do
- get :entry, :id => PRJ_ID,
+ get :entry, :params => {
+ :id => PRJ_ID,
:path => repository_path_hash(['japanese', 'utf-16.txt'])[:param]
+ }
assert_response :success
assert_select 'tr#L2 td.line-code', :text => /japanese/
end
@@ -111,8 +126,10 @@ class RepositoriesFilesystemControllerTest < Redmine::ControllerTest
def test_show_text_file_should_show_other_if_too_big
with_settings :file_max_size_displayed => 1 do
- get :entry, :id => PRJ_ID,
+ get :entry, :params => {
+ :id => PRJ_ID,
:path => repository_path_hash(['japanese', 'big-file.txt'])[:param]
+ }
assert_response :success
assert_equal 'text/html', @response.content_type
assert_select 'p.nodata'
@@ -123,7 +140,9 @@ class RepositoriesFilesystemControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 1 # admin
assert_difference 'Repository.count', -1 do
- delete :destroy, :id => @repository.id
+ delete :destroy, :params => {
+ :id => @repository.id
+ }
end
assert_response 302
@project.reload
@@ -140,7 +159,9 @@ class RepositoriesFilesystemControllerTest < Redmine::ControllerTest
)
assert_difference 'Repository.count', -1 do
- delete :destroy, :id => @repository.id
+ delete :destroy, :params => {
+ :id => @repository.id
+ }
end
assert_response 302
@project.reload
diff --git a/test/functional/repositories_git_controller_test.rb b/test/functional/repositories_git_controller_test.rb
index 093e985b8..90c3e817b 100644
--- a/test/functional/repositories_git_controller_test.rb
+++ b/test/functional/repositories_git_controller_test.rb
@@ -54,14 +54,17 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest
def test_create_and_update
@request.session[:user_id] = 1
assert_difference 'Repository.count' do
- post :create, :project_id => 'subproject1',
- :repository_scm => 'Git',
- :repository => {
- :url => '/test',
- :is_default => '0',
- :identifier => 'test-create',
- :report_last_commit => '1',
- }
+ post :create, :params => {
+ :project_id => 'subproject1',
+ :repository_scm => 'Git',
+ :repository => {
+ :url => '/test',
+ :is_default => '0',
+ :identifier => 'test-create',
+ :report_last_commit => '1',
+
+ }
+ }
end
assert_response 302
repository = Repository.order('id DESC').first
@@ -69,10 +72,13 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest
assert_equal '/test', repository.url
assert_equal true, repository.report_last_commit
- put :update, :id => repository.id,
- :repository => {
- :report_last_commit => '0'
- }
+ put :update, :params => {
+ :id => repository.id,
+ :repository => {
+ :report_last_commit => '0'
+
+ }
+ }
assert_response 302
repo2 = Repository.find(repository.id)
assert_equal false, repo2.report_last_commit
@@ -92,7 +98,10 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest
def test_get_new
@request.session[:user_id] = 1
@project.repository.destroy
- get :new, :project_id => 'subproject1', :repository_scm => 'Git'
+ get :new, :params => {
+ :project_id => 'subproject1',
+ :repository_scm => 'Git'
+ }
assert_response :success
assert_select 'select[name=?]', 'repository_scm' do
assert_select 'option[value=?][selected=selected]', 'Git'
@@ -105,7 +114,9 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :show, :id => PRJ_ID
+ get :show, :params => {
+ :id => PRJ_ID
+ }
assert_response :success
assert_select 'table.entries tbody' do
@@ -131,7 +142,10 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :show, :id => PRJ_ID, :rev => 'test_branch'
+ get :show, :params => {
+ :id => PRJ_ID,
+ :rev => 'test_branch'
+ }
assert_response :success
assert_select 'table.entries tbody' do
@@ -156,7 +170,10 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest
"tag00.lightweight",
"tag01.annotated",
].each do |t1|
- get :show, :id => PRJ_ID, :rev => t1
+ get :show, :params => {
+ :id => PRJ_ID,
+ :rev => t1
+ }
assert_response :success
assert_select 'table.entries tbody tr'
@@ -169,7 +186,10 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :show, :id => PRJ_ID, :path => repository_path_hash(['images'])[:param]
+ get :show, :params => {
+ :id => PRJ_ID,
+ :path => repository_path_hash(['images'])[:param]
+ }
assert_response :success
assert_select 'table.entries tbody' do
@@ -184,8 +204,11 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :show, :id => PRJ_ID, :path => repository_path_hash(['images'])[:param],
+ get :show, :params => {
+ :id => PRJ_ID,
+ :path => repository_path_hash(['images'])[:param],
:rev => '7234cb2750b63f47bff735edc50a1c0a433c2518'
+ }
assert_response :success
assert_select 'table.entries tbody' do
@@ -195,15 +218,19 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest
end
def test_changes
- get :changes, :id => PRJ_ID,
+ get :changes, :params => {
+ :id => PRJ_ID,
:path => repository_path_hash(['images', 'edit.png'])[:param]
+ }
assert_response :success
assert_select 'h2', :text => /edit.png/
end
def test_entry_show
- get :entry, :id => PRJ_ID,
+ get :entry, :params => {
+ :id => PRJ_ID,
:path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param]
+ }
assert_response :success
# Line 11
assert_select 'tr#L11 td.line-code', :text => /WITHOUT ANY WARRANTY/
@@ -219,9 +246,11 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest
else
with_settings :repositories_encodings => 'UTF-8,ISO-8859-1' do
['57ca437c', '57ca437c0acbbcb749821fdf3726a1367056d364'].each do |r1|
- get :entry, :id => PRJ_ID,
- :path => repository_path_hash(['latin-1-dir', "test-#{CHAR_1_HEX}.txt"])[:param],
- :rev => r1
+ get :entry, :params => {
+ :id => PRJ_ID,
+ :path => repository_path_hash(['latin-1-dir', "test-#{CHAR_1_HEX}.txt"])[:param],
+ :rev => r1
+ }
assert_response :success
assert_select 'tr#L1 td.line-code', :text => /test-#{CHAR_1_HEX}.txt/
end
@@ -230,17 +259,21 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest
end
def test_entry_download
- get :entry, :id => PRJ_ID,
+ get :entry, :params => {
+ :id => PRJ_ID,
:path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param],
:format => 'raw'
+ }
assert_response :success
# File content
assert @response.body.include?('WITHOUT ANY WARRANTY')
end
def test_directory_entry
- get :entry, :id => PRJ_ID,
+ get :entry, :params => {
+ :id => PRJ_ID,
:path => repository_path_hash(['sources'])[:param]
+ }
assert_response :success
assert_select 'h2 a', :text => 'sources'
assert_select 'table.entries tbody'
@@ -255,10 +288,11 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest
assert_equal NUM_REV, @repository.changesets.count
# Full diff of changeset 2f9c0091
['inline', 'sbs'].each do |dt|
- get :diff,
+ get :diff, :params => {
:id => PRJ_ID,
:rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7',
:type => dt
+ }
assert_response :success
# Line 22 removed
assert_select 'th.line-num:contains(22) ~ td.diff_out', :text => /def remove/
@@ -274,11 +308,12 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest
with_settings :diff_max_lines_displayed => 1000 do
# Full diff of changeset 2f9c0091
['inline', 'sbs'].each do |dt|
- get :diff,
+ get :diff, :params => {
:id => PRJ_ID,
:rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7',
:path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param],
:type => dt
+ }
assert_response :success
# Line 22 removed
assert_select 'th.line-num:contains(22) ~ td.diff_out', :text => /def remove/
@@ -297,14 +332,20 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest
# Truncated diff of changeset 2f9c0091
with_cache do
with_settings :default_language => 'en' do
- get :diff, :id => PRJ_ID, :type => 'inline',
+ get :diff, :params => {
+ :id => PRJ_ID,
+ :type => 'inline',
:rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7'
+ }
assert_response :success
assert @response.body.include?("... This diff was truncated")
end
with_settings :default_language => 'fr' do
- get :diff, :id => PRJ_ID, :type => 'inline',
+ get :diff, :params => {
+ :id => PRJ_ID,
+ :type => 'inline',
:rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7'
+ }
assert_response :success
assert ! @response.body.include?("... This diff was truncated")
assert @response.body.include?("... Ce diff")
@@ -319,11 +360,12 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest
@project.reload
assert_equal NUM_REV, @repository.changesets.count
['inline', 'sbs'].each do |dt|
- get :diff,
+ get :diff, :params => {
:id => PRJ_ID,
:rev => '61b685fbe55ab05b5ac68402d5720c1a6ac973d1',
:rev_to => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7',
:type => dt
+ }
assert_response :success
assert_select 'h2', :text => /2f9c0091:61b685fb/
assert_select 'form[action=?]', '/projects/subproject1/repository/revisions/61b685fbe55ab05b5ac68402d5720c1a6ac973d1/diff'
@@ -341,12 +383,13 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest
assert repo
assert_equal false, repo.is_default
assert_equal 'test-diff-path', repo.identifier
- get :diff,
+ get :diff, :params => {
:id => PRJ_ID,
:repository_id => 'test-diff-path',
:rev => '61b685fbe55ab05b',
:rev_to => '2f9c0091c754a91a',
:type => 'inline'
+ }
assert_response :success
assert_select 'form[action=?]', '/projects/subproject1/repository/test-diff-path/revisions/61b685fbe55ab05b/diff'
assert_select 'input#rev_to[type=hidden][name=rev_to][value=?]', '2f9c0091c754a91a'
@@ -359,7 +402,11 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest
with_settings :repositories_encodings => 'UTF-8,ISO-8859-1' do
['57ca437c', '57ca437c0acbbcb749821fdf3726a1367056d364'].each do |r1|
['inline', 'sbs'].each do |dt|
- get :diff, :id => PRJ_ID, :rev => r1, :type => dt
+ get :diff, :params => {
+ :id => PRJ_ID,
+ :rev => r1,
+ :type => dt
+ }
assert_response :success
assert_select 'table' do
assert_select 'thead th.filename', :text => /latin-1-dir\/test-#{CHAR_1_HEX}.txt/
@@ -372,7 +419,11 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest
end
def test_diff_should_show_filenames
- get :diff, :id => PRJ_ID, :rev => 'deff712f05a90d96edbd70facc47d944be5897e3', :type => 'inline'
+ get :diff, :params => {
+ :id => PRJ_ID,
+ :rev => 'deff712f05a90d96edbd70facc47d944be5897e3',
+ :type => 'inline'
+ }
assert_response :success
# modified file
assert_select 'th.filename', :text => 'sources/watchers_controller.rb'
@@ -388,24 +439,28 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest
assert_nil user.pref[:diff_type]
@request.session[:user_id] = 1 # admin
- get :diff,
+ get :diff, :params => {
:id => PRJ_ID,
:rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7'
+ }
assert_response :success
user.reload
assert_equal "inline", user.pref[:diff_type]
- get :diff,
+ get :diff, :params => {
:id => PRJ_ID,
:rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7',
:type => 'sbs'
+ }
assert_response :success
user.reload
assert_equal "sbs", user.pref[:diff_type]
end
def test_annotate
- get :annotate, :id => PRJ_ID,
+ get :annotate, :params => {
+ :id => PRJ_ID,
:path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param]
+ }
assert_response :success
# Line 23, changeset 2f9c0091
@@ -422,16 +477,21 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :annotate, :id => PRJ_ID, :rev => 'deff7',
+ get :annotate, :params => {
+ :id => PRJ_ID,
+ :rev => 'deff7',
:path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param]
+ }
assert_response :success
assert_select 'h2', :text => /@ deff712f/
end
def test_annotate_binary_file
with_settings :default_language => 'en' do
- get :annotate, :id => PRJ_ID,
+ get :annotate, :params => {
+ :id => PRJ_ID,
:path => repository_path_hash(['images', 'edit.png'])[:param]
+ }
assert_response :success
assert_select 'p#errorExplanation', :text => /cannot be annotated/
end
@@ -439,15 +499,19 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest
def test_annotate_error_when_too_big
with_settings :file_max_size_displayed => 1 do
- get :annotate, :id => PRJ_ID,
+ get :annotate, :params => {
+ :id => PRJ_ID,
:path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param],
:rev => 'deff712f'
+ }
assert_response :success
assert_select 'p#errorExplanation', :text => /exceeds the maximum text file size/
- get :annotate, :id => PRJ_ID,
+ get :annotate, :params => {
+ :id => PRJ_ID,
:path => repository_path_hash(['README'])[:param],
:rev => '7234cb2'
+ }
assert_response :success
end
end
@@ -462,9 +526,11 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest
else
with_settings :repositories_encodings => 'UTF-8,ISO-8859-1' do
['57ca437c', '57ca437c0acbbcb749821fdf3726a1367056d364'].each do |r1|
- get :annotate, :id => PRJ_ID,
- :path => repository_path_hash(['latin-1-dir', "test-#{CHAR_1_HEX}.txt"])[:param],
- :rev => r1
+ get :annotate, :params => {
+ :id => PRJ_ID,
+ :path => repository_path_hash(['latin-1-dir', "test-#{CHAR_1_HEX}.txt"])[:param],
+ :rev => r1
+ }
assert_select "th.line-num", :text => '1' do
assert_select "+ td.revision" do
assert_select "a", :text => '57ca437c'
@@ -481,9 +547,11 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest
def test_annotate_latin_1_author
['83ca5fd546063a3c7dc2e568ba3355661a9e2b2c', '83ca5fd546063a'].each do |r1|
- get :annotate, :id => PRJ_ID,
+ get :annotate, :params => {
+ :id => PRJ_ID,
:path => repository_path_hash([" filename with a leading space.txt "])[:param],
:rev => r1
+ }
assert_select "th.line-num", :text => '1' do
assert_select "+ td.revision" do
assert_select "a", :text => '83ca5fd5'
@@ -501,7 +569,9 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :revisions, :id => PRJ_ID
+ get :revisions, :params => {
+ :id => PRJ_ID
+ }
assert_select 'form[method=get][action=?]', '/projects/subproject1/repository/revision'
end
@@ -511,7 +581,10 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest
@project.reload
assert_equal NUM_REV, @repository.changesets.count
['61b685fbe55ab05b5ac68402d5720c1a6ac973d1', '61b685f'].each do |r|
- get :revision, :id => PRJ_ID, :rev => r
+ get :revision, :params => {
+ :id => PRJ_ID,
+ :rev => r
+ }
assert_response :success
end
end
@@ -522,7 +595,10 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest
@project.reload
assert_equal NUM_REV, @repository.changesets.count
['', ' ', nil].each do |r|
- get :revision, :id => PRJ_ID, :rev => r
+ get :revision, :params => {
+ :id => PRJ_ID,
+ :rev => r
+ }
assert_response 404
assert_select_error /was not found/
end
@@ -536,7 +612,9 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest
assert_equal NUM_REV, @repository.changesets.count
assert_difference 'Repository.count', -1 do
- delete :destroy, :id => @repository.id
+ delete :destroy, :params => {
+ :id => @repository.id
+ }
end
assert_response 302
@project.reload
@@ -556,7 +634,9 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest
assert_equal 0, @repository.changesets.count
assert_difference 'Repository.count', -1 do
- delete :destroy, :id => @repository.id
+ delete :destroy, :params => {
+ :id => @repository.id
+ }
end
assert_response 302
@project.reload
diff --git a/test/functional/repositories_mercurial_controller_test.rb b/test/functional/repositories_mercurial_controller_test.rb
index cde27baa4..e69a8e736 100644
--- a/test/functional/repositories_mercurial_controller_test.rb
+++ b/test/functional/repositories_mercurial_controller_test.rb
@@ -56,7 +56,10 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest
def test_get_new
@request.session[:user_id] = 1
@project.repository.destroy
- get :new, :project_id => 'subproject1', :repository_scm => 'Mercurial'
+ get :new, :params => {
+ :project_id => 'subproject1',
+ :repository_scm => 'Mercurial'
+ }
assert_response :success
assert_select 'select[name=?]', 'repository_scm' do
assert_select 'option[value=?][selected=selected]', 'Mercurial'
@@ -68,7 +71,9 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :show, :id => PRJ_ID
+ get :show, :params => {
+ :id => PRJ_ID
+ }
assert_response :success
assert_select 'table.entries tbody' do
@@ -89,7 +94,10 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :show, :id => PRJ_ID, :path => repository_path_hash(['images'])[:param]
+ get :show, :params => {
+ :id => PRJ_ID,
+ :path => repository_path_hash(['images'])[:param]
+ }
assert_response :success
assert_select 'table.entries tbody' do
@@ -109,8 +117,11 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest
@project.reload
assert_equal NUM_REV, @repository.changesets.count
[0, '0', '0885933ad4f6'].each do |r1|
- get :show, :id => PRJ_ID, :path => repository_path_hash(['images'])[:param],
+ get :show, :params => {
+ :id => PRJ_ID,
+ :path => repository_path_hash(['images'])[:param],
:rev => r1
+ }
assert_response :success
assert_select 'table.entries tbody' do
@@ -130,9 +141,11 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest
@project.reload
assert_equal NUM_REV, @repository.changesets.count
[13, '13', '3a330eb32958'].each do |r1|
- get :show, :id => PRJ_ID,
+ get :show, :params => {
+ :id => PRJ_ID,
:path => repository_path_hash(['sql_escape', 'percent%dir'])[:param],
:rev => r1
+ }
assert_response :success
assert_select 'table.entries tbody' do
@@ -156,9 +169,11 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest
@project.reload
assert_equal NUM_REV, @repository.changesets.count
[21, '21', 'adf805632193'].each do |r1|
- get :show, :id => PRJ_ID,
+ get :show, :params => {
+ :id => PRJ_ID,
:path => repository_path_hash(['latin-1-dir'])[:param],
:rev => r1
+ }
assert_response :success
assert_select 'table.entries tbody' do
@@ -182,7 +197,9 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest
def show_should_show_branch_selection_form
@repository.fetch_changesets
@project.reload
- get :show, :id => PRJ_ID
+ get :show, :params => {
+ :id => PRJ_ID
+ }
assert_select 'form#revision_selector[action=?]', '/projects/subproject1/repository/show' do
assert_select 'select[name=branch]' do
assert_select 'option[value=?]', 'test-branch-01'
@@ -203,7 +220,10 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest
'test_branch.latin-1',
'test-branch-00',
].each do |bra|
- get :show, :id => PRJ_ID, :rev => bra
+ get :show, :params => {
+ :id => PRJ_ID,
+ :rev => bra
+ }
assert_response :success
assert_select 'table.entries tbody tr'
@@ -221,7 +241,10 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest
'tag_test.00',
'tag-init-revision'
].each do |tag|
- get :show, :id => PRJ_ID, :rev => tag
+ get :show, :params => {
+ :id => PRJ_ID,
+ :rev => tag
+ }
assert_response :success
assert_select 'table.entries tbody tr'
@@ -230,15 +253,19 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest
end
def test_changes
- get :changes, :id => PRJ_ID,
+ get :changes, :params => {
+ :id => PRJ_ID,
:path => repository_path_hash(['images', 'edit.png'])[:param]
+ }
assert_response :success
assert_select 'h2', :text => /edit.png/
end
def test_entry_show
- get :entry, :id => PRJ_ID,
+ get :entry, :params => {
+ :id => PRJ_ID,
:path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param]
+ }
assert_response :success
# Line 10
assert_select 'tr#L10 td.line-code', :text => /WITHOUT ANY WARRANTY/
@@ -246,9 +273,11 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest
def test_entry_show_latin_1_path
[21, '21', 'adf805632193'].each do |r1|
- get :entry, :id => PRJ_ID,
- :path => repository_path_hash(['latin-1-dir', "test-#{@char_1}-2.txt"])[:param],
- :rev => r1
+ get :entry, :params => {
+ :id => PRJ_ID,
+ :path => repository_path_hash(['latin-1-dir', "test-#{@char_1}-2.txt"])[:param],
+ :rev => r1
+ }
assert_response :success
assert_select 'tr#L1 td.line-code', :text => /Mercurial is a distributed version control system/
end
@@ -257,9 +286,11 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest
def test_entry_show_latin_1_contents
with_settings :repositories_encodings => 'UTF-8,ISO-8859-1' do
[27, '27', '7bbf4c738e71'].each do |r1|
- get :entry, :id => PRJ_ID,
- :path => repository_path_hash(['latin-1-dir', "test-#{@char_1}.txt"])[:param],
- :rev => r1
+ get :entry, :params => {
+ :id => PRJ_ID,
+ :path => repository_path_hash(['latin-1-dir', "test-#{@char_1}.txt"])[:param],
+ :rev => r1
+ }
assert_response :success
assert_select 'tr#L1 td.line-code', :text => /test-#{@char_1}.txt/
end
@@ -267,9 +298,11 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest
end
def test_entry_download
- get :entry, :id => PRJ_ID,
+ get :entry, :params => {
+ :id => PRJ_ID,
:path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param],
:format => 'raw'
+ }
assert_response :success
# File content
assert @response.body.include?('WITHOUT ANY WARRANTY')
@@ -280,8 +313,10 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest
end
def test_directory_entry
- get :entry, :id => PRJ_ID,
+ get :entry, :params => {
+ :id => PRJ_ID,
:path => repository_path_hash(['sources'])[:param]
+ }
assert_response :success
assert_select 'h2 a', :text => 'sources'
assert_select 'table.entries tbody'
@@ -295,7 +330,11 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest
[4, '4', 'def6d2f1254a'].each do |r1|
# Full diff of changeset 4
['inline', 'sbs'].each do |dt|
- get :diff, :id => PRJ_ID, :rev => r1, :type => dt
+ get :diff, :params => {
+ :id => PRJ_ID,
+ :rev => r1,
+ :type => dt
+ }
assert_response :success
if @diff_c_support
# Line 22 removed
@@ -314,11 +353,12 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest
[2, '400bb8672109', '400', 400].each do |r1|
[4, 'def6d2f1254a'].each do |r2|
['inline', 'sbs'].each do |dt|
- get :diff,
+ get :diff, :params => {
:id => PRJ_ID,
:rev => r1,
:rev_to => r2,
:type => dt
+ }
assert_response :success
assert_select 'h2', :text => /4:def6d2f1254a 2:400bb8672109/
end
@@ -330,7 +370,11 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest
with_settings :repositories_encodings => 'UTF-8,ISO-8859-1' do
[21, 'adf805632193'].each do |r1|
['inline', 'sbs'].each do |dt|
- get :diff, :id => PRJ_ID, :rev => r1, :type => dt
+ get :diff, :params => {
+ :id => PRJ_ID,
+ :rev => r1,
+ :type => dt
+ }
assert_response :success
assert_select 'table' do
assert_select 'thead th.filename', :text => /latin-1-dir\/test-#{@char_1}-2.txt/
@@ -342,20 +386,30 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest
end
def test_diff_should_show_modified_filenames
- get :diff, :id => PRJ_ID, :rev => '400bb8672109', :type => 'inline'
+ get :diff, :params => {
+ :id => PRJ_ID,
+ :rev => '400bb8672109',
+ :type => 'inline'
+ }
assert_response :success
assert_select 'th.filename', :text => 'sources/watchers_controller.rb'
end
def test_diff_should_show_deleted_filenames
- get :diff, :id => PRJ_ID, :rev => 'b3a615152df8', :type => 'inline'
+ get :diff, :params => {
+ :id => PRJ_ID,
+ :rev => 'b3a615152df8',
+ :type => 'inline'
+ }
assert_response :success
assert_select 'th.filename', :text => 'sources/welcome_controller.rb'
end
def test_annotate
- get :annotate, :id => PRJ_ID,
+ get :annotate, :params => {
+ :id => PRJ_ID,
:path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param]
+ }
assert_response :success
# Line 22, revision 4:def6d2f1254a
@@ -372,8 +426,10 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :annotate, :id => PRJ_ID,
+ get :annotate, :params => {
+ :id => PRJ_ID,
:path => repository_path_hash(['sources', 'welcome_controller.rb'])[:param]
+ }
assert_response 404
assert_select_error /was not found/
end
@@ -384,8 +440,11 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest
@project.reload
assert_equal NUM_REV, @repository.changesets.count
[2, '400bb8672109', '400', 400].each do |r1|
- get :annotate, :id => PRJ_ID, :rev => r1,
+ get :annotate, :params => {
+ :id => PRJ_ID,
+ :rev => r1,
:path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param]
+ }
assert_response :success
assert_select 'h2', :text => /@ 2:400bb8672109/
end
@@ -393,9 +452,11 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest
def test_annotate_latin_1_path
[21, '21', 'adf805632193'].each do |r1|
- get :annotate, :id => PRJ_ID,
- :path => repository_path_hash(['latin-1-dir', "test-#{@char_1}-2.txt"])[:param],
- :rev => r1
+ get :annotate, :params => {
+ :id => PRJ_ID,
+ :path => repository_path_hash(['latin-1-dir', "test-#{@char_1}-2.txt"])[:param],
+ :rev => r1
+ }
assert_response :success
assert_select "th.line-num", :text => '1' do
assert_select "+ td.revision" do
@@ -412,9 +473,11 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest
def test_annotate_latin_1_contents
with_settings :repositories_encodings => 'UTF-8,ISO-8859-1' do
[27, '7bbf4c738e71'].each do |r1|
- get :annotate, :id => PRJ_ID,
- :path => repository_path_hash(['latin-1-dir', "test-#{@char_1}.txt"])[:param],
- :rev => r1
+ get :annotate, :params => {
+ :id => PRJ_ID,
+ :path => repository_path_hash(['latin-1-dir', "test-#{@char_1}.txt"])[:param],
+ :rev => r1
+ }
assert_select 'tr#L1 td.line-code', :text => /test-#{@char_1}.txt/
end
end
@@ -427,7 +490,10 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest
assert_equal NUM_REV, @repository.changesets.count
['1', '9d5b5b', '9d5b5b004199'].each do |r|
with_settings :default_language => "en" do
- get :revision, :id => PRJ_ID, :rev => r
+ get :revision, :params => {
+ :id => PRJ_ID,
+ :rev => r
+ }
assert_response :success
assert_select 'title',
:text => 'Revision 1:9d5b5b004199 - Added 2 files and modified one. - eCookbook Subproject 1 - Redmine'
@@ -441,7 +507,10 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest
@project.reload
assert_equal NUM_REV, @repository.changesets.count
['', ' ', nil].each do |r|
- get :revision, :id => PRJ_ID, :rev => r
+ get :revision, :params => {
+ :id => PRJ_ID,
+ :rev => r
+ }
assert_response 404
assert_select_error /was not found/
end
@@ -454,7 +523,9 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest
assert_equal NUM_REV, @repository.changesets.count
assert_difference 'Repository.count', -1 do
- delete :destroy, :id => @repository.id
+ delete :destroy, :params => {
+ :id => @repository.id
+ }
end
assert_response 302
@project.reload
@@ -473,7 +544,9 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest
assert_equal 0, @repository.changesets.count
assert_difference 'Repository.count', -1 do
- delete :destroy, :id => @repository.id
+ delete :destroy, :params => {
+ :id => @repository.id
+ }
end
assert_response 302
@project.reload
diff --git a/test/functional/repositories_subversion_controller_test.rb b/test/functional/repositories_subversion_controller_test.rb
index 92dc2c2f7..4829d720c 100644
--- a/test/functional/repositories_subversion_controller_test.rb
+++ b/test/functional/repositories_subversion_controller_test.rb
@@ -41,7 +41,10 @@ class RepositoriesSubversionControllerTest < Redmine::ControllerTest
def test_new
@request.session[:user_id] = 1
@project.repository.destroy
- get :new, :project_id => 'subproject1', :repository_scm => 'Subversion'
+ get :new, :params => {
+ :project_id => 'subproject1',
+ :repository_scm => 'Subversion'
+ }
assert_response :success
assert_select 'select[name=?]', 'repository_scm' do
assert_select 'option[value=?][selected=selected]', 'Subversion'
@@ -53,7 +56,9 @@ class RepositoriesSubversionControllerTest < Redmine::ControllerTest
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :show, :id => PRJ_ID
+ get :show, :params => {
+ :id => PRJ_ID
+ }
assert_response :success
assert_select 'table.entries tbody' do
@@ -78,7 +83,10 @@ class RepositoriesSubversionControllerTest < Redmine::ControllerTest
:url => self.class.subversion_repository_url,
:is_default => false, :identifier => 'svn')
- get :show, :id => PRJ_ID, :repository_id => 'svn'
+ get :show, :params => {
+ :id => PRJ_ID,
+ :repository_id => 'svn'
+ }
assert_response :success
assert_select 'tr.dir a[href="/projects/subproject1/repository/svn/show/subversion_test"]'
@@ -91,7 +99,10 @@ class RepositoriesSubversionControllerTest < Redmine::ControllerTest
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :show, :id => PRJ_ID, :path => repository_path_hash(['subversion_test'])[:param]
+ get :show, :params => {
+ :id => PRJ_ID,
+ :path => repository_path_hash(['subversion_test'])[:param]
+ }
assert_response :success
assert_select 'table.entries tbody' do
@@ -111,8 +122,11 @@ class RepositoriesSubversionControllerTest < Redmine::ControllerTest
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :show, :id => PRJ_ID, :path => repository_path_hash(['subversion_test'])[:param],
+ get :show, :params => {
+ :id => PRJ_ID,
+ :path => repository_path_hash(['subversion_test'])[:param],
:rev => 4
+ }
assert_response :success
assert_select 'table.entries tbody' do
@@ -130,8 +144,10 @@ class RepositoriesSubversionControllerTest < Redmine::ControllerTest
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :changes, :id => PRJ_ID,
+ get :changes, :params => {
+ :id => PRJ_ID,
:path => repository_path_hash(['subversion_test', 'folder', 'helloworld.rb'])[:param]
+ }
assert_response :success
assert_select 'table.changesets tbody' do
@@ -155,8 +171,10 @@ class RepositoriesSubversionControllerTest < Redmine::ControllerTest
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :changes, :id => PRJ_ID,
+ get :changes, :params => {
+ :id => PRJ_ID,
:path => repository_path_hash(['subversion_test', 'folder'])[:param]
+ }
assert_response :success
assert_select 'table.changesets tbody' do
@@ -175,8 +193,10 @@ class RepositoriesSubversionControllerTest < Redmine::ControllerTest
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :entry, :id => PRJ_ID,
+ get :entry, :params => {
+ :id => PRJ_ID,
:path => repository_path_hash(['subversion_test', 'helloworld.c'])[:param]
+ }
assert_response :success
assert_select 'h2 a', :text => 'subversion_test'
assert_select 'h2 a', :text => 'helloworld.c'
@@ -189,8 +209,10 @@ class RepositoriesSubversionControllerTest < Redmine::ControllerTest
assert_equal NUM_REV, @repository.changesets.count
# no files in the test repo is larger than 1KB...
with_settings :file_max_size_displayed => 0 do
- get :entry, :id => PRJ_ID,
+ get :entry, :params => {
+ :id => PRJ_ID,
:path => repository_path_hash(['subversion_test', 'helloworld.c'])[:param]
+ }
assert_response :success
assert_equal 'text/html', @response.content_type
assert_select 'p.nodata'
@@ -198,8 +220,10 @@ class RepositoriesSubversionControllerTest < Redmine::ControllerTest
end
def test_entry_should_display_images
- get :entry, :id => PRJ_ID,
+ get :entry, :params => {
+ :id => PRJ_ID,
:path => repository_path_hash(['subversion_test', 'folder', 'subfolder', 'rubylogo.gif'])[:param]
+ }
assert_response :success
assert_select 'img[src=?]', '/projects/subproject1/repository/raw/subversion_test/folder/subfolder/rubylogo.gif'
end
@@ -209,9 +233,11 @@ class RepositoriesSubversionControllerTest < Redmine::ControllerTest
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :entry, :id => PRJ_ID,
+ get :entry, :params => {
+ :id => PRJ_ID,
:path => repository_path_hash(['subversion_test', 'helloworld.rb'])[:param],
:rev => 2
+ }
assert_response :success
# this line was removed in r3 and file was moved in r6
assert_select 'td.line-code', :text => /Here's the code/
@@ -222,8 +248,10 @@ class RepositoriesSubversionControllerTest < Redmine::ControllerTest
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :entry, :id => PRJ_ID,
+ get :entry, :params => {
+ :id => PRJ_ID,
:path => repository_path_hash(['subversion_test', 'zzz.c'])[:param]
+ }
assert_select 'p#errorExplanation', :text => /The entry or revision was not found in the repository/
end
@@ -232,8 +260,10 @@ class RepositoriesSubversionControllerTest < Redmine::ControllerTest
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :raw, :id => PRJ_ID,
+ get :raw, :params => {
+ :id => PRJ_ID,
:path => repository_path_hash(['subversion_test', 'helloworld.c'])[:param]
+ }
assert_response :success
assert_equal 'attachment; filename="helloworld.c"', @response.headers['Content-Disposition']
end
@@ -243,8 +273,10 @@ class RepositoriesSubversionControllerTest < Redmine::ControllerTest
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :entry, :id => PRJ_ID,
+ get :entry, :params => {
+ :id => PRJ_ID,
:path => repository_path_hash(['subversion_test', 'folder'])[:param]
+ }
assert_response :success
assert_select 'h2 a', :text => 'subversion_test'
assert_select 'h2 a', :text => 'folder'
@@ -252,7 +284,10 @@ class RepositoriesSubversionControllerTest < Redmine::ControllerTest
# TODO: this test needs fixtures.
def test_revision
- get :revision, :id => 1, :rev => 2
+ get :revision, :params => {
+ :id => 1,
+ :rev => 2
+ }
assert_response :success
assert_select 'ul' do
@@ -270,13 +305,20 @@ class RepositoriesSubversionControllerTest < Redmine::ControllerTest
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :revision, :id => PRJ_ID, :rev => 'something_weird'
+ get :revision, :params => {
+ :id => PRJ_ID,
+ :rev => 'something_weird'
+ }
assert_response 404
assert_select_error /was not found/
end
def test_invalid_revision_diff
- get :diff, :id => PRJ_ID, :rev => '1', :rev_to => 'something_weird'
+ get :diff, :params => {
+ :id => PRJ_ID,
+ :rev => '1',
+ :rev_to => 'something_weird'
+ }
assert_response 404
assert_select_error /was not found/
end
@@ -287,7 +329,10 @@ class RepositoriesSubversionControllerTest < Redmine::ControllerTest
@project.reload
assert_equal NUM_REV, @repository.changesets.count
['', ' ', nil].each do |r|
- get :revision, :id => PRJ_ID, :rev => r
+ get :revision, :params => {
+ :id => PRJ_ID,
+ :rev => r
+ }
assert_response 404
assert_select_error /was not found/
end
@@ -299,7 +344,10 @@ class RepositoriesSubversionControllerTest < Redmine::ControllerTest
# Changes repository url to a subdirectory
r.update_attribute :url, (r.url + '/test/some')
- get :revision, :id => 1, :rev => 2
+ get :revision, :params => {
+ :id => 1,
+ :rev => 2
+ }
assert_response :success
assert_select 'ul' do
@@ -318,7 +366,11 @@ class RepositoriesSubversionControllerTest < Redmine::ControllerTest
@project.reload
assert_equal NUM_REV, @repository.changesets.count
['inline', 'sbs'].each do |dt|
- get :diff, :id => PRJ_ID, :rev => 3, :type => dt
+ get :diff, :params => {
+ :id => PRJ_ID,
+ :rev => 3,
+ :type => dt
+ }
assert_response :success
assert_select 'h2', :text => /Revision 3/
assert_select 'th.filename', :text => 'subversion_test/textfile.txt'
@@ -331,7 +383,11 @@ class RepositoriesSubversionControllerTest < Redmine::ControllerTest
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :diff, :id => PRJ_ID, :rev => 5, :format => 'diff'
+ get :diff, :params => {
+ :id => PRJ_ID,
+ :rev => 5,
+ :format => 'diff'
+ }
assert_response :success
assert_equal 'text/x-patch', @response.content_type
assert_equal 'Index: subversion_test/folder/greeter.rb', @response.body.split(/\r?\n/).first
@@ -343,9 +399,13 @@ class RepositoriesSubversionControllerTest < Redmine::ControllerTest
@project.reload
assert_equal NUM_REV, @repository.changesets.count
['inline', 'sbs'].each do |dt|
- get :diff, :id => PRJ_ID, :rev => 6, :rev_to => 2,
+ get :diff, :params => {
+ :id => PRJ_ID,
+ :rev => 6,
+ :rev_to => 2,
:path => repository_path_hash(['subversion_test', 'folder'])[:param],
:type => dt
+ }
assert_response :success
assert_select 'h2', :text => /2:6/
@@ -361,8 +421,10 @@ class RepositoriesSubversionControllerTest < Redmine::ControllerTest
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :annotate, :id => PRJ_ID,
+ get :annotate, :params => {
+ :id => PRJ_ID,
:path => repository_path_hash(['subversion_test', 'helloworld.c'])[:param]
+ }
assert_response :success
assert_select 'tr' do
@@ -384,8 +446,11 @@ class RepositoriesSubversionControllerTest < Redmine::ControllerTest
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- get :annotate, :id => PRJ_ID, :rev => 8,
+ get :annotate, :params => {
+ :id => PRJ_ID,
+ :rev => 8,
:path => repository_path_hash(['subversion_test', 'helloworld.c'])[:param]
+ }
assert_response :success
assert_select 'h2', :text => /@ 8/
end
@@ -397,7 +462,9 @@ class RepositoriesSubversionControllerTest < Redmine::ControllerTest
assert_equal NUM_REV, @repository.changesets.count
assert_difference 'Repository.count', -1 do
- delete :destroy, :id => @repository.id
+ delete :destroy, :params => {
+ :id => @repository.id
+ }
end
assert_response 302
@project.reload
@@ -414,7 +481,9 @@ class RepositoriesSubversionControllerTest < Redmine::ControllerTest
assert_equal 0, @repository.changesets.count
assert_difference 'Repository.count', -1 do
- delete :destroy, :id => @repository.id
+ delete :destroy, :params => {
+ :id => @repository.id
+ }
end
assert_response 302
@project.reload
diff --git a/test/functional/sessions_controller_test.rb b/test/functional/sessions_controller_test.rb
index f362947b5..bcc182ccc 100644
--- a/test/functional/sessions_controller_test.rb
+++ b/test/functional/sessions_controller_test.rb
@@ -35,7 +35,10 @@ class SessionsControllerTest < Redmine::ControllerTest
token = Token.create!(:user_id => 2, :action => 'session', :created_on => 10.hours.ago, :updated_on => 10.hours.ago)
created = token.reload.created_on
- get :index, :session => {:user_id => 2, :tk => token.value}
+ get :index, :session => {
+ :user_id => 2,
+ :tk => token.value
+ }
assert_response :success
token.reload
assert_equal created.to_i, token.created_on.to_i
@@ -48,13 +51,18 @@ class SessionsControllerTest < Redmine::ControllerTest
token = Token.create!(:user_id => 2, :action => 'session', :created_on => created, :updated_on => created)
with_settings :session_lifetime => '0', :session_timeout => '0' do
- get :index, :session => {:user_id => 2, :tk => token.value}
+ get :index, :session => {
+ :user_id => 2,
+ :tk => token.value
+ }
assert_response :success
end
end
def test_user_session_without_token_should_be_reset
- get :index, :session => {:user_id => 2}
+ get :index, :session => {
+ :user_id => 2
+ }
assert_redirected_to 'http://test.host/login?back_url=http%3A%2F%2Ftest.host%2F'
end
@@ -63,7 +71,10 @@ class SessionsControllerTest < Redmine::ControllerTest
token = Token.create!(:user_id => 2, :action => 'session', :created_on => created, :updated_on => created)
with_settings :session_timeout => '720' do
- get :index, :session => {:user_id => 2, :tk => token.value}
+ get :index, :session => {
+ :user_id => 2,
+ :tk => token.value
+ }
assert_redirected_to 'http://test.host/login?back_url=http%3A%2F%2Ftest.host%2F'
end
end
@@ -73,7 +84,10 @@ class SessionsControllerTest < Redmine::ControllerTest
token = Token.create!(:user_id => 2, :action => 'session', :created_on => created, :updated_on => created)
with_settings :session_timeout => '720' do
- get :index, :session => {:user_id => 2, :tk => token.value}
+ get :index, :session => {
+ :user_id => 2,
+ :tk => token.value
+ }
assert_response :success
end
end
@@ -83,7 +97,10 @@ class SessionsControllerTest < Redmine::ControllerTest
token = Token.create!(:user_id => 2, :action => 'session', :created_on => created, :updated_on => created)
with_settings :session_timeout => '60' do
- get :index, :session => {:user_id => 2, :tk => token.value}
+ get :index, :session => {
+ :user_id => 2,
+ :tk => token.value
+ }
assert_redirected_to 'http://test.host/login?back_url=http%3A%2F%2Ftest.host%2F'
end
end
@@ -93,7 +110,10 @@ class SessionsControllerTest < Redmine::ControllerTest
token = Token.create!(:user_id => 2, :action => 'session', :created_on => created, :updated_on => created)
with_settings :session_timeout => '60' do
- get :index, :session => {:user_id => 2, :tk => token.value}
+ get :index, :session => {
+ :user_id => 2,
+ :tk => token.value
+ }
assert_response :success
end
end
@@ -106,7 +126,10 @@ class SessionsControllerTest < Redmine::ControllerTest
autologin_token = Token.create!(:user_id => 2, :action => 'autologin', :created_on => 1.day.ago)
@request.cookies['autologin'] = autologin_token.value
- get :index, :session => {:user_id => 2, :tk => token.value}
+ get :index, :session => {
+ :user_id => 2,
+ :tk => token.value
+ }
assert_equal 2, session[:user_id]
assert_response :success
assert_not_equal token.value, session[:tk]
@@ -122,7 +145,10 @@ class SessionsControllerTest < Redmine::ControllerTest
token = Token.create!(:user_id => 2, :action => 'session', :created_on => created, :updated_on => created)
with_settings :session_timeout => '60' do
- get :index, :session => {:user_id => user.id, :tk => token.value}
+ get :index, :session => {
+ :user_id => user.id,
+ :tk => token.value
+ }
assert_redirected_to 'http://test.host/login?back_url=http%3A%2F%2Ftest.host%2F'
assert_include "Veuillez vous reconnecter", flash[:error]
assert_equal :fr, current_language
diff --git a/test/functional/versions_controller_test.rb b/test/functional/versions_controller_test.rb
index 87c6517df..2698516bf 100644
--- a/test/functional/versions_controller_test.rb
+++ b/test/functional/versions_controller_test.rb
@@ -136,7 +136,7 @@ class VersionsControllerTest < Redmine::ControllerTest
def test_new_from_issue_form
@request.session[:user_id] = 2
- xhr :get, :new, :params => {:project_id => '1'}
+ get :new, :params => {:project_id => '1'}, :xhr => true
assert_response :success
assert_equal 'text/javascript', response.content_type
end
@@ -155,7 +155,7 @@ class VersionsControllerTest < Redmine::ControllerTest
def test_create_from_issue_form
@request.session[:user_id] = 2
assert_difference 'Version.count' do
- xhr :post, :create, :params => {:project_id => '1', :version => {:name => 'test_add_version_from_issue_form'}}
+ post :create, :params => {:project_id => '1', :version => {:name => 'test_add_version_from_issue_form'}}, :xhr => true
end
version = Version.find_by_name('test_add_version_from_issue_form')
assert_not_nil version
@@ -169,7 +169,7 @@ class VersionsControllerTest < Redmine::ControllerTest
def test_create_from_issue_form_with_failure
@request.session[:user_id] = 2
assert_no_difference 'Version.count' do
- xhr :post, :create, :params => {:project_id => '1', :version => {:name => ''}}
+ post :create, :params => {:project_id => '1', :version => {:name => ''}}, :xhr => true
end
assert_response :success
assert_equal 'text/javascript', response.content_type
@@ -247,12 +247,12 @@ class VersionsControllerTest < Redmine::ControllerTest
end
def test_issue_status_by
- xhr :get, :status_by, :params => {:id => 2}
+ get :status_by, :params => {:id => 2}, :xhr => true
assert_response :success
end
def test_issue_status_by_status
- xhr :get, :status_by, :params => {:id => 2, :status_by => 'status'}
+ get :status_by, :params => {:id => 2, :status_by => 'status'}, :xhr => true
assert_response :success
assert_include 'Assigned', response.body
assert_include 'Closed', response.body
diff --git a/test/functional/watchers_controller_test.rb b/test/functional/watchers_controller_test.rb
index 3cec7a075..10ef85b39 100644
--- a/test/functional/watchers_controller_test.rb
+++ b/test/functional/watchers_controller_test.rb
@@ -38,7 +38,7 @@ class WatchersControllerTest < Redmine::ControllerTest
def test_watch_a_single_object
@request.session[:user_id] = 3
assert_difference('Watcher.count') do
- xhr :post, :watch, :params => {:object_type => 'issue', :object_id => '1'}
+ post :watch, :params => {:object_type => 'issue', :object_id => '1'}, :xhr => true
assert_response :success
assert_include '$(".issue-1-watcher")', response.body
end
@@ -48,7 +48,7 @@ class WatchersControllerTest < Redmine::ControllerTest
def test_watch_a_collection_with_a_single_object
@request.session[:user_id] = 3
assert_difference('Watcher.count') do
- xhr :post, :watch, :params => {:object_type => 'issue', :object_id => ['1']}
+ post :watch, :params => {:object_type => 'issue', :object_id => ['1']}, :xhr => true
assert_response :success
assert_include '$(".issue-1-watcher")', response.body
end
@@ -58,7 +58,7 @@ class WatchersControllerTest < Redmine::ControllerTest
def test_watch_a_collection_with_multiple_objects
@request.session[:user_id] = 3
assert_difference('Watcher.count', 2) do
- xhr :post, :watch, :params => {:object_type => 'issue', :object_id => ['1', '3']}
+ post :watch, :params => {:object_type => 'issue', :object_id => ['1', '3']}, :xhr => true
assert_response :success
assert_include '$(".issue-bulk-watcher")', response.body
end
@@ -71,7 +71,7 @@ class WatchersControllerTest < Redmine::ControllerTest
assert_not_nil m = Project.find(1).enabled_module('news')
assert_difference 'Watcher.count' do
- xhr :post, :watch, :params => {:object_type => 'enabled_module', :object_id => m.id.to_s}
+ post :watch, :params => {:object_type => 'enabled_module', :object_id => m.id.to_s}, :xhr => true
assert_response :success
end
assert m.reload.watched_by?(User.find(7))
@@ -82,7 +82,7 @@ class WatchersControllerTest < Redmine::ControllerTest
assert_not_nil m = Project.find(2).enabled_module('news')
assert_no_difference 'Watcher.count' do
- xhr :post, :watch, :params => {:object_type => 'enabled_module', :object_id => m.id.to_s}
+ post :watch, :params => {:object_type => 'enabled_module', :object_id => m.id.to_s}, :xhr => true
assert_response 403
end
end
@@ -91,7 +91,7 @@ class WatchersControllerTest < Redmine::ControllerTest
Role.find(2).remove_permission! :view_issues
@request.session[:user_id] = 3
assert_no_difference('Watcher.count') do
- xhr :post, :watch, :params => {:object_type => 'issue', :object_id => '1'}
+ post :watch, :params => {:object_type => 'issue', :object_id => '1'}, :xhr => true
assert_response 403
end
end
@@ -99,7 +99,7 @@ class WatchersControllerTest < Redmine::ControllerTest
def test_watch_invalid_class_should_respond_with_404
@request.session[:user_id] = 3
assert_no_difference('Watcher.count') do
- xhr :post, :watch, :params => {:object_type => 'foo', :object_id => '1'}
+ post :watch, :params => {:object_type => 'foo', :object_id => '1'}, :xhr => true
assert_response 404
end
end
@@ -107,7 +107,7 @@ class WatchersControllerTest < Redmine::ControllerTest
def test_watch_invalid_object_should_respond_with_404
@request.session[:user_id] = 3
assert_no_difference('Watcher.count') do
- xhr :post, :watch, :params => {:object_type => 'issue', :object_id => '999'}
+ post :watch, :params => {:object_type => 'issue', :object_id => '999'}, :xhr => true
assert_response 404
end
end
@@ -125,7 +125,7 @@ class WatchersControllerTest < Redmine::ControllerTest
def test_unwatch
@request.session[:user_id] = 3
assert_difference('Watcher.count', -1) do
- xhr :delete, :unwatch, :params => {:object_type => 'issue', :object_id => '2'}
+ delete :unwatch, :params => {:object_type => 'issue', :object_id => '2'}, :xhr => true
assert_response :success
assert_include '$(".issue-2-watcher")', response.body
end
@@ -138,7 +138,7 @@ class WatchersControllerTest < Redmine::ControllerTest
Watcher.create!(:user_id => 3, :watchable => Issue.find(3))
assert_difference('Watcher.count', -2) do
- xhr :delete, :unwatch, :params => {:object_type => 'issue', :object_id => ['1', '3']}
+ delete :unwatch, :params => {:object_type => 'issue', :object_id => ['1', '3']}, :xhr => true
assert_response :success
assert_include '$(".issue-bulk-watcher")', response.body
end
@@ -148,28 +148,28 @@ class WatchersControllerTest < Redmine::ControllerTest
def test_new
@request.session[:user_id] = 2
- xhr :get, :new, :params => {:object_type => 'issue', :object_id => '2'}
+ get :new, :params => {:object_type => 'issue', :object_id => '2'}, :xhr => true
assert_response :success
assert_match /ajax-modal/, response.body
end
def test_new_with_multiple_objects
@request.session[:user_id] = 2
- xhr :get, :new, :params => {:object_type => 'issue', :object_id => ['1', '2']}
+ get :new, :params => {:object_type => 'issue', :object_id => ['1', '2']}, :xhr => true
assert_response :success
assert_match /ajax-modal/, response.body
end
def test_new_for_new_record_with_project_id
@request.session[:user_id] = 2
- xhr :get, :new, :params => {:project_id => 1}
+ get :new, :params => {:project_id => 1}, :xhr => true
assert_response :success
assert_match /ajax-modal/, response.body
end
def test_new_for_new_record_with_project_identifier
@request.session[:user_id] = 2
- xhr :get, :new, :params => {:project_id => 'ecookbook'}
+ get :new, :params => {:project_id => 'ecookbook'}, :xhr => true
assert_response :success
assert_match /ajax-modal/, response.body
end
@@ -190,10 +190,10 @@ class WatchersControllerTest < Redmine::ControllerTest
def test_create
@request.session[:user_id] = 2
assert_difference('Watcher.count') do
- xhr :post, :create, :params => {
+ post :create, :params => {
:object_type => 'issue', :object_id => '2',
:watcher => {:user_id => '4'}
- }
+ }, :xhr => true
assert_response :success
assert_match /watchers/, response.body
assert_match /ajax-modal/, response.body
@@ -204,10 +204,10 @@ class WatchersControllerTest < Redmine::ControllerTest
def test_create_with_mutiple_users
@request.session[:user_id] = 2
assert_difference('Watcher.count', 2) do
- xhr :post, :create, :params => {
+ post :create, :params => {
:object_type => 'issue', :object_id => '2',
:watcher => {:user_ids => ['4', '7']}
- }
+ }, :xhr => true
assert_response :success
assert_match /watchers/, response.body
assert_match /ajax-modal/, response.body
@@ -219,10 +219,10 @@ class WatchersControllerTest < Redmine::ControllerTest
def test_create_with_mutiple_objects
@request.session[:user_id] = 2
assert_difference('Watcher.count', 4) do
- xhr :post, :create, :params => {
+ post :create, :params => {
:object_type => 'issue', :object_id => ['1', '2'],
:watcher => {:user_ids => ['4', '7']}
- }
+ }, :xhr => true
assert_response :success
assert_match /watchers/, response.body
assert_match /ajax-modal/, response.body
@@ -235,7 +235,7 @@ class WatchersControllerTest < Redmine::ControllerTest
def test_autocomplete_on_watchable_creation
@request.session[:user_id] = 2
- xhr :get, :autocomplete_for_user, :params => {:q => 'mi', :project_id => 'ecookbook'}
+ get :autocomplete_for_user, :params => {:q => 'mi', :project_id => 'ecookbook'}, :xhr => true
assert_response :success
assert_select 'input', :count => 4
assert_select 'input[name=?][value="1"]', 'watcher[user_ids][]'
@@ -250,17 +250,17 @@ class WatchersControllerTest < Redmine::ControllerTest
user = User.generate!(:firstname => 'issue15622')
membership = user.membership(project)
assert_nil membership
- xhr :get, :autocomplete_for_user, :params => {:q => 'issue15622', :project_id => 'ecookbook'}
+ get :autocomplete_for_user, :params => {:q => 'issue15622', :project_id => 'ecookbook'}, :xhr => true
assert_response :success
assert_select 'input', :count => 1
end
def test_autocomplete_on_watchable_update
@request.session[:user_id] = 2
- xhr :get, :autocomplete_for_user, :params => {
+ get :autocomplete_for_user, :params => {
:object_type => 'issue', :object_id => '2',
:project_id => 'ecookbook', :q => 'mi'
- }
+ }, :xhr => true
assert_response :success
assert_select 'input', :count => 3
assert_select 'input[name=?][value="2"]', 'watcher[user_ids][]'
@@ -275,18 +275,18 @@ class WatchersControllerTest < Redmine::ControllerTest
membership = user.membership(project)
assert_nil membership
- xhr :get, :autocomplete_for_user, :params => {
+ get :autocomplete_for_user, :params => {
:object_type => 'issue', :object_id => '2',
:project_id => 'ecookbook', :q => 'issue15622'
- }
+ }, :xhr => true
assert_response :success
assert_select 'input', :count => 1
assert_difference('Watcher.count', 1) do
- xhr :post, :create, :params => {
+ post :create, :params => {
:object_type => 'issue', :object_id => '2',
:watcher => {:user_ids => ["#{user.id}"]}
- }
+ }, :xhr => true
assert_response :success
assert_match /watchers/, response.body
assert_match /ajax-modal/, response.body
@@ -302,7 +302,7 @@ class WatchersControllerTest < Redmine::ControllerTest
User.add_to_project(visible, Project.find(1))
@request.session[:user_id] = 2
- xhr :get, :autocomplete_for_user, :params => {:q => 'autocomp', :project_id => 'ecookbook'}
+ get :autocomplete_for_user, :params => {:q => 'autocomp', :project_id => 'ecookbook'}, :xhr => true
assert_response :success
assert_include visible.name, response.body
@@ -312,9 +312,9 @@ class WatchersControllerTest < Redmine::ControllerTest
def test_append
@request.session[:user_id] = 2
assert_no_difference 'Watcher.count' do
- xhr :post, :append, :params => {
+ post :append, :params => {
:watcher => {:user_ids => ['4', '7']}, :project_id => 'ecookbook'
- }
+ }, :xhr => true
assert_response :success
assert_include 'watchers_inputs', response.body
assert_include 'issue[watcher_user_ids][]', response.body
@@ -323,7 +323,7 @@ class WatchersControllerTest < Redmine::ControllerTest
def test_append_without_user_should_render_nothing
@request.session[:user_id] = 2
- xhr :post, :append, :params => {:project_id => 'ecookbook'}
+ post :append, :params => {:project_id => 'ecookbook'}, :xhr => true
assert_response :success
assert response.body.blank?
end
@@ -343,9 +343,9 @@ class WatchersControllerTest < Redmine::ControllerTest
def test_destroy
@request.session[:user_id] = 2
assert_difference('Watcher.count', -1) do
- xhr :delete, :destroy, :params => {
+ delete :destroy, :params => {
:object_type => 'issue', :object_id => '2', :user_id => '3'
- }
+ }, :xhr => true
assert_response :success
assert_match /watchers/, response.body
end
@@ -359,9 +359,9 @@ class WatchersControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_difference('Watcher.count', -1) do
- xhr :delete, :destroy, :params => {
+ delete :destroy, :params => {
:object_type => 'issue', :object_id => '2', :user_id => '3'
- }
+ }, :xhr => true
assert_response :success
assert_match /watchers/, response.body
end
diff --git a/test/functional/wiki_controller_test.rb b/test/functional/wiki_controller_test.rb
index 1cc0a3b7d..8931b4ec7 100644
--- a/test/functional/wiki_controller_test.rb
+++ b/test/functional/wiki_controller_test.rb
@@ -188,7 +188,7 @@ class WikiControllerTest < Redmine::ControllerTest
def test_get_new_xhr
@request.session[:user_id] = 2
- xhr :get, :new, :params => {:project_id => 'ecookbook'}
+ get :new, :params => {:project_id => 'ecookbook'}, :xhr => true
assert_response :success
assert_include 'Unallowed characters', response.body
end
@@ -203,7 +203,7 @@ class WikiControllerTest < Redmine::ControllerTest
def test_post_new_xhr_with_valid_title_should_redirect_to_edit
@request.session[:user_id] = 2
- xhr :post, :new, :params => {:project_id => 'ecookbook', :title => 'New Page'}
+ post :new, :params => {:project_id => 'ecookbook', :title => 'New Page'}, :xhr => true
assert_response :success
assert_equal 'window.location = "/projects/ecookbook/wiki/New_Page"', response.body
end
@@ -228,7 +228,7 @@ class WikiControllerTest < Redmine::ControllerTest
def test_post_new_xhr_with_invalid_title_should_display_errors
@request.session[:user_id] = 2
- xhr :post, :new, :params => {:project_id => 'ecookbook', :title => 'Another page'}
+ post :new, :params => {:project_id => 'ecookbook', :title => 'Another page'}, :xhr => true
assert_response :success
assert_include 'Title has already been taken', response.body
end
@@ -581,7 +581,7 @@ class WikiControllerTest < Redmine::ControllerTest
def test_preview
@request.session[:user_id] = 2
- xhr :post, :preview, :params => {
+ post :preview, :params => {
:project_id => 1,
:id => 'CookBook_documentation',
:content => {
@@ -589,14 +589,14 @@ class WikiControllerTest < Redmine::ControllerTest
:text => 'this is a *previewed text*',
:version => 3
}
- }
+ }, :xhr => true
assert_response :success
assert_select 'strong', :text => /previewed text/
end
def test_preview_new_page
@request.session[:user_id] = 2
- xhr :post, :preview, :params => {
+ post :preview, :params => {
:project_id => 1,
:id => 'New page',
:content => {
@@ -604,7 +604,7 @@ class WikiControllerTest < Redmine::ControllerTest
:comments => '',
:version => 0
}
- }
+ }, :xhr => true
assert_response :success
assert_select 'h1', :text => /New page/
end
diff --git a/test/functional/wikis_controller_test.rb b/test/functional/wikis_controller_test.rb
index 7a37ca265..ed68269ce 100644
--- a/test/functional/wikis_controller_test.rb
+++ b/test/functional/wikis_controller_test.rb
@@ -29,7 +29,7 @@ class WikisControllerTest < Redmine::ControllerTest
assert_nil Project.find(3).wiki
assert_difference 'Wiki.count' do
- xhr :post, :edit, :params => {:id => 3, :wiki => { :start_page => 'Start page' }}
+ post :edit, :params => {:id => 3, :wiki => { :start_page => 'Start page' }}, :xhr => true
assert_response :success
assert_equal 'text/javascript', response.content_type
end
@@ -43,7 +43,7 @@ class WikisControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 1
assert_no_difference 'Wiki.count' do
- xhr :post, :edit, :params => {:id => 3, :wiki => { :start_page => '' }}
+ post :edit, :params => {:id => 3, :wiki => { :start_page => '' }}, :xhr => true
assert_response :success
assert_equal 'text/javascript', response.content_type
end
@@ -56,7 +56,7 @@ class WikisControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 1
assert_no_difference 'Wiki.count' do
- xhr :post, :edit, :params => {:id => 1, :wiki => { :start_page => 'Other start page' }}
+ post :edit, :params => {:id => 1, :wiki => { :start_page => 'Other start page' }}, :xhr => true
assert_response :success
assert_equal 'text/javascript', response.content_type
end