##// END OF EJS Templates
Speeds up rendering of the project list for users who belong to hundreds of projects....
Speeds up rendering of the project list for users who belong to hundreds of projects. git-svn-id: http://svn.redmine.org/redmine/trunk@16123 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r14856:cda9c63d9c21
r15741:f8df935dcada
Show More
repository_filesystem_test.rb
88 lines | 3.1 KiB | text/x-ruby | RubyLexer
/ test / unit / repository_filesystem_test.rb
Toshi MARUYAMA
scm: filesystem: remove trailing white-spaces from unit model test....
r5583 # Redmine - project management software
Jean-Philippe Lang
Updates copyright for 2016....
r14856 # Copyright (C) 2006-2016 Jean-Philippe Lang
Jean-Philippe Lang
Adds Filesystem adapter (patch #1393 by Paul R)....
r1494 #
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
Toshi MARUYAMA
scm: filesystem: remove trailing white-spaces from unit model test....
r5583 #
Jean-Philippe Lang
Adds Filesystem adapter (patch #1393 by Paul R)....
r1494 # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
Toshi MARUYAMA
scm: filesystem: remove trailing white-spaces from unit model test....
r5583 #
Jean-Philippe Lang
Adds Filesystem adapter (patch #1393 by Paul R)....
r1494 # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Jean-Baptiste Barth
Use absolute paths in test/**/* requires for Ruby 1.9.2 compatibility. #4050...
r4395 require File.expand_path('../../test_helper', __FILE__)
Jean-Philippe Lang
Adds Filesystem adapter (patch #1393 by Paul R)....
r1494
Eric Davis
Upgraded to Rails 2.3.4 (#3597)...
r2773 class RepositoryFilesystemTest < ActiveSupport::TestCase
Jean-Philippe Lang
Adds Filesystem adapter (patch #1393 by Paul R)....
r1494 fixtures :projects
Toshi MARUYAMA
scm: filesystem: code clean up unit model test....
r5072
Toshi MARUYAMA
scm: filesystem: add test to override human_attribute_name of "Root directory"...
r8847 include Redmine::I18n
Toshi MARUYAMA
scm: filesystem: replace RAILS_ROOT to Rails.root in unit model test....
r5934 REPOSITORY_PATH = Rails.root.join('tmp/test/filesystem_repository').to_s
Toshi MARUYAMA
scm: filesystem: code clean up unit model test....
r5072
Jean-Philippe Lang
Adds Filesystem adapter (patch #1393 by Paul R)....
r1494 def setup
Toshi MARUYAMA
scm: filesystem: change project id of unit model test from 1 to 3....
r5073 @project = Project.find(3)
Jean-Philippe Lang
Adds Filesystem adapter (patch #1393 by Paul R)....
r1494 Setting.enabled_scm << 'Filesystem' unless Setting.enabled_scm.include?('Filesystem')
Toshi MARUYAMA
scm: filesystem: code clean up unit model test....
r5742 @repository = Repository::Filesystem.create(
:project => @project,
:url => REPOSITORY_PATH
)
assert @repository
Jean-Philippe Lang
Adds Filesystem adapter (patch #1393 by Paul R)....
r1494 end
Toshi MARUYAMA
scm: filesystem: code clean up unit model test....
r5072
Toshi MARUYAMA
scm: filesystem: add test to override human_attribute_name of "Root directory"...
r8847 def test_blank_root_directory_error_message
set_language_if_valid 'en'
repo = Repository::Filesystem.new(
:project => @project,
:identifier => 'test'
)
assert !repo.save
Jean-Philippe Lang
Replaced "can't" with "cannot" in error messages....
r13399 assert_include "Root directory cannot be blank",
Toshi MARUYAMA
scm: filesystem: add test to override human_attribute_name of "Root directory"...
r8847 repo.errors.full_messages
end
def test_blank_root_directory_error_message_fr
set_language_if_valid 'fr'
Jean-Philippe Lang
Merged rails-4.1 branch (#14534)....
r13100 str = "R\xc3\xa9pertoire racine doit \xc3\xaatre renseign\xc3\xa9(e)".force_encoding('UTF-8')
Toshi MARUYAMA
scm: filesystem: add test to override human_attribute_name of "Root directory"...
r8847 repo = Repository::Filesystem.new(
:project => @project,
:url => "",
:identifier => 'test',
:path_encoding => ''
)
assert !repo.save
assert_include str, repo.errors.full_messages
end
Toshi MARUYAMA
scm: filesystem: remove trailing white-spaces from unit model test....
r5583 if File.directory?(REPOSITORY_PATH)
Jean-Philippe Lang
Adds Filesystem adapter (patch #1393 by Paul R)....
r1494 def test_fetch_changesets
Toshi MARUYAMA
Rails3: scm: filesystem: replace @repository.reload to @project.reload of test_fetch_changesets at unit model test...
r7044 assert_equal 0, @repository.changesets.count
Jean-Philippe Lang
Renamed #changes association to #filechanges (clash with AR::Base.changes that triggers errors with Rails 3.2.5)....
r9576 assert_equal 0, @repository.filechanges.count
Jean-Philippe Lang
Adds Filesystem adapter (patch #1393 by Paul R)....
r1494 @repository.fetch_changesets
Toshi MARUYAMA
Rails3: scm: filesystem: replace @repository.reload to @project.reload of test_fetch_changesets at unit model test...
r7044 @project.reload
Jean-Philippe Lang
Adds Filesystem adapter (patch #1393 by Paul R)....
r1494 assert_equal 0, @repository.changesets.count
Jean-Philippe Lang
Renamed #changes association to #filechanges (clash with AR::Base.changes that triggers errors with Rails 3.2.5)....
r9576 assert_equal 0, @repository.filechanges.count
Jean-Philippe Lang
Adds Filesystem adapter (patch #1393 by Paul R)....
r1494 end
Toshi MARUYAMA
scm: filesystem: code clean up unit model test....
r5072
Jean-Philippe Lang
Adds Filesystem adapter (patch #1393 by Paul R)....
r1494 def test_entries
Jean-Philippe Lang
Fixed that Repository#entries returns an Array....
r9621 entries = @repository.entries("", 2)
assert_kind_of Redmine::Scm::Adapters::Entries, entries
assert_equal 3, entries.size
end
def test_entries_in_directory
Jean-Philippe Lang
Adds Filesystem adapter (patch #1393 by Paul R)....
r1494 assert_equal 2, @repository.entries("dir", 3).size
end
def test_cat
assert_equal "TEST CAT\n", @repository.scm.cat("test")
end
else
puts "Filesystem test repository NOT FOUND. Skipping unit tests !!! See doc/RUNNING_TESTS."
def test_fake; assert true end
end
end