summaryrefslogtreecommitdiffstats
path: root/test/functional
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-07-21 20:49:14 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-07-21 20:49:14 +0000
commit8b107b6058257fb44d9ddca7e55d58033cc2b023 (patch)
tree73f3604107387b53196152cee2ca16a6145f1b18 /test/functional
parent596a196f2e7e8355f102ad6b6e59e03d77230eff (diff)
downloadredmine-8b107b6058257fb44d9ddca7e55d58033cc2b023.tar.gz
redmine-8b107b6058257fb44d9ddca7e55d58033cc2b023.zip
Don't use render :text => "".
git-svn-id: http://svn.redmine.org/redmine/trunk@15731 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/mail_handler_controller_test.rb2
-rw-r--r--test/functional/sys_controller_test.rb2
-rw-r--r--test/functional/watchers_controller_test.rb45
3 files changed, 49 insertions, 0 deletions
diff --git a/test/functional/mail_handler_controller_test.rb b/test/functional/mail_handler_controller_test.rb
index 864e30d20..91d31b56c 100644
--- a/test/functional/mail_handler_controller_test.rb
+++ b/test/functional/mail_handler_controller_test.rb
@@ -74,6 +74,7 @@ class MailHandlerControllerTest < Redmine::ControllerTest
post :index, :key => 'secret', :email => IO.read(File.join(FIXTURES_PATH, 'ticket_on_given_project.eml'))
end
assert_response 403
+ assert_include 'Access denied', response.body
end
def test_should_not_allow_with_wrong_key
@@ -84,6 +85,7 @@ class MailHandlerControllerTest < Redmine::ControllerTest
post :index, :key => 'wrong', :email => IO.read(File.join(FIXTURES_PATH, 'ticket_on_given_project.eml'))
end
assert_response 403
+ assert_include 'Access denied', response.body
end
def test_new
diff --git a/test/functional/sys_controller_test.rb b/test/functional/sys_controller_test.rb
index 66beeca0b..becd4ec42 100644
--- a/test/functional/sys_controller_test.rb
+++ b/test/functional/sys_controller_test.rb
@@ -113,6 +113,7 @@ class SysControllerTest < Redmine::ControllerTest
with_settings :sys_api_enabled => '0' do
get :projects
assert_response 403
+ assert_include 'Access denied', response.body
end
end
@@ -127,6 +128,7 @@ class SysControllerTest < Redmine::ControllerTest
with_settings :sys_api_enabled => 'my_secret_key' do
get :projects, :params => {:key => 'wrong_key'}
assert_response 403
+ assert_include 'Access denied', response.body
end
end
end
diff --git a/test/functional/watchers_controller_test.rb b/test/functional/watchers_controller_test.rb
index 422fc6cda..3cec7a075 100644
--- a/test/functional/watchers_controller_test.rb
+++ b/test/functional/watchers_controller_test.rb
@@ -25,6 +25,16 @@ class WatchersControllerTest < Redmine::ControllerTest
User.current = nil
end
+ def test_watch_a_single_object_as_html
+ @request.session[:user_id] = 3
+ assert_difference('Watcher.count') do
+ post :watch, :params => {:object_type => 'issue', :object_id => '1'}
+ assert_response :success
+ assert_include 'Watcher added', response.body
+ end
+ assert Issue.find(1).watched_by?(User.find(3))
+ end
+
def test_watch_a_single_object
@request.session[:user_id] = 3
assert_difference('Watcher.count') do
@@ -102,6 +112,16 @@ class WatchersControllerTest < Redmine::ControllerTest
end
end
+ def test_unwatch_as_html
+ @request.session[:user_id] = 3
+ assert_difference('Watcher.count', -1) do
+ delete :unwatch, :params => {:object_type => 'issue', :object_id => '2'}
+ assert_response :success
+ assert_include 'Watcher removed', response.body
+ end
+ assert !Issue.find(1).watched_by?(User.find(3))
+ end
+
def test_unwatch
@request.session[:user_id] = 3
assert_difference('Watcher.count', -1) do
@@ -154,6 +174,19 @@ class WatchersControllerTest < Redmine::ControllerTest
assert_match /ajax-modal/, response.body
end
+ def test_create_as_html
+ @request.session[:user_id] = 2
+ assert_difference('Watcher.count') do
+ post :create, :params => {
+ :object_type => 'issue', :object_id => '2',
+ :watcher => {:user_id => '4'}
+ }
+ assert_response :success
+ assert_include 'Watcher added', response.body
+ end
+ assert Issue.find(2).watched_by?(User.find(4))
+ end
+
def test_create
@request.session[:user_id] = 2
assert_difference('Watcher.count') do
@@ -295,6 +328,18 @@ class WatchersControllerTest < Redmine::ControllerTest
assert response.body.blank?
end
+ def test_destroy_as_html
+ @request.session[:user_id] = 2
+ assert_difference('Watcher.count', -1) do
+ delete :destroy, :params => {
+ :object_type => 'issue', :object_id => '2', :user_id => '3'
+ }
+ assert_response :success
+ assert_include 'Watcher removed', response.body
+ end
+ assert !Issue.find(2).watched_by?(User.find(3))
+ end
+
def test_destroy
@request.session[:user_id] = 2
assert_difference('Watcher.count', -1) do