scm: code clean up test/unit/repository_test.rb.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5195 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
e580dbc6a3
commit
d590a5583b
|
@ -140,23 +140,47 @@ class RepositoryTest < ActiveSupport::TestCase
|
|||
|
||||
def test_manual_user_mapping
|
||||
assert_no_difference "Changeset.count(:conditions => 'user_id <> 2')" do
|
||||
c = Changeset.create!(:repository => @repository, :committer => 'foo', :committed_on => Time.now, :revision => 100, :comments => 'Committed by foo.')
|
||||
c = Changeset.create!(
|
||||
:repository => @repository,
|
||||
:committer => 'foo',
|
||||
:committed_on => Time.now,
|
||||
:revision => 100,
|
||||
:comments => 'Committed by foo.'
|
||||
)
|
||||
assert_nil c.user
|
||||
@repository.committer_ids = {'foo' => '2'}
|
||||
assert_equal User.find(2), c.reload.user
|
||||
# committer is now mapped
|
||||
c = Changeset.create!(:repository => @repository, :committer => 'foo', :committed_on => Time.now, :revision => 101, :comments => 'Another commit by foo.')
|
||||
c = Changeset.create!(
|
||||
:repository => @repository,
|
||||
:committer => 'foo',
|
||||
:committed_on => Time.now,
|
||||
:revision => 101,
|
||||
:comments => 'Another commit by foo.'
|
||||
)
|
||||
assert_equal User.find(2), c.user
|
||||
end
|
||||
end
|
||||
|
||||
def test_auto_user_mapping_by_username
|
||||
c = Changeset.create!(:repository => @repository, :committer => 'jsmith', :committed_on => Time.now, :revision => 100, :comments => 'Committed by john.')
|
||||
c = Changeset.create!(
|
||||
:repository => @repository,
|
||||
:committer => 'jsmith',
|
||||
:committed_on => Time.now,
|
||||
:revision => 100,
|
||||
:comments => 'Committed by john.'
|
||||
)
|
||||
assert_equal User.find(2), c.user
|
||||
end
|
||||
|
||||
def test_auto_user_mapping_by_email
|
||||
c = Changeset.create!(:repository => @repository, :committer => 'john <jsmith@somenet.foo>', :committed_on => Time.now, :revision => 100, :comments => 'Committed by john.')
|
||||
c = Changeset.create!(
|
||||
:repository => @repository,
|
||||
:committer => 'john <jsmith@somenet.foo>',
|
||||
:committed_on => Time.now,
|
||||
:revision => 100,
|
||||
:comments => 'Committed by john.'
|
||||
)
|
||||
assert_equal User.find(2), c.user
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue