summaryrefslogtreecommitdiffstats
path: root/test/functional/repositories_controller_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-11-10 18:59:06 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-11-10 18:59:06 +0000
commit79c33bbc838fd837e516fd60569dbcf7917bd534 (patch)
tree20695e6f03f08925d6be3c96846668d979b4b3b3 /test/functional/repositories_controller_test.rb
parentf6b2be81b9cb09485a08e58fc73d9290fd544148 (diff)
downloadredmine-79c33bbc838fd837e516fd60569dbcf7917bd534.tar.gz
redmine-79c33bbc838fd837e516fd60569dbcf7917bd534.zip
Maps repository users to Redmine users (#1383).
Users with same username or email are automatically mapped. Mapping can be manually adjusted in repository settings. Multiple usernames can be mapped to the same Redmine user. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2006 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/repositories_controller_test.rb')
-rw-r--r--test/functional/repositories_controller_test.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/functional/repositories_controller_test.rb b/test/functional/repositories_controller_test.rb
index 2892f3bd1..4bb9c3fa3 100644
--- a/test/functional/repositories_controller_test.rb
+++ b/test/functional/repositories_controller_test.rb
@@ -61,4 +61,38 @@ class RepositoriesControllerTest < Test::Unit::TestCase
assert_response :success
assert_equal 'image/svg+xml', @response.content_type
end
+
+ def test_committers
+ @request.session[:user_id] = 2
+ # add a commit with an unknown user
+ Changeset.create!(:repository => Project.find(1).repository, :committer => 'foo', :committed_on => Time.now, :revision => 100, :comments => 'Committed by foo.')
+
+ get :committers, :id => 1
+ assert_response :success
+ assert_template 'committers'
+
+ assert_tag :td, :content => 'dlopper',
+ :sibling => { :tag => 'td',
+ :child => { :tag => 'select', :attributes => { :name => 'committers[dlopper]' },
+ :child => { :tag => 'option', :content => 'Dave Lopper',
+ :attributes => { :value => '3', :selected => 'selected' }}}}
+ assert_tag :td, :content => 'foo',
+ :sibling => { :tag => 'td',
+ :child => { :tag => 'select', :attributes => { :name => 'committers[foo]' }}}
+ assert_no_tag :td, :content => 'foo',
+ :sibling => { :tag => 'td',
+ :descendant => { :tag => 'option', :attributes => { :selected => 'selected' }}}
+ end
+
+ def test_map_committers
+ @request.session[:user_id] = 2
+ # add a commit with an unknown user
+ c = Changeset.create!(:repository => Project.find(1).repository, :committer => 'foo', :committed_on => Time.now, :revision => 100, :comments => 'Committed by foo.')
+
+ assert_no_difference "Changeset.count(:conditions => 'user_id = 3')" do
+ post :committers, :id => 1, :committers => { 'foo' => '2', 'dlopper' => '3'}
+ assert_redirected_to '/repositories/committers/ecookbook'
+ assert_equal User.find(2), c.reload.user
+ end
+ end
end