To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Tag: | Revision:

root / test / unit / .svn / text-base / repository_filesystem_test.rb.svn-base @ 441:cbce1fd3b1b7

History | View | Annotate | Download (1.98 KB)

1 441:cbce1fd3b1b7 Chris
# Redmine - project management software
2
# Copyright (C) 2006-2011  Jean-Philippe Lang
3 0:513646585e45 Chris
#
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 441:cbce1fd3b1b7 Chris
#
9 0:513646585e45 Chris
# 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 441:cbce1fd3b1b7 Chris
#
14 0:513646585e45 Chris
# 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 119:8661b858af72 Chris
require File.expand_path('../../test_helper', __FILE__)
19 0:513646585e45 Chris
20
class RepositoryFilesystemTest < ActiveSupport::TestCase
21
  fixtures :projects
22 441:cbce1fd3b1b7 Chris
23 0:513646585e45 Chris
  # No '..' in the repository path
24
  REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/filesystem_repository'
25 441:cbce1fd3b1b7 Chris
26 0:513646585e45 Chris
  def setup
27 441:cbce1fd3b1b7 Chris
    @project = Project.find(3)
28 0:513646585e45 Chris
    Setting.enabled_scm << 'Filesystem' unless Setting.enabled_scm.include?('Filesystem')
29 441:cbce1fd3b1b7 Chris
    @repository = Repository::Filesystem.create(
30
                               :project => @project,
31
                               :url     => REPOSITORY_PATH
32
                                 )
33
    assert @repository
34 0:513646585e45 Chris
  end
35 441:cbce1fd3b1b7 Chris
36
  if File.directory?(REPOSITORY_PATH)
37 0:513646585e45 Chris
    def test_fetch_changesets
38
      @repository.fetch_changesets
39
      @repository.reload
40
      assert_equal 0, @repository.changesets.count
41
      assert_equal 0, @repository.changes.count
42
    end
43 441:cbce1fd3b1b7 Chris
44 0:513646585e45 Chris
    def test_entries
45 441:cbce1fd3b1b7 Chris
      assert_equal 3, @repository.entries("", 2).size
46 0:513646585e45 Chris
      assert_equal 2, @repository.entries("dir", 3).size
47
    end
48
49
    def test_cat
50
      assert_equal "TEST CAT\n", @repository.scm.cat("test")
51
    end
52
  else
53
    puts "Filesystem test repository NOT FOUND. Skipping unit tests !!! See doc/RUNNING_TESTS."
54
    def test_fake; assert true end
55
  end
56
end