##// END OF EJS Templates
scm: code clean up test/unit/repository_test.rb....
Toshi MARUYAMA -
r5075:d590a5583bbf
parent child
Show More
@@ -140,23 +140,47 class RepositoryTest < ActiveSupport::TestCase
140
140
141 def test_manual_user_mapping
141 def test_manual_user_mapping
142 assert_no_difference "Changeset.count(:conditions => 'user_id <> 2')" do
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 assert_nil c.user
150 assert_nil c.user
145 @repository.committer_ids = {'foo' => '2'}
151 @repository.committer_ids = {'foo' => '2'}
146 assert_equal User.find(2), c.reload.user
152 assert_equal User.find(2), c.reload.user
147 # committer is now mapped
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 assert_equal User.find(2), c.user
161 assert_equal User.find(2), c.user
150 end
162 end
151 end
163 end
152
164
153 def test_auto_user_mapping_by_username
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 assert_equal User.find(2), c.user
173 assert_equal User.find(2), c.user
156 end
174 end
157
175
158 def test_auto_user_mapping_by_email
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 assert_equal User.find(2), c.user
184 assert_equal User.find(2), c.user
161 end
185 end
162 end
186 end
General Comments 0
You need to be logged in to leave comments. Login now