From 45a0daa16a140d2d41a114e2fc2270a6fa688c93 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 4 Sep 2016 17:10:12 +0000 Subject: 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 --- test/unit/repository_test.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test') 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 -- cgit v1.2.3