##// 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_darcs_test.rb
129 lines | 4.5 KiB | text/x-ruby | RubyLexer
/ test / unit / repository_darcs_test.rb
Toshi MARUYAMA
scm: darcs: remove trailing white-spaces from unit model test....
r5920 # Redmine - project management software
Jean-Philippe Lang
Updates copyright for 2016....
r14856 # Copyright (C) 2006-2016 Jean-Philippe Lang
Jean-Philippe Lang
Merged Git support branch (r1200 to r1226)....
r1222 #
# 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: darcs: remove trailing white-spaces from unit model test....
r5920 #
Jean-Philippe Lang
Merged Git support branch (r1200 to r1226)....
r1222 # 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: darcs: remove trailing white-spaces from unit model test....
r5920 #
Jean-Philippe Lang
Merged Git support branch (r1200 to r1226)....
r1222 # 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
Merged Git support branch (r1200 to r1226)....
r1222
Eric Davis
Upgraded to Rails 2.3.4 (#3597)...
r2773 class RepositoryDarcsTest < ActiveSupport::TestCase
Jean-Philippe Lang
Merged Git support branch (r1200 to r1226)....
r1222 fixtures :projects
Toshi MARUYAMA
scm: darcs: change project id of unit app test from 1 to 3....
r4858
Toshi MARUYAMA
scm: darcs: add test to override human_attribute_name of "path to repository"...
r8839 include Redmine::I18n
Toshi MARUYAMA
scm: darcs: replace RAILS_ROOT to Rails.root in unit model test....
r5928 REPOSITORY_PATH = Rails.root.join('tmp/test/darcs_repository').to_s
Toshi MARUYAMA
scm: darcs: define NUM_REV as the number of test repository revisions at unit model test...
r6972 NUM_REV = 6
Toshi MARUYAMA
scm: darcs: change project id of unit app test from 1 to 3....
r4858
Jean-Philippe Lang
Merged Git support branch (r1200 to r1226)....
r1222 def setup
Toshi MARUYAMA
scm: darcs: change project id of unit app test from 1 to 3....
r4858 @project = Project.find(3)
Toshi MARUYAMA
scm: add feature of per project repository log encoding setting (#1735)....
r4862 @repository = Repository::Darcs.create(
Toshi MARUYAMA
scm: darcs: replace RAILS_ROOT to Rails.root in unit model test....
r5928 :project => @project,
:url => REPOSITORY_PATH,
:log_encoding => 'UTF-8'
)
Toshi MARUYAMA
scm: darcs: change project id of unit app test from 1 to 3....
r4858 assert @repository
Jean-Philippe Lang
Merged Git support branch (r1200 to r1226)....
r1222 end
Toshi MARUYAMA
scm: darcs: change project id of unit app test from 1 to 3....
r4858
Toshi MARUYAMA
scm: darcs: add test to override human_attribute_name of "path to repository"...
r8839 def test_blank_path_to_repository_error_message
set_language_if_valid 'en'
repo = Repository::Darcs.new(
:project => @project,
:identifier => 'test',
:log_encoding => 'UTF-8'
)
assert !repo.save
Jean-Philippe Lang
Replaced "can't" with "cannot" in error messages....
r13399 assert_include "Path to repository cannot be blank",
Toshi MARUYAMA
scm: darcs: add test to override human_attribute_name of "path to repository"...
r8839 repo.errors.full_messages
end
def test_blank_path_to_repository_error_message_fr
set_language_if_valid 'fr'
Jean-Philippe Lang
Merged rails-4.1 branch (#14534)....
r13100 str = "Chemin du d\xc3\xa9p\xc3\xb4t doit \xc3\xaatre renseign\xc3\xa9(e)".force_encoding('UTF-8')
Toshi MARUYAMA
scm: darcs: add test to override human_attribute_name of "path to repository"...
r8839 repo = Repository::Darcs.new(
:project => @project,
:url => "",
:identifier => 'test',
:log_encoding => 'UTF-8'
)
assert !repo.save
assert_include str, repo.errors.full_messages
end
Toshi MARUYAMA
scm: darcs: remove trailing white-spaces from unit model test....
r5920 if File.directory?(REPOSITORY_PATH)
Jean-Philippe Lang
Merged Git support branch (r1200 to r1226)....
r1222 def test_fetch_changesets_from_scratch
Toshi MARUYAMA
Rails3: scm: darcs: fix error of test_fetch_changesets_from_scratch at unit model test...
r6973 assert_equal 0, @repository.changesets.count
Jean-Philippe Lang
Merged Git support branch (r1200 to r1226)....
r1222 @repository.fetch_changesets
Toshi MARUYAMA
Rails3: scm: darcs: fix error of test_fetch_changesets_from_scratch at unit model test...
r6973 @project.reload
Toshi MARUYAMA
scm: darcs: change project id of unit app test from 1 to 3....
r4858
Toshi MARUYAMA
Rails3: scm: darcs: fix error of test_fetch_changesets_from_scratch at unit model test...
r6973 assert_equal NUM_REV, @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 13, @repository.filechanges.count
Jean-Philippe Lang
Postgresql 8.3 compatibility fix (#834)....
r1348 assert_equal "Initial commit.", @repository.changesets.find_by_revision('1').comments
Jean-Philippe Lang
Merged Git support branch (r1200 to r1226)....
r1222 end
Toshi MARUYAMA
scm: darcs: change project id of unit app test from 1 to 3....
r4858
Jean-Philippe Lang
Merged Git support branch (r1200 to r1226)....
r1222 def test_fetch_changesets_incremental
Toshi MARUYAMA
Rails3: scm: darcs: fix error of test_fetch_changesets_incremental at unit model test...
r6998 assert_equal 0, @repository.changesets.count
Jean-Philippe Lang
Merged Git support branch (r1200 to r1226)....
r1222 @repository.fetch_changesets
Toshi MARUYAMA
Rails3: scm: darcs: fix error of test_fetch_changesets_incremental at unit model test...
r6998 @project.reload
assert_equal NUM_REV, @repository.changesets.count
Jean-Philippe Lang
Merged Git support branch (r1200 to r1226)....
r1222 # Remove changesets with revision > 3
Toshi MARUYAMA
remove unneeded Relation#all from RepositoryDarcsTest...
r12300 @repository.changesets.each {|c| c.destroy if c.revision.to_i > 3}
Toshi MARUYAMA
Rails3: scm: darcs: fix error of test_fetch_changesets_incremental at unit model test...
r6998 @project.reload
Toshi MARUYAMA
Rails4: scm: reload repository after destroying changesets in incremental fetch test...
r12197 @repository.reload
Jean-Philippe Lang
Merged Git support branch (r1200 to r1226)....
r1222 assert_equal 3, @repository.changesets.count
Toshi MARUYAMA
scm: darcs: remove trailing white-spaces from unit model test....
r5920
Jean-Philippe Lang
Merged Git support branch (r1200 to r1226)....
r1222 @repository.fetch_changesets
Toshi MARUYAMA
Rails3: scm: darcs: fix error of test_fetch_changesets_incremental at unit model test...
r6998 @project.reload
assert_equal NUM_REV, @repository.changesets.count
Jean-Philippe Lang
Merged Git support branch (r1200 to r1226)....
r1222 end
Toshi MARUYAMA
scm: darcs: change project id of unit app test from 1 to 3....
r4858
Jean-Philippe Lang
Fixed that Repository#entries returns an Array....
r9621 def test_entries
entries = @repository.entries
assert_kind_of Redmine::Scm::Adapters::Entries, entries
end
Toshi MARUYAMA
scm: darcs: add entries test in invalid revision in model....
r5315 def test_entries_invalid_revision
Toshi MARUYAMA
Rails3: scm: darcs: fix error of test_entries_invalid_revision at unit model test...
r6999 assert_equal 0, @repository.changesets.count
Toshi MARUYAMA
scm: darcs: add entries test in invalid revision in model....
r5315 @repository.fetch_changesets
Toshi MARUYAMA
Rails3: scm: darcs: fix error of test_entries_invalid_revision at unit model test...
r6999 @project.reload
assert_equal NUM_REV, @repository.changesets.count
Toshi MARUYAMA
scm: darcs: add entries test in invalid revision in model....
r5315 assert_nil @repository.entries('', '123')
end
Jean-Philippe Lang
Fixed: deleted files should not be shown when browsing a Darcs repository (#2385)....
r2187 def test_deleted_files_should_not_be_listed
Toshi MARUYAMA
Rails3: scm: darcs: fix error of test_deleted_files_should_not_be_listed at unit model test...
r7000 assert_equal 0, @repository.changesets.count
Toshi MARUYAMA
scm: darcs: change project id of unit app test from 1 to 3....
r4858 @repository.fetch_changesets
Toshi MARUYAMA
Rails3: scm: darcs: fix error of test_deleted_files_should_not_be_listed at unit model test...
r7000 @project.reload
assert_equal NUM_REV, @repository.changesets.count
Jean-Philippe Lang
Fixed: deleted files should not be shown when browsing a Darcs repository (#2385)....
r2187 entries = @repository.entries('sources')
assert entries.detect {|e| e.name == 'watchers_controller.rb'}
assert_nil entries.detect {|e| e.name == 'welcome_controller.rb'}
end
Toshi MARUYAMA
repository: switch darcs cat test if cat supports....
r4488
Jean-Philippe Lang
Adds support for file viewing with Darcs 2.0+ (patch #1799 by Ralph Lange slightly edited)....
r1758 def test_cat
Toshi MARUYAMA
repository: switch darcs cat test if cat supports....
r4488 if @repository.scm.supports_cat?
Toshi MARUYAMA
Rails3: scm: darcs: fix error of test_cat at unit model test...
r7001 assert_equal 0, @repository.changesets.count
Toshi MARUYAMA
repository: switch darcs cat test if cat supports....
r4488 @repository.fetch_changesets
Toshi MARUYAMA
Rails3: scm: darcs: fix error of test_cat at unit model test...
r7001 @project.reload
assert_equal NUM_REV, @repository.changesets.count
Toshi MARUYAMA
repository: switch darcs cat test if cat supports....
r4488 cat = @repository.cat("sources/welcome_controller.rb", 2)
assert_not_nil cat
assert cat.include?('class WelcomeController < ApplicationController')
end
Jean-Philippe Lang
Adds support for file viewing with Darcs 2.0+ (patch #1799 by Ralph Lange slightly edited)....
r1758 end
Jean-Philippe Lang
Merged Git support branch (r1200 to r1226)....
r1222 else
puts "Darcs test repository NOT FOUND. Skipping unit tests !!!"
def test_fake; assert true end
end
end