Renamed #changes association to #filechanges (clash with AR::Base.changes that triggers errors with Rails 3.2.5).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9759 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -67,7 +67,7 @@ class RepositoryBazaarTest < ActiveSupport::TestCase
|
||||
@project.reload
|
||||
|
||||
assert_equal NUM_REV, @repository.changesets.count
|
||||
assert_equal 9, @repository.changes.count
|
||||
assert_equal 9, @repository.filechanges.count
|
||||
assert_equal 'Initial import', @repository.changesets.find_by_revision('1').comments
|
||||
end
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ class RepositoryCvsTest < ActiveSupport::TestCase
|
||||
@project.reload
|
||||
|
||||
assert_equal CHANGESETS_NUM, @repository.changesets.count
|
||||
assert_equal 16, @repository.changes.count
|
||||
assert_equal 16, @repository.filechanges.count
|
||||
assert_not_nil @repository.changesets.find_by_comments('Two files changed')
|
||||
|
||||
r2 = @repository.changesets.find_by_revision('2')
|
||||
|
||||
@@ -68,7 +68,7 @@ class RepositoryDarcsTest < ActiveSupport::TestCase
|
||||
@project.reload
|
||||
|
||||
assert_equal NUM_REV, @repository.changesets.count
|
||||
assert_equal 13, @repository.changes.count
|
||||
assert_equal 13, @repository.filechanges.count
|
||||
assert_equal "Initial commit.", @repository.changesets.find_by_revision('1').comments
|
||||
end
|
||||
|
||||
|
||||
@@ -62,11 +62,11 @@ class RepositoryFilesystemTest < ActiveSupport::TestCase
|
||||
if File.directory?(REPOSITORY_PATH)
|
||||
def test_fetch_changesets
|
||||
assert_equal 0, @repository.changesets.count
|
||||
assert_equal 0, @repository.changes.count
|
||||
assert_equal 0, @repository.filechanges.count
|
||||
@repository.fetch_changesets
|
||||
@project.reload
|
||||
assert_equal 0, @repository.changesets.count
|
||||
assert_equal 0, @repository.changes.count
|
||||
assert_equal 0, @repository.filechanges.count
|
||||
end
|
||||
|
||||
def test_entries
|
||||
|
||||
@@ -105,7 +105,7 @@ class RepositoryGitTest < ActiveSupport::TestCase
|
||||
@project.reload
|
||||
|
||||
assert_equal NUM_REV, @repository.changesets.count
|
||||
assert_equal 39, @repository.changes.count
|
||||
assert_equal 39, @repository.filechanges.count
|
||||
|
||||
commit = @repository.changesets.find_by_revision("7234cb2750b63f47bff735edc50a1c0a433c2518")
|
||||
assert_equal "7234cb2750b63f47bff735edc50a1c0a433c2518", commit.scmid
|
||||
@@ -115,8 +115,8 @@ class RepositoryGitTest < ActiveSupport::TestCase
|
||||
# TODO: add a commit with commit time <> author time to the test repository
|
||||
assert_equal "2007-12-14 09:22:52".to_time, commit.committed_on
|
||||
assert_equal "2007-12-14".to_date, commit.commit_date
|
||||
assert_equal 3, commit.changes.count
|
||||
change = commit.changes.sort_by(&:path).first
|
||||
assert_equal 3, commit.filechanges.count
|
||||
change = commit.filechanges.sort_by(&:path).first
|
||||
assert_equal "README", change.path
|
||||
assert_equal nil, change.from_path
|
||||
assert_equal "A", change.action
|
||||
|
||||
@@ -86,7 +86,7 @@ class RepositoryMercurialTest < ActiveSupport::TestCase
|
||||
@repository.fetch_changesets
|
||||
@project.reload
|
||||
assert_equal NUM_REV, @repository.changesets.count
|
||||
assert_equal 46, @repository.changes.count
|
||||
assert_equal 46, @repository.filechanges.count
|
||||
assert_equal "Initial import.\nThe repository contains 3 files.",
|
||||
@repository.changesets.find_by_revision('0').comments
|
||||
end
|
||||
@@ -214,7 +214,7 @@ class RepositoryMercurialTest < ActiveSupport::TestCase
|
||||
|
||||
cs1 = @repository.changesets.find_by_revision('13')
|
||||
assert_not_nil cs1
|
||||
c1 = cs1.changes.sort_by(&:path)
|
||||
c1 = cs1.filechanges.sort_by(&:path)
|
||||
assert_equal 2, c1.size
|
||||
|
||||
assert_equal 'A', c1[0].action
|
||||
@@ -227,7 +227,7 @@ class RepositoryMercurialTest < ActiveSupport::TestCase
|
||||
assert_equal '/sql_escape/underscore_dir/understrike_file.txt', c1[1].from_path
|
||||
|
||||
cs2 = @repository.changesets.find_by_revision('15')
|
||||
c2 = cs2.changes
|
||||
c2 = cs2.filechanges
|
||||
assert_equal 1, c2.size
|
||||
|
||||
assert_equal 'A', c2[0].action
|
||||
@@ -236,7 +236,7 @@ class RepositoryMercurialTest < ActiveSupport::TestCase
|
||||
assert_equal '933ca60293d7', c2[0].from_revision
|
||||
|
||||
cs3 = @repository.changesets.find_by_revision('19')
|
||||
c3 = cs3.changes
|
||||
c3 = cs3.filechanges
|
||||
assert_equal 1, c3.size
|
||||
assert_equal 'A', c3[0].action
|
||||
assert_equal "/latin-1-dir/test-#{@char_1}-1.txt", c3[0].path
|
||||
|
||||
@@ -36,7 +36,7 @@ class RepositorySubversionTest < ActiveSupport::TestCase
|
||||
@project.reload
|
||||
|
||||
assert_equal NUM_REV, @repository.changesets.count
|
||||
assert_equal 20, @repository.changes.count
|
||||
assert_equal 20, @repository.filechanges.count
|
||||
assert_equal 'Initial import.', @repository.changesets.find_by_revision('1').comments
|
||||
end
|
||||
|
||||
@@ -99,7 +99,7 @@ class RepositorySubversionTest < ActiveSupport::TestCase
|
||||
@project.reload
|
||||
|
||||
assert_equal 1, @repository.changesets.count, 'Expected to see 1 revision'
|
||||
assert_equal 2, @repository.changes.count, 'Expected to see 2 changes, dir add and file add'
|
||||
assert_equal 2, @repository.filechanges.count, 'Expected to see 2 changes, dir add and file add'
|
||||
|
||||
entries = @repository.entries('')
|
||||
assert_not_nil entries, 'Expect to find entries'
|
||||
|
||||
@@ -98,8 +98,10 @@ class RepositoryTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
def test_destroy
|
||||
changesets = Changeset.where("repository_id = 10").all.count
|
||||
changes = Changeset.joins([:changes]).where("repository_id = 10").all.count
|
||||
repository = Repository.find(10)
|
||||
changesets = repository.changesets.count
|
||||
changes = repository.filechanges.count
|
||||
|
||||
assert_difference 'Changeset.count', -changesets do
|
||||
assert_difference 'Change.count', -changes do
|
||||
Repository.find(10).destroy
|
||||
|
||||
Reference in New Issue
Block a user