summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-09-04 17:10:12 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-09-04 17:10:12 +0000
commit45a0daa16a140d2d41a114e2fc2270a6fa688c93 (patch)
treeb15a58999867a9d721b76f0717b643fcb8bd7fd2 /test
parentdcf2e15b0617e4e0aa2cc4b7dde2c59b688c535a (diff)
downloadredmine-45a0daa16a140d2d41a114e2fc2270a6fa688c93.tar.gz
redmine-45a0daa16a140d2d41a114e2fc2270a6fa688c93.zip
Be more conservative when fetching constants in Repository.factory (#23758).
Patch by Holger Just. git-svn-id: http://svn.redmine.org/redmine/trunk@15816 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/unit/repository_test.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/unit/repository_test.rb b/test/unit/repository_test.rb
index 238c29d64..da3273ead 100644
--- a/test/unit/repository_test.rb
+++ b/test/unit/repository_test.rb
@@ -496,4 +496,18 @@ class RepositoryTest < ActiveSupport::TestCase
Repository::Subversion.any_instance.expects(:fetch_changesets).twice.returns(true)
Repository.fetch_changesets
end
+
+ def test_repository_class
+ assert_equal Repository::Subversion, Repository.repository_class('Subversion')
+ assert_equal Repository::Git, Repository.repository_class('Git')
+ assert_nil Repository.factory('Serializer')
+ assert_nil Repository.factory('Query')
+ end
+
+ def test_factory
+ assert_instance_of Repository::Subversion, Repository.factory('Subversion')
+ assert_instance_of Repository::Git, Repository.factory('Git')
+ assert_nil Repository.factory('Serializer')
+ assert_nil Repository.factory('Query')
+ end
end