summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Baptiste Barth <jeanbaptiste.barth@gmail.com>2014-08-26 13:58:58 +0000
committerJean-Baptiste Barth <jeanbaptiste.barth@gmail.com>2014-08-26 13:58:58 +0000
commit41bf39df36550db5b6ba9ccc167ac02021f69edc (patch)
tree11c4c2b2ab1c7ba555401302a698fa21266ef376 /test
parente3e14ce3a119f61f22a75c1fdea314e88e0a4d9b (diff)
downloadredmine-41bf39df36550db5b6ba9ccc167ac02021f69edc.tar.gz
redmine-41bf39df36550db5b6ba9ccc167ac02021f69edc.zip
Move some RepositoriesController logic to Repository#stats_by_author (#13487).
git-svn-id: http://svn.redmine.org/redmine/trunk@13351 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/unit/repository_test.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/unit/repository_test.rb b/test/unit/repository_test.rb
index 8d2e7866a..173483c2d 100644
--- a/test/unit/repository_test.rb
+++ b/test/unit/repository_test.rb
@@ -395,4 +395,23 @@ class RepositoryTest < ActiveSupport::TestCase
[r1, r2].sort
end
end
+
+ def test_stats_by_author_reflect_changesets_and_changes
+ repository = Repository.find(10)
+
+ expected = {"dlopper"=>{:commits_count=>10, :changes_count=>3}}
+ assert_equal expected, repository.stats_by_author
+
+ set = Changeset.create!(
+ :repository => repository,
+ :committer => 'dlopper',
+ :committed_on => Time.now,
+ :revision => 101,
+ :comments => 'Another commit by foo.'
+ )
+ Change.create!(:changeset => set, :action => 'create', :path => '/path/to/file1')
+ Change.create!(:changeset => set, :action => 'create', :path => '/path/to/file2')
+ expected = {"dlopper"=>{:commits_count=>11, :changes_count=>5}}
+ assert_equal expected, repository.stats_by_author
+ end
end