##// END OF EJS Templates
add unit test that enumeration returns default in regardless of active or not...
add unit test that enumeration returns default in regardless of active or not git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10231 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r9621:9b60214b3a3e
r10048:3478a21c2fe5
Show More
repository_filesystem_test.rb
89 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
Copyright update....
r9453 # Copyright (C) 2006-2012 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
assert_include "Root directory can't be blank",
repo.errors.full_messages
end
def test_blank_root_directory_error_message_fr
set_language_if_valid 'fr'
str = "R\xc3\xa9pertoire racine doit \xc3\xaatre renseign\xc3\xa9(e)"
str.force_encoding('UTF-8') if str.respond_to?(:force_encoding)
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