##// END OF EJS Templates
add unit test to validate time entry...
add unit test to validate time entry git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7447 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r7001:8ebb5b61e8b5
r7327:34f2d382b75e
Show More
repository_darcs_test.rb
96 lines | 3.4 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
# Copyright (C) 2006-2011 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: 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: 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
Merged Git support branch (r1200 to r1226)....
r1222 assert_equal 13, @repository.changes.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
Jean-Philippe Lang
Postgresql 8.3 compatibility fix (#834)....
r1348 @repository.changesets.find(:all).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
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
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