summaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/repository_bazaar_test.rb2
-rw-r--r--test/unit/repository_cvs_test.rb2
-rw-r--r--test/unit/repository_darcs_test.rb2
-rw-r--r--test/unit/repository_filesystem_test.rb4
-rw-r--r--test/unit/repository_git_test.rb6
-rw-r--r--test/unit/repository_mercurial_test.rb8
-rw-r--r--test/unit/repository_subversion_test.rb4
-rw-r--r--test/unit/repository_test.rb6
8 files changed, 18 insertions, 16 deletions
diff --git a/test/unit/repository_bazaar_test.rb b/test/unit/repository_bazaar_test.rb
index 6e92aa33e..2713f9473 100644
--- a/test/unit/repository_bazaar_test.rb
+++ b/test/unit/repository_bazaar_test.rb
@@ -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
diff --git a/test/unit/repository_cvs_test.rb b/test/unit/repository_cvs_test.rb
index 1f303a9fd..0fc1873c7 100644
--- a/test/unit/repository_cvs_test.rb
+++ b/test/unit/repository_cvs_test.rb
@@ -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')
diff --git a/test/unit/repository_darcs_test.rb b/test/unit/repository_darcs_test.rb
index 06d0bff5e..9923e0cbd 100644
--- a/test/unit/repository_darcs_test.rb
+++ b/test/unit/repository_darcs_test.rb
@@ -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
diff --git a/test/unit/repository_filesystem_test.rb b/test/unit/repository_filesystem_test.rb
index b0604c689..25e7c88a9 100644
--- a/test/unit/repository_filesystem_test.rb
+++ b/test/unit/repository_filesystem_test.rb
@@ -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
diff --git a/test/unit/repository_git_test.rb b/test/unit/repository_git_test.rb
index d4d0e8c1a..9f053df57 100644
--- a/test/unit/repository_git_test.rb
+++ b/test/unit/repository_git_test.rb
@@ -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
diff --git a/test/unit/repository_mercurial_test.rb b/test/unit/repository_mercurial_test.rb
index 0b6c4fa71..8d6e076d1 100644
--- a/test/unit/repository_mercurial_test.rb
+++ b/test/unit/repository_mercurial_test.rb
@@ -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
diff --git a/test/unit/repository_subversion_test.rb b/test/unit/repository_subversion_test.rb
index c952cf8e5..8ea8ce0c5 100644
--- a/test/unit/repository_subversion_test.rb
+++ b/test/unit/repository_subversion_test.rb
@@ -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'
diff --git a/test/unit/repository_test.rb b/test/unit/repository_test.rb
index b96503662..0bd9af4b5 100644
--- a/test/unit/repository_test.rb
+++ b/test/unit/repository_test.rb
@@ -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