Mercurial > hg > soundsoftware-site
comparison .svn/pristine/bd/bd14f74ff8fe3ceb6d84b4dbead570fb4b8e960a.svn-base @ 1295:622f24f53b42 redmine-2.3
Update to Redmine SVN revision 11972 on 2.3-stable branch
author | Chris Cannam |
---|---|
date | Fri, 14 Jun 2013 09:02:21 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1294:3e4c3460b6ca | 1295:622f24f53b42 |
---|---|
1 # Redmine - project management software | |
2 # Copyright (C) 2006-2013 Jean-Philippe Lang | |
3 # | |
4 # This program is free software; you can redistribute it and/or | |
5 # modify it under the terms of the GNU General Public License | |
6 # as published by the Free Software Foundation; either version 2 | |
7 # of the License, or (at your option) any later version. | |
8 # | |
9 # This program is distributed in the hope that it will be useful, | |
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 # GNU General Public License for more details. | |
13 # | |
14 # You should have received a copy of the GNU General Public License | |
15 # along with this program; if not, write to the Free Software | |
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 | |
18 require File.expand_path('../../../../../../test_helper', __FILE__) | |
19 | |
20 class FilesystemAdapterTest < ActiveSupport::TestCase | |
21 REPOSITORY_PATH = Rails.root.join('tmp/test/filesystem_repository').to_s | |
22 | |
23 if File.directory?(REPOSITORY_PATH) | |
24 def setup | |
25 @adapter = Redmine::Scm::Adapters::FilesystemAdapter.new(REPOSITORY_PATH) | |
26 end | |
27 | |
28 def test_entries | |
29 assert_equal 3, @adapter.entries.size | |
30 assert_equal ["dir", "japanese", "test"], @adapter.entries.collect(&:name) | |
31 assert_equal ["dir", "japanese", "test"], @adapter.entries(nil).collect(&:name) | |
32 assert_equal ["dir", "japanese", "test"], @adapter.entries("/").collect(&:name) | |
33 ["dir", "/dir", "/dir/", "dir/"].each do |path| | |
34 assert_equal ["subdir", "dirfile"], @adapter.entries(path).collect(&:name) | |
35 end | |
36 # If y try to use "..", the path is ignored | |
37 ["/../","dir/../", "..", "../", "/..", "dir/.."].each do |path| | |
38 assert_equal ["dir", "japanese", "test"], @adapter.entries(path).collect(&:name), | |
39 ".. must be ignored in path argument" | |
40 end | |
41 end | |
42 | |
43 def test_cat | |
44 assert_equal "TEST CAT\n", @adapter.cat("test") | |
45 assert_equal "TEST CAT\n", @adapter.cat("/test") | |
46 # Revision number is ignored | |
47 assert_equal "TEST CAT\n", @adapter.cat("/test", 1) | |
48 end | |
49 | |
50 def test_path_encoding_default_utf8 | |
51 adpt1 = Redmine::Scm::Adapters::FilesystemAdapter.new( | |
52 REPOSITORY_PATH | |
53 ) | |
54 assert_equal "UTF-8", adpt1.path_encoding | |
55 adpt2 = Redmine::Scm::Adapters::FilesystemAdapter.new( | |
56 REPOSITORY_PATH, | |
57 nil, | |
58 nil, | |
59 nil, | |
60 "" | |
61 ) | |
62 assert_equal "UTF-8", adpt2.path_encoding | |
63 end | |
64 else | |
65 puts "Filesystem test repository NOT FOUND. Skipping unit tests !!! See doc/RUNNING_TESTS." | |
66 def test_fake; assert true end | |
67 end | |
68 end |