@@ -140,23 +140,47 class RepositoryTest < ActiveSupport::TestCase | |||
|
140 | 140 | |
|
141 | 141 | def test_manual_user_mapping |
|
142 | 142 | assert_no_difference "Changeset.count(:conditions => 'user_id <> 2')" do |
|
143 | c = Changeset.create!(:repository => @repository, :committer => 'foo', :committed_on => Time.now, :revision => 100, :comments => 'Committed by foo.') | |
|
143 | c = Changeset.create!( | |
|
144 | :repository => @repository, | |
|
145 | :committer => 'foo', | |
|
146 | :committed_on => Time.now, | |
|
147 | :revision => 100, | |
|
148 | :comments => 'Committed by foo.' | |
|
149 | ) | |
|
144 | 150 | assert_nil c.user |
|
145 | 151 | @repository.committer_ids = {'foo' => '2'} |
|
146 | 152 | assert_equal User.find(2), c.reload.user |
|
147 | 153 | # committer is now mapped |
|
148 | c = Changeset.create!(:repository => @repository, :committer => 'foo', :committed_on => Time.now, :revision => 101, :comments => 'Another commit by foo.') | |
|
154 | c = Changeset.create!( | |
|
155 | :repository => @repository, | |
|
156 | :committer => 'foo', | |
|
157 | :committed_on => Time.now, | |
|
158 | :revision => 101, | |
|
159 | :comments => 'Another commit by foo.' | |
|
160 | ) | |
|
149 | 161 | assert_equal User.find(2), c.user |
|
150 | 162 | end |
|
151 | 163 | end |
|
152 | 164 | |
|
153 | 165 | def test_auto_user_mapping_by_username |
|
154 | c = Changeset.create!(:repository => @repository, :committer => 'jsmith', :committed_on => Time.now, :revision => 100, :comments => 'Committed by john.') | |
|
166 | c = Changeset.create!( | |
|
167 | :repository => @repository, | |
|
168 | :committer => 'jsmith', | |
|
169 | :committed_on => Time.now, | |
|
170 | :revision => 100, | |
|
171 | :comments => 'Committed by john.' | |
|
172 | ) | |
|
155 | 173 | assert_equal User.find(2), c.user |
|
156 | 174 | end |
|
157 | 175 | |
|
158 | 176 | def test_auto_user_mapping_by_email |
|
159 | c = Changeset.create!(:repository => @repository, :committer => 'john <jsmith@somenet.foo>', :committed_on => Time.now, :revision => 100, :comments => 'Committed by john.') | |
|
177 | c = Changeset.create!( | |
|
178 | :repository => @repository, | |
|
179 | :committer => 'john <jsmith@somenet.foo>', | |
|
180 | :committed_on => Time.now, | |
|
181 | :revision => 100, | |
|
182 | :comments => 'Committed by john.' | |
|
183 | ) | |
|
160 | 184 | assert_equal User.find(2), c.user |
|
161 | 185 | end |
|
162 | 186 | end |
General Comments 0
You need to be logged in to leave comments.
Login now