Mercurial > hg > soundsoftware-site
comparison .svn/pristine/5d/5da0b4c4bee024389ce63f0775bf42e759cc86ef.svn-base @ 909:cbb26bc654de redmine-1.3
Update to Redmine 1.3-stable branch (Redmine SVN rev 8964)
author | Chris Cannam |
---|---|
date | Fri, 24 Feb 2012 19:09:32 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
908:c6c2cbd0afee | 909:cbb26bc654de |
---|---|
1 | |
2 require File.expand_path('../../../../../../test_helper', __FILE__) | |
3 | |
4 class FilesystemAdapterTest < ActiveSupport::TestCase | |
5 REPOSITORY_PATH = Rails.root.join('tmp/test/filesystem_repository').to_s | |
6 | |
7 if File.directory?(REPOSITORY_PATH) | |
8 def setup | |
9 @adapter = Redmine::Scm::Adapters::FilesystemAdapter.new(REPOSITORY_PATH) | |
10 end | |
11 | |
12 def test_entries | |
13 assert_equal 3, @adapter.entries.size | |
14 assert_equal ["dir", "japanese", "test"], @adapter.entries.collect(&:name) | |
15 assert_equal ["dir", "japanese", "test"], @adapter.entries(nil).collect(&:name) | |
16 assert_equal ["dir", "japanese", "test"], @adapter.entries("/").collect(&:name) | |
17 ["dir", "/dir", "/dir/", "dir/"].each do |path| | |
18 assert_equal ["subdir", "dirfile"], @adapter.entries(path).collect(&:name) | |
19 end | |
20 # If y try to use "..", the path is ignored | |
21 ["/../","dir/../", "..", "../", "/..", "dir/.."].each do |path| | |
22 assert_equal ["dir", "japanese", "test"], @adapter.entries(path).collect(&:name), | |
23 ".. must be ignored in path argument" | |
24 end | |
25 end | |
26 | |
27 def test_cat | |
28 assert_equal "TEST CAT\n", @adapter.cat("test") | |
29 assert_equal "TEST CAT\n", @adapter.cat("/test") | |
30 # Revision number is ignored | |
31 assert_equal "TEST CAT\n", @adapter.cat("/test", 1) | |
32 end | |
33 | |
34 def test_path_encoding_default_utf8 | |
35 adpt1 = Redmine::Scm::Adapters::FilesystemAdapter.new( | |
36 REPOSITORY_PATH | |
37 ) | |
38 assert_equal "UTF-8", adpt1.path_encoding | |
39 adpt2 = Redmine::Scm::Adapters::FilesystemAdapter.new( | |
40 REPOSITORY_PATH, | |
41 nil, | |
42 nil, | |
43 nil, | |
44 "" | |
45 ) | |
46 assert_equal "UTF-8", adpt2.path_encoding | |
47 end | |
48 else | |
49 puts "Filesystem test repository NOT FOUND. Skipping unit tests !!! See doc/RUNNING_TESTS." | |
50 def test_fake; assert true end | |
51 end | |
52 end |