summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2007-05-15 21:32:36 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2007-05-15 21:32:36 +0000
commitbb1fccb7b7202ec065fdc39646067054580d278f (patch)
treec82b1c393e4e39a9a3bda4ab87b358ffe7db11e8 /test
parent777c9acae8d6ea59ba54f915edff85b8ebb26546 (diff)
downloadredmine-bb1fccb7b7202ec065fdc39646067054580d278f.tar.gz
redmine-bb1fccb7b7202ec065fdc39646067054580d278f.zip
Fixed: performance issue on RepositoriesController#revisions when a changeset has a great number of changes (eg. 100,000).
Also added pagination for changes on changeset details view. git-svn-id: http://redmine.rubyforge.org/svn/trunk@535 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/fixtures/changes.yml16
-rw-r--r--test/unit/repository_test.rb21
2 files changed, 32 insertions, 5 deletions
diff --git a/test/fixtures/changes.yml b/test/fixtures/changes.yml
new file mode 100644
index 000000000..30acbd02d
--- /dev/null
+++ b/test/fixtures/changes.yml
@@ -0,0 +1,16 @@
+---
+changes_001:
+ id: 1
+ changeset_id: 100
+ action: A
+ path: /test/some/path/in/the/repo
+ from_path:
+ from_revision:
+changes_002:
+ id: 2
+ changeset_id: 100
+ action: A
+ path: /test/some/path/elsewhere/in/the/repo
+ from_path:
+ from_revision:
+ \ No newline at end of file
diff --git a/test/unit/repository_test.rb b/test/unit/repository_test.rb
index 5e0fb56fd..fd4fb6737 100644
--- a/test/unit/repository_test.rb
+++ b/test/unit/repository_test.rb
@@ -18,7 +18,11 @@
require File.dirname(__FILE__) + '/../test_helper'
class RepositoryTest < Test::Unit::TestCase
- fixtures :projects, :repositories, :issues, :issue_statuses, :changesets
+ fixtures :projects, :repositories, :issues, :issue_statuses, :changesets, :changes
+
+ def setup
+ @repository = Project.find(1).repository
+ end
def test_create
repository = Repository.new(:project => Project.find(2))
@@ -33,10 +37,9 @@ class RepositoryTest < Test::Unit::TestCase
end
def test_cant_change_url
- repository = Project.find(1).repository
- url = repository.url
- repository.url = "svn://anotherhost"
- assert_equal url, repository.url
+ url = @repository.url
+ @repository.url = "svn://anotherhost"
+ assert_equal url, @repository.url
end
def test_scan_changesets_for_issue_ids
@@ -56,4 +59,12 @@ class RepositoryTest < Test::Unit::TestCase
# ignoring commits referencing an issue of another project
assert_equal [], Issue.find(4).changesets
end
+
+ def test_changesets_with_path
+ @repository.changesets_with_path '/some/path' do
+ assert_equal 1, @repository.changesets.count(:select => "DISTINCT #{Changeset.table_name}.id")
+ changesets = @repository.changesets.find(:all)
+ assert_equal 1, changesets.size
+ end
+ end
end