def test_blank_log_encoding_error_message
set_language_if_valid 'en'
- repo = Repository::Bazaar.new(
- :project => Project.find(3),
- :url => "/test",
- :log_encoding => ''
- )
+ repo =
+ Repository::Bazaar.
+ new(
+ :project => Project.find(3),
+ :url => "/test",
+ :log_encoding => ''
+ )
assert !repo.save
assert_include "Commit messages encoding cannot be blank",
repo.errors.full_messages
def test_blank_log_encoding_error_message_fr
set_language_if_valid 'fr'
- repo = Repository::Bazaar.new(
- :project => Project.find(3),
- :url => "/test"
- )
+ repo =
+ Repository::Bazaar.
+ new(
+ :project => Project.find(3),
+ :url => "/test"
+ )
assert !repo.save
assert_include 'Encodage des messages de commit doit ĂȘtre renseignĂ©(e)', repo.errors.full_messages
end
end
def test_first_repository_should_be_set_as_default
- repository1 = Repository::Subversion.new(
- :project => Project.find(3),
- :identifier => 'svn1',
- :url => 'file:///svn1'
- )
+ repository1 =
+ Repository::Subversion.
+ new(
+ :project => Project.find(3),
+ :identifier => 'svn1',
+ :url => 'file:///svn1'
+ )
assert repository1.save
assert repository1.is_default?
- repository2 = Repository::Subversion.new(
- :project => Project.find(3),
- :identifier => 'svn2',
- :url => 'file:///svn2'
- )
+ repository2 =
+ Repository::Subversion.
+ new(
+ :project => Project.find(3),
+ :identifier => 'svn2',
+ :url => 'file:///svn2'
+ )
assert repository2.save
assert !repository2.is_default?
def test_default_repository_should_be_one
assert_equal 0, Project.find(3).repositories.count
- repository1 = Repository::Subversion.new(
- :project => Project.find(3),
- :identifier => 'svn1',
- :url => 'file:///svn1'
- )
+ repository1 =
+ Repository::Subversion.
+ new(
+ :project => Project.find(3),
+ :identifier => 'svn1',
+ :url => 'file:///svn1'
+ )
assert repository1.save
assert repository1.is_default?
- repository2 = Repository::Subversion.new(
- :project => Project.find(3),
- :identifier => 'svn2',
- :url => 'file:///svn2',
- :is_default => true
- )
+ repository2 =
+ Repository::Subversion.
+ new(
+ :project => Project.find(3),
+ :identifier => 'svn2',
+ :url => 'file:///svn2',
+ :is_default => true
+ )
assert repository2.save
assert repository2.is_default?
repository1.reload
end
def test_identifier_should_accept_letters_digits_dashes_and_underscores
- r = Repository::Subversion.new(
- :project_id => 3,
- :identifier => 'svn-123_45',
- :url => 'file:///svn'
- )
+ r =
+ Repository::Subversion.
+ new(
+ :project_id => 3,
+ :identifier => 'svn-123_45',
+ :url => 'file:///svn'
+ )
assert r.save
end
def test_should_not_create_with_disabled_scm
# disable Subversion
with_settings :enabled_scm => ['Mercurial', 'Git'] do
- repository = Repository::Subversion.new(
- :project => Project.find(3), :url => "svn://localhost")
+ repository =
+ Repository::Subversion.
+ new(
+ :project => Project.find(3),
+ :url => "svn://localhost"
+ )
assert !repository.save
assert_include I18n.translate('activerecord.errors.messages.invalid'),
repository.errors[:type]
ActionMailer::Base.deliveries.first(2).each do |mail|
assert_not_nil mail
assert mail.subject.starts_with?(
- "[#{fixed_issue.project.name} - #{fixed_issue.tracker.name} ##{fixed_issue.id}]")
+ "[#{fixed_issue.project.name} - #{fixed_issue.tracker.name} ##{fixed_issue.id}]"
+ )
assert_mail_body_match(
- "Status changed from #{old_status} to #{fixed_issue.status}", mail)
+ "Status changed from #{old_status} to #{fixed_issue.status}", mail
+ )
end
# ignoring commits referencing an issue of another project
end
def test_for_changeset_comments_strip
- repository = Repository::Mercurial.create(
- :project => Project.find(4),
- :url => '/foo/bar/baz' )
+ repository =
+ Repository::Mercurial.
+ create(
+ :project => Project.find(4),
+ :url => '/foo/bar/baz'
+ )
long_whitespace = " "
expected_comment = "This is a loooooooooooooooooooooooooooong comment"
comment = +"#{expected_comment}#{long_whitespace}\n"
end
def test_for_urls_strip_cvs
- repository = Repository::Cvs.create(
- :project => Project.find(4),
- :url => ' :pserver:login:password@host:/path/to/the/repository',
- :root_url => 'foo ',
- :log_encoding => 'UTF-8')
+ repository =
+ Repository::Cvs.
+ create(
+ :project => Project.find(4),
+ :url => ' :pserver:login:password@host:/path/to/the/repository',
+ :root_url => 'foo ',
+ :log_encoding => 'UTF-8'
+ )
assert repository.save
repository.reload
assert_equal ':pserver:login:password@host:/path/to/the/repository',
end
def test_for_urls_strip_subversion
- repository = Repository::Subversion.create(
- :project => Project.find(4),
- :url => ' file:///dummy ')
+ repository =
+ Repository::Subversion.
+ create(
+ :project => Project.find(4),
+ :url => ' file:///dummy '
+ )
assert repository.save
repository.reload
assert_equal 'file:///dummy', repository.url
end
def test_for_urls_strip_git
- repository = Repository::Git.create(
- :project => Project.find(4),
- :url => ' c:\dummy ')
+ repository =
+ Repository::Git.
+ create(
+ :project => Project.find(4),
+ :url => ' c:\dummy '
+ )
assert repository.save
repository.reload
assert_equal 'c:\dummy', repository.url
def test_manual_user_mapping
assert_no_difference "Changeset.where('user_id <> 2').count" do
- c = Changeset.create!(
+ c = Changeset.
+ create!(
:repository => @repository,
:committer => 'foo',
:committed_on => Time.now,
@repository.committer_ids = {'foo' => '2'}
assert_equal User.find(2), c.reload.user
# committer is now mapped
- c = Changeset.create!(
+ c = Changeset.
+ create!(
:repository => @repository,
:committer => 'foo',
:committed_on => Time.now,
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