Mercurial > hg > soundsoftware-site
comparison .svn/pristine/dc/dc4a8b889fb60778bdec8c2aea4b6206a1ffbc41.svn-base @ 1298:4f746d8966dd redmine_2.3_integration
Merge from redmine-2.3 branch to create new branch redmine-2.3-integration
author | Chris Cannam |
---|---|
date | Fri, 14 Jun 2013 09:28:30 +0100 |
parents | 622f24f53b42 |
children |
comparison
equal
deleted
inserted
replaced
1297:0a574315af3e | 1298:4f746d8966dd |
---|---|
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 RepositoryFilesystemTest < ActiveSupport::TestCase | |
21 fixtures :projects | |
22 | |
23 include Redmine::I18n | |
24 | |
25 REPOSITORY_PATH = Rails.root.join('tmp/test/filesystem_repository').to_s | |
26 | |
27 def setup | |
28 @project = Project.find(3) | |
29 Setting.enabled_scm << 'Filesystem' unless Setting.enabled_scm.include?('Filesystem') | |
30 @repository = Repository::Filesystem.create( | |
31 :project => @project, | |
32 :url => REPOSITORY_PATH | |
33 ) | |
34 assert @repository | |
35 end | |
36 | |
37 def test_blank_root_directory_error_message | |
38 set_language_if_valid 'en' | |
39 repo = Repository::Filesystem.new( | |
40 :project => @project, | |
41 :identifier => 'test' | |
42 ) | |
43 assert !repo.save | |
44 assert_include "Root directory can't be blank", | |
45 repo.errors.full_messages | |
46 end | |
47 | |
48 def test_blank_root_directory_error_message_fr | |
49 set_language_if_valid 'fr' | |
50 str = "R\xc3\xa9pertoire racine doit \xc3\xaatre renseign\xc3\xa9(e)" | |
51 str.force_encoding('UTF-8') if str.respond_to?(:force_encoding) | |
52 repo = Repository::Filesystem.new( | |
53 :project => @project, | |
54 :url => "", | |
55 :identifier => 'test', | |
56 :path_encoding => '' | |
57 ) | |
58 assert !repo.save | |
59 assert_include str, repo.errors.full_messages | |
60 end | |
61 | |
62 if File.directory?(REPOSITORY_PATH) | |
63 def test_fetch_changesets | |
64 assert_equal 0, @repository.changesets.count | |
65 assert_equal 0, @repository.filechanges.count | |
66 @repository.fetch_changesets | |
67 @project.reload | |
68 assert_equal 0, @repository.changesets.count | |
69 assert_equal 0, @repository.filechanges.count | |
70 end | |
71 | |
72 def test_entries | |
73 entries = @repository.entries("", 2) | |
74 assert_kind_of Redmine::Scm::Adapters::Entries, entries | |
75 assert_equal 3, entries.size | |
76 end | |
77 | |
78 def test_entries_in_directory | |
79 assert_equal 2, @repository.entries("dir", 3).size | |
80 end | |
81 | |
82 def test_cat | |
83 assert_equal "TEST CAT\n", @repository.scm.cat("test") | |
84 end | |
85 else | |
86 puts "Filesystem test repository NOT FOUND. Skipping unit tests !!! See doc/RUNNING_TESTS." | |
87 def test_fake; assert true end | |
88 end | |
89 end |