summaryrefslogtreecommitdiffstats
path: root/test/functional
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-03-02 11:31:44 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-03-02 11:31:44 +0000
commit9ffccf5304dccc86e0ed64c9f4791c527e52982d (patch)
tree074babc2d26302e0090a3a0035c467d98cd27515 /test/functional
parent8fda77dc4022bec7b87874de3b7c36291642416c (diff)
downloadredmine-9ffccf5304dccc86e0ed64c9f4791c527e52982d.tar.gz
redmine-9ffccf5304dccc86e0ed64c9f4791c527e52982d.zip
Adds functional test for #test_connection.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9053 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/ldap_auth_sources_controller_test.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/functional/ldap_auth_sources_controller_test.rb b/test/functional/ldap_auth_sources_controller_test.rb
index b24cbc281..bfb2c569e 100644
--- a/test/functional/ldap_auth_sources_controller_test.rb
+++ b/test/functional/ldap_auth_sources_controller_test.rb
@@ -93,4 +93,22 @@ class LdapAuthSourcesControllerTest < ActionController::TestCase
post :destroy, :id => 1
end
end
+
+ def test_test_connection
+ AuthSourceLdap.any_instance.stubs(:test_connection).returns(true)
+
+ get :test_connection, :id => 1
+ assert_redirected_to '/ldap_auth_sources'
+ assert_not_nil flash[:notice]
+ assert_match /successful/i, flash[:notice]
+ end
+
+ def test_test_connection_with_failure
+ AuthSourceLdap.any_instance.stubs(:test_connection).raises(Exception.new("Something went wrong"))
+
+ get :test_connection, :id => 1
+ assert_redirected_to '/ldap_auth_sources'
+ assert_not_nil flash[:error]
+ assert_include '(Something went wrong)', flash[:error]
+ end
end