diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-05-12 23:58:58 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-05-12 23:58:58 +0000 |
commit | 5ca257181fe17dd3564a97789b4d31917e41af98 (patch) | |
tree | 5d6dc234e0c30a5bdd97b0425a39ff5272784d89 /test/unit/repository_test.rb | |
parent | 4ee79a60efa1a4a8dc6ceabc92634ea2269d1095 (diff) | |
download | redmine-5ca257181fe17dd3564a97789b4d31917e41af98.tar.gz redmine-5ca257181fe17dd3564a97789b4d31917e41af98.zip |
scm: add a test of a repository model method "merge_extra_info()" in unit test (#7146, #7047).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5767 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/repository_test.rb')
-rw-r--r-- | test/unit/repository_test.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/unit/repository_test.rb b/test/unit/repository_test.rb index f1f80e272..cb7ce7dca 100644 --- a/test/unit/repository_test.rb +++ b/test/unit/repository_test.rb @@ -202,4 +202,37 @@ class RepositoryTest < ActiveSupport::TestCase assert klass.scm_adapter_class assert_equal true, klass.scm_available end + + def test_merge_extra_info + repo = Repository::Subversion.new(:project => Project.find(3)) + assert !repo.save + repo.url = "svn://localhost" + assert repo.save + repo.reload + project = Project.find(3) + assert_equal repo, project.repository + assert_nil repo.extra_info + h1 = {"test_1" => {"test_11" => "test_value_11"}} + repo.merge_extra_info(h1) + assert_equal h1, repo.extra_info + h2 = {"test_2" => { + "test_21" => "test_value_21", + "test_22" => "test_value_22", + }} + repo.merge_extra_info(h2) + assert_equal (h = {"test_11" => "test_value_11"}), + repo.extra_info["test_1"] + assert_equal "test_value_21", + repo.extra_info["test_2"]["test_21"] + h3 = {"test_2" => { + "test_23" => "test_value_23", + "test_24" => "test_value_24", + }} + repo.merge_extra_info(h3) + assert_equal (h = {"test_11" => "test_value_11"}), + repo.extra_info["test_1"] + assert_nil repo.extra_info["test_2"]["test_21"] + assert_equal "test_value_23", + repo.extra_info["test_2"]["test_23"] + end end |